game mode architecture

Game Modes

Always derived from a physics simulation where characters interact with each other using hitscan or projectile weapons.

Overview

  • In general you filter based on game mode, and then you can select a supported map.
  • Maps can support multiple game modes, so a game mode contains a map.

Server

  • Takes in client_id_to_server_character and constructs a client_id_to_gamemode_character (or something of this form).
  • A game mode is a system which has custom logic of the form:
logic_when_shot_by_hitscan_weapon(attacker, victim)
  • Each parameter is a gamemode character.
  • Each gamemode has an update function and internal state.
  • The main loop calls the update function of whatever game mode is active.

Client

Consider what client data is required to render the game mode:

  • Custom objects that only exist for that game mode (e.g. flags in CTF).
  • Custom leaderboards.
  • Endscreen UIs and other UI state specific to the gamemode.

Networking / Packets

After identifying what data is required to completely render the gamemode, define the packets that contain that information.

The server gamemode should expose a function that returns the GameState for that gamemode; that packet is then sent to clients.


edit this page