Forgot your password?
Or sign in with one of these services
in Doom General
Posted November 9, 2021
Thanks so much, that makes sense -- that's a pretty cool trick, do 1/3 of the work each frame. (For some reason I mis-remembered that Doom ran at 40hz, since it's actually 35hz that means movement only happens at less than 12hz!)
I have a follow-up question about the randomness you mentioned: I can't actually find where that happens, could you point me towards it?
In P_SpawnMobj I see this this code: mobj->lastlook = P_Random () % MAXPLAYERS;
That seems to be the only invocation of P_Random(); however AFAICT this won't introduce a delay (since P_LookForPlayers() will scan across all players checking if lastlook is valid (and updating it if not)). Or am I mistaken?
Sorry if this is a noob question, but I've been digging through the source trying to understand how things work, and I have a question about how monster movement is implemented: specifically, is it the true that monsters generally only actually move every 3 ticks?!
(If so I'm a bit shocked, since monster movement doesn't look as step-y and un-smooth as I would assume it should if they're actually only animating at ~13hz (40hz/3))
From what I can see, P_MobjThinker() moves things according to their momentum, and then triggers state changes/actions.
However, unless I'm mistaken, momentum is only used for missile movement, player movement, and to "shove" objects (ie moving things a bit when they take damage); regular locomotion of monsters through the world doesn't involve momx/momy.
Instead, the actual walking movement of a monster through the world seems to be driven by A_Chase (which uses P_TryWalk, which uses P_Move, which uses P_TryMove, which actually changes the x,y values of the object using the vector movedir*speed.)
But since, AFAICT, action functions are only triggered on the first tick of a given state, this means that monsters with A_Chase states every 3 ticks are stationary for 2/3 ticks... is that correct??
Anyway, sorry if this is a silly question, I'm just trying to figure out if I've misunderstood something or if movement really is only happening at 13hz.