Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Old-Doomguy

Does a demo file contain all rng rolls?

Recommended Posts

Hey all 

 

Since doom demos isn't a video but rather a keylog, I was wondering how they replicate a session fully. Doom is full of rng, are all these rolls saved in the file as well?

Share this post


Link to post

yep, pretty much. but iirc (and i may be wrong about this) it leaves some out tho cuz they're not necessary, and are done by the viewer instead

Share this post


Link to post

Anyone feel free to correct me if I'm wrong, but as I understand it Doom's RNG is an array of numbers that is always in the same order upon startup. If you replicate the exact same actions in the same environment, you will get the same results each time. So the demo doesn't need to track this stuff.

Share this post


Link to post
1 minute ago, DisgruntledPorcupine said:

Anyone feel free to correct me if I'm wrong, but as I understand it Doom's RNG is an array of numbers that is always in the same order upon startup. If you replicate the exact same actions in the same environment, you will get the same results each time. So the demo doesn't need to track this stuff.

actually this is probably the correct answer, listen to this guy instead

Share this post


Link to post

Yes, vanilla doom is a static array of numbers that is always the same. The “dice roll” is just the next number in the array. 

Share this post


Link to post
1 hour ago, DisgruntledPorcupine said:

Anyone feel free to correct me if I'm wrong, but as I understand it Doom's RNG is an array of numbers that is always in the same order upon startup. If you replicate the exact same actions in the same environment, you will get the same results each time. So the demo doesn't need to track this stuff.

 

This is correct. And no RNG data is stored in the demos themselves; all games start with the RNG at 0. To quote from the wiki, "The function M_ClearRandom resets both functions' indexes to zero. It is called during initialization of each new game so that demos will be the same each time they are played, and so that multiplayer games are synchronised."

Share this post


Link to post

Basically for rng that affects gameplay (I think it's different for some visual things like doomguy looking left and right) there is a list of all rng values that is in what is supposed to be a random order. Any time something needs an rng value it gets the current number from the list and then moves the number to the next value  for the next thing that needs rng. So if you do the same inputs at the exact same time under the same conditions, 100% of the time it will call the same rng number and do the same thing. This is how demos work consistently as long as your using the same settings on your source port.

So the demo file only needs the inputs (and probably some other miscellaneous information that has to do with the starting state) and doesn't need to include the rng values.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×