• Create Account

Banner advertising on our site currently available from just \$5!

### #ActualEctara

Posted 10 July 2013 - 09:11 PM

But will the game logic run at the same speed even when the frames drop?

Nope, it will pretty much never update at the same speed. However, this is not a bad thing, and is what is supposed to happen. This distinction may just be me being pedantic, though. A fast computer will execute the game loop in very little time, whereas a slow computer may take longer. However, the faster computer will execute the game loop more times, accumulating time until it is time to update the world. The slower computer will accumulate much more time between iterations, and perform more updates per iteration. Technically, the logic is done at different rates for each machine. The important part is that they each update the world proportionately to the amount of time that has passed in fixed time steps.

In summary:

Fast computer iterates through loop many times, slow computer iterates through loop few times.

Both of them update the world the same amount, by being based on time in discrete time steps.

For a very silly analogy, Alice and Bob are asked to get six eggs from the market, and return in one hour with exactly six eggs. Alice can make it to the market and back in 20 minutes, whereas Bob takes a full hour to go to the market and return. Alice, wanting to show off and be flashy, runs back and forth from point to point, taking two eggs in her basket at a time, and bringing them back. Bob takes his time, and grabs all six eggs, putting handfuls of two in his basket at a time, in one trip in order to make the deadline. After one hour, both return, and each are holding their six eggs.

Second, i'm not sure if this is based on my UPS calculations, or the game logic itself, but my UPS runs between 59.99xxx and 60.00xxx, where the xxx are any numbers, usually the same each time it switches. Is this really a huge problem, or can I ignore that?

The most likely cause is floating point imprecision, and can likely be safely ignored, depending on what you will use your UPS calculation to accomplish. You can likely get away with rounding or truncating for display purposes.

### #1Ectara

Posted 10 July 2013 - 09:09 PM

But will the game logic run at the same speed even when the frames drop?

Nope, it will pretty much never update at the same speed. However, this is not a bad thing, and is what is supposed to happen. This distinction may just be me being pedantic, though. A fast computer will execute the game loop in very little time, whereas a slow computer may take longer. However, the faster computer will execute the game loop more times, accumulating time until it is time to update the world. The slower computer will accumulate much more time between iterations, and perform more updates per iteration. Technically, the logic is done at different rates for each machine. The important part is that they each update the world proportionately to the amount of time that has passed in fixed time steps.

In summary:

Fast computer iterates through loop many times, slow computer iterates through loop few times.

Both of them update the world the same amount, by being based on time in discrete time steps.

For a very silly analogy, Alice and Bob are asked to get six eggs from the market, and return in one hour with exactly six eggs. Alice can make it to the market and back in 20 minutes, whereas Bob takes a full hour to go to the market and return. Alice, wanting to show off and be flashy, runs back and forth from point to point, taking two eggs in her basket at a time, and bringing them back. Bob takes his time, and grabs all six eggs, putting handfuls of two in his basket at a time, in one trip in order to make the deadline. After one hour, both return, and each are holding their six eggs.

PARTNERS