This article is a stub. You can help by adding to it.
The 'ignition circuit' of every Source game and mod is the file traditonally named
<game>_client.cpp. It contains several scopeless functions (i.e. not in a class) that are called when server.dll is loaded, when the world spawns, when a player connects, and so on. One of its main purposes is to create a player entity for all connecting clients. For obvious reasons there can only be one game_client.cpp in a project!
Rather than modify hl2_client.cpp or hl2mp_client.cpp it is advised to create your own. The functions defined in this file are global functions so to create your own <game>_client.cpp simply copy the existing one and rename it and then exclude the old one for the build. (right click->properties->Exclude from build -- yes),
The code is shared between all games and mods, so don't put anything game-specific in here!
The functions in _client.cpp are apparently called from within the engine, and as such must always be the same.
- Called when a player connects and activates respectively. These functions define the C++ class used for players.
- Called by
DeadThink()whenever a player dies. Spawns ragdolls in multiplayer, reloads the last saved game in singleplayer.
const char* GetGameDescription()
- Returns the descriptive name of the .dll (e.g. Half-Life or Team Fortress 2).
- Called when the !picker targetname is invoked.
- Precache function for the player. To do: Why not use
- Entry point for game-specific code that needs to run once per frame. Use with caution.
- Decides which GameRules to use. Use
CreateGameRulesObject( string ClassName )to do this.
Physics_RunThinkFunctions()- Runs the main physics simulation loop against all entities except players
CBasePlayer::PlayerRunCommand()- To do: This appears to actually be called from somewhere within the engine.
CPlayerMove::SetupMove()- applies a usercmd
IGameSystem::FrameUpdatePostEntityThinkAllSystems()- To do: call Think() on all non-player entities?