Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
MathsDevil

Vanilla Engine Questions

Recommended Posts

Apologies if this already exists somewhere, however I find myself wondering things about the original Doom engine that don't seem to be answered on the Doom Wiki. 

Share this post


Link to post

My question is: if Barrel A explodes near enough to Barrel B that Barrel B explodes and nothing else has caused damage or interfered in any way, what is the time interval between the two explosions?

I have carried out a few experiments and it seems to vary on a pseudo-random basis but is close to 0.37 seconds. 

Is there another way to work this out? I am trying to design a puzzle based on the timing of chains of barrels exploding in which each barrel only detonates the next one, and so on.

Share this post


Link to post

The screenshot below is from WhackEd, a DEHACKED editor, showing the states that define animations and behavior of things in Doom.

 

gU11Oyu.png

 

Barrel death animation plays for 15 tics in total (the 3 highlighted states, each has duration 5 tics) before it causes an explosion by calling Explode in the very next state, upon which the explosion damages surrounding things immediately, and things (including other barrels) that take enough damage to be killed/destroyed will enter their death animations immediately.

 

Duration of the first state of the death animation is decreased by a random number between 0 and 3, inclusive. From P_KillMobj in Doom's source code:

 

    target->tics -= P_Random()&3;

    if (target->tics < 1)
	target->tics = 1;

 

Therefore the interval between barrel explosions varies between 12-15 tics on a pseudo-random basis. 1 tic = 1/35 of a second, so 12-15 tics correspond to roughly 0.34-0.42 of a second. Precisely, the interval is always either 12 tics ~= 0.34 seconds, 13 tics ~= 0.37 seconds, 14 tics ~= 0.4 seconds, or 15 tics ~= 0.42 seconds.

 

Edited by scifista42

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
×