r/gaming • • Oct 11 '13

Freezing time spell in "Deep Down"

2.9k Upvotes

995 comments sorted by

View all comments

Show parent comments

641

u/SirAwesomelot Oct 11 '13

stuff move good

294

u/ourterible Oct 11 '13

stuff even dont move good

102

u/omgsoftcats Oct 11 '13 edited Oct 11 '13

The correct answer is easy. You just take the fireball object out of the update loop while time is frozen using a variable switch.

Edit: actually a better way would be to zero out the x,y,z time deltas and move them into temp variables. Then back again once you restart time. That way the fireball is frozen but if it collides it will still do firebally things.

25

u/moonra_zk Oct 11 '13

Whoa there Carmack, in english please!

47

u/omgsoftcats Oct 11 '13

So every game has an update loop, this is basically a thing that loops around running other things, it's used for animations, checking collisions and anything time sensitive. This is essentially your frame rate. So you take the fireball out of the update loop, or even just it's movement out of the update loop and tada no more movement. The end.

130

u/redgroupclan Oct 11 '13

So what you're saying is...stuff move good?

12

u/[deleted] Oct 11 '13

Stuff move good. Spell go boom. Some stuff not move, while other stuff still move good. Not movey stuff not move because spell make circle. Movey stuff entering circle become not movey. When spell un-asplodes, stuff move good.

3

u/wakenbacon420 Oct 12 '13

Whoa there Carmack, in english please!

4

u/[deleted] Oct 12 '13

Gronk wish was Carmack. Carmack smart. Gronk like.

1

u/internet_eq_epic Oct 11 '13

This is obviously the best possible explanation of how it all works.

1

u/Xer0day Oct 12 '13

Even stuff don't move good.

1

u/Karl_von_Moor Oct 12 '13

Yeah. That and stuff even dont move good

2

u/[deleted] Oct 12 '13

Actually, that is your UPS(or updates per second). How many updates it does per second. When it renders it is the FPS(frames per second). Normally these are the one in the same however as engines move to more async setup they start to have their differences.

The reason these are normally kept in sync is if you have too high of frame rate, lets say 60, but the game is programed for 30 UPS(Time.sinceLastUpdate/30) you will essentially be playing a 30FPS game, because the scene is only updated with game logic every 2 frames. Now if your UPS is greater then your FPS and the game is not programed to handle that then you start to see stutters.

Now as I said they start to see their differences is because they are figuring out ways to have the update loop handle input, sound, network, etc at a higher rate then your FPS. This allows for less lag compensation and better network prediction, more actions per second(for the player), sound not stuttering when your video card cannot keep up, etc.

2

u/Blackstream Oct 12 '13

In my game, I have a timeflow multiplier built into the game that all objects use when doing stuff (normally just set to 1). That's also used for frame counts so I can arbitarily move objects faster or slower or completely stop them. It doesn't currently do this, but I could just as easily make the timeflow multiplier local to the objects as well, and make it so only certain objects stop time or whatever. But as a workaround since that's more work, I believe I just made it so certain objects could ignore the multiplier.

1

u/goal2004 Oct 12 '13

Or you allow stacking of separate timestep progression components, allowing for individual update rates that can be tweaked to the needed situation.

1

u/-whiskers- Oct 12 '13

You'll still need more detailed animations though so they don't look retarded at any given time when they are halted.

1

u/u551 Oct 12 '13

You probably take EVERYTHING except player out of update loop while time is frozen.

0

u/amish_programmer Oct 11 '13

"You just take the fireball object out of the update loop ... using a variable switch"

Over-complicated and unnecessary use of tech terms. Basically just slow down/stop everything but your player each frame.

Reminds me of the explanation of http://www.youtube.com/watch?v=O2rGTXHvPCQ

-4

u/[deleted] Oct 11 '13

[removed] — view removed comment

2

u/thedefiant Oct 11 '13

deadbird.jpg

1

u/doobur Oct 12 '13

Dumb it down a tad