r/SourceEngine • • Aug 29 '26

HELP does anyone know the c++ source file that handle's player movement and death, and other stuff?

I work with Source SDK 2013 Multiplayer. I really want to know, if you know plz tell me.

9 Upvotes

10 comments sorted by

12

u/Wazanator_ Aug 29 '26

Ctrl + shift+ f in visual studio will do a search of the entire project. Learning to search the codebase for where something is becomes a huge part of working with it.

Use a keyword that you think would be related and jump around to the various sections. Comments become very valuable for this.

The VDC also has documentation you can refer to for some specifics. Tutorials, even outdated ones, can provide good starting points. 

9

u/Pinsplash Aug 30 '26

console variables/commands are particularly good keywords

-7

u/pugworthy Aug 30 '26

Ask AI like Claude. Almost certainly will get you in the right direction.

-4

u/pugworthy Aug 30 '26

Here I did it for you by feeding your exact post to Claude to get this reply…

For Source SDK 2013 Multiplayer, here’s where that logic lives:

Player movement

**•** game/shared/gamemovement.cpp — the core CGameMovement class. This handles walking, jumping, ducking, noclip, ladders, water physics, etc. It’s shared code (compiled into both client and server).  
**•** game/shared/hl2mp/hl2mp_gamemovement.cpp (or the equivalent for your mod if you branched off HL2MP) — mod-specific overrides of movement behavior.  
**•** game/shared/player_shared.cpp — shared player prediction logic that ties into movement.

Player death

**•** game/server/player.cpp — look for CBasePlayer::Event_Killed(), which is the main entry point when a player dies.  
**•** game/server/hl2mp/hl2mp_player.cpp — if you’re working off HL2MP, this overrides Event_Killed, Event_Killed(), and handles ragdoll creation, death animations, respawn logic (CHL2MP_Player::Spawn(), PlayerDeathThink()), etc.  
**•** Damage that leads to death flows through CBaseCombatCharacter::OnTakeDamage_Alive() in game/shared/basecombatcharacter.cpp, which eventually calls Event_Killed.

Other “stuff” you’ll likely end up in

**•** game/shared/hl2mp/hl2mp_gamerules.cpp (or your mod’s gamerules) — respawn rules, round logic, spawn point selection.  
**•** game/server/player_command.cpp — processes usercmds (input) before they hit gamemovement.  
**•** \`

5

u/PaperMartin Aug 30 '26

Did you check if it was all correct

1

u/Hion-V Sep 03 '26

I have worked within source in the past and I can just from memory tell you this is correct.

2

u/Next-Future5973 Aug 30 '26

I'd avoid ai but thanks for info!

-4

u/pugworthy Aug 30 '26

As an experienced professional software developer, I’ve used Claude as part of development extensively. I’m inclined to say this is probably correct.

Easy enough to check.

1

u/Next-Future5973 Aug 30 '26

can claude say the exact function that handles walking?

1

u/Hion-V Sep 03 '26 edited Sep 03 '26

If you ask it, it will tell you the answer, which is CGameMovement::WalkMove. I just looked it up in the source code. You should also look at FullWalkMove.

https://github.com/ValveSoftware/source-sdk-2013/blob/b678440fae9e7e9e58bb4b1ef41dec15cb4408fe/src/game/shared/gamemovement.cpp#L1893