Main loop (in D_SRB2Loop) consists of parts:
- Game logic: TryRunTics
- Graphics: D_Display
- Has special case for frozen netplay, which allows for moving the camera in that situation without running game logic
- Screenshot and movie mode handling happens after drawing, based on flags set somewhere earlier
- Sounds: S_UpdateSounds
- LUA GC: LUA_Step
- Runs a number of game logic tics depending on current time.
- If other code (like rendering) has taken too long, multiple tics can be run to compensate and keep the speed of the game consistent.
- pending console command execution
- netxcmd stuff
- Runs one tic of game logic.
- G_DoReborn (respawn)
- tickers for various game states (in level, intermission, cutscene etc.)
- in level:
- title card logic
- automap logic
- hud logic (not much)
- Input handling and some network functions.
- when game is running fast enough, it will get run inside TryRunTics?
- when game is running slowly, it will also get run in various other places scattered in the code
- not faster than 35 times in a second though
- LUAh_ViewpointSwitch (reset back to self when moving)
- other network stuff
- Handles game world.
- Runs player thinking.
- Runs all thinkers.
- Code for various other fixed game logic parts.
- Lua ThinkFrame.
- Runs functions specified in the thinkers.
- Multiple thinker lists for separate purposes.
- things that move or do stuff but are not mobjs or polyobjects
- dynamic slopes
- most precip logic is moved to rendering code with culling, but the current implementation still relies on some code running for every precip thinker
- Thinker function for all mobjs. Run for every mobj by P_RunThinkers, except for those with nothink.
- Various checks and switch statements for the different mobj types in the game.
- Mobj states and actions.
- Movement physics.
- XY movement
- Z movement
- Scenery gets a separate similar but somewhat simpler code path.