Map Lifecycle - Subject9x/battleMETAL GitHub Wiki

A little off the beaten path.

Quake's original map lifecyle is fairly simple.

  • The game loads up a .bsp map file.
  • client connects to game.
  • the player spawns in at the info_player_start entity.
  • they play through the map.
  • any number of map-logic entities will call the intermission entity or the changelevel entity.

battleMETAL adds a slight layer above this cycle to account for fun stuff like Objectives.

The new setup

  • game loads up a .bsp map file.

  • client connects to game.

  • CSQC loads .msn file after server sends client .faction value to that client.

  • player spawns in at info_player_start however, they are an 'observer'.

    • Observers do not collide with anything, cannot be targeted, and have FL_FLY flag.
  • CSQC for the player then brings up the CSQC menu system.

    • player state is tracked via client_state_events() being polled on every CSQC frame.
    • CLIENT_player_state and CLIENT_player_state_prev are compared to track state-transition events.
  • even while the CSQC menu is active, the Server is running in realtime.

    • this is important because it means that anything that spawns on map-start will immediately start doing whatever is they're setup to do.
    • in vanilla battleMETAL I got around this by tying most enemies to when the player spawned into a deploy_point and used a trigger_once entity.
  • After the player makes their mech choices, and chooses a deploy_point, they are then teleported to that point when they click Launch.

  • Maps end by triggering any map_mission_end entity.

    • if you want normal end-of-mission stuff like the Debrief screen anyway.
  • the map_mission_end entity has a map field where you place the filename of the next map you'd like to load after ending the mission and showing the Debrief menu.

make sense?

formal battleMETAL maps need at least 1 map_mission_end entity with a valid map value pointing to another map file. These maps also need at least 1 map_deploy_point of matching faction to the player so that the player can spawn into the map after selecting their mech.