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/components/PowerupState.hpp"
#include "ecs/physics/MapLoader.hpp"
#include <SDL3/SDL_filesystem.h>
#include <SDL3/SDL_log.h>
#include <assimp/Importer.hpp>
#include <assimp/postprocess.h>
#include <assimp/scene.h>
#include <fstream>
#include <functional>
#include <iostream>
#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.

Classes

struct  gamemap::SpawnPoint
 A player spawn point: world position plus an authored facing yaw. More...
struct  gamemap::WeaponSpawner
struct  gamemap::PowerupSpawner
struct  gamemap::HealthPackSpawner
struct  gamemap::JumpPadSpawner
 Jump pad authored in Blender (entity_type = 3). More...
struct  gamemap::KillzoneSpawner
 Killzone authored in Blender (entity_type = 4). More...

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.
void gamemap::traverseNodeTree (const aiNode *node, int depth=0)
void * gamemap::getMetadataValue (const aiMetadata *metadata, const std::string &key)
float gamemap::getMetadataFloat (const aiMetadata *metadata, const std::string &key, float fallback)
 Read a numeric custom property as float.
bool gamemap::loadConfiguredMap (physics::MapCollisionData &out, const char *tag)
 Load the configured map's collision into out.

Variables

constexpr bool gamemap::k_separatedCollisionMap = false
 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_useVhacd = false
 Run V-HACD convex decomposition on non-convex prop meshes?
std::vector< SpawnPointgamemap::spawnPoints_
std::vector< WeaponSpawnergamemap::weaponSpawner_
std::vector< PowerupSpawnergamemap::powerupSpawner_
std::vector< HealthPackSpawnergamemap::healthPackSpawner_
std::vector< JumpPadSpawnergamemap::jumpPadSpawner_
std::vector< KillzoneSpawnergamemap::killzoneSpawner_

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 production collision-map contract (k_separatedCollisionMap, k_collisionPattern).
  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.