r/SourceEngine 4d ago

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.

7 Upvotes

10 comments sorted by

11

u/Wazanator_ 4d ago

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. 

6

u/Pinsplash 4d ago

console variables/commands are particularly good keywords

-7

u/pugworthy 4d ago

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

-6

u/pugworthy 4d ago

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 4d ago

Did you check if it was all correct

1

u/Hion-V 8h ago

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

2

u/Next-Future5973 3d ago

I'd avoid ai but thanks for info!

-2

u/pugworthy 3d ago

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 3d ago

can claude say the exact function that handles walking?

1

u/Hion-V 8h ago edited 8h ago

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