group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
MapConfig.hpp File Reference

Single source of truth for which map is loaded and how, shared by client and server. More...

#include "ecs/AssetCatalog.hpp"
#include "ecs/physics/MapLoader.hpp"
#include <SDL3/SDL_filesystem.h>
#include <SDL3/SDL_log.h>
#include <string>
Include dependency graph for MapConfig.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  gamemap

Functions

physics::MapLoadOptions gamemap::makeLoadOptions ()
 Build the MapLoadOptions used by both client and server.
std::string gamemap::mapAbsolutePath ()
 Resolve the absolute path of the configured map file.
bool gamemap::loadConfiguredMap (physics::MapCollisionData &out, const char *tag)
 Load the configured map's collision into out.

Variables

constexpr bool gamemap::k_separatedCollisionMap = true
 Does this map use SEPARATED collision and visual meshes?
constexpr const char * gamemap::k_collisionPattern = "COL_"
 Substring that identifies collision-only nodes in separated mode.
constexpr bool gamemap::k_guessShapesProcessed = true
 Should collision meshes be auto-fit to primitive shapes, or kept as raw triMeshes (the exact artist-authored Blender geometry)?
constexpr bool gamemap::k_useVhacd = false
 Run V-HACD convex decomposition on non-convex prop meshes?

Detailed Description

Single source of truth for which map is loaded and how, shared by client and server.

Why this exists. The server is authoritative for movement and the client predicts; for prediction to agree with the server, both sides must extract exactly the same collision primitives from the exact same map file. Previously this code was duplicated in client/game/Game.cpp and server/game/ServerGame.cpp and the two could silently drift. Now both call gamemap::loadConfiguredMap() and read the same constants from this header.

What lives here.

  1. The "how to load it" toggles (k_separatedCollisionMap, k_guessShapesProcessed).
  2. The collision-pattern substring used in separated mode (k_collisionPattern).
  3. Helpers to build MapLoadOptions and resolve the absolute map path.
  4. loadConfiguredMap() — fills a MapCollisionData using the configured options.

What does NOT live here. The map filename itself. That stays in AssetCatalog.hpp (kMapAsset.filename) so there is one and only one source of truth for which file is loaded. Flipping the toggles below changes how the map is processed, never which map. To switch to a different map, edit kMapAsset in AssetCatalog.hpp.