Comments (4)
while (lag >= MS_PER_UPDATE) /// ensures a certain time (MS_PER_UPDATE) has passed, and sleep isn't required
{
update();
lag -= MS_PER_UPDATE;
}
from game-programming-patterns.
I still don't quite get it. Here's an example with some numbers:
- MS_PER_UPDATE = 10
- update() takes 5
- render() takes 20
In the first cycle there's no update()
(lag = 0).
In the second cycle lag = 25
(5 + 20) so I see 2 calls to update()
in a row and there's no pause in between.
In the third cycle there will even be 3 calls (lag = 30
) with no break in between. How is this considered fixed time steps?
from game-programming-patterns.
since render is not called when catching up. The Displayed objects will work correctly.
its covered in.
https://gameprogrammingpatterns.com/game-loop.html
and more detail in here
https://gafferongames.com/post/fix_your_timestep/
from game-programming-patterns.
My problem was that all the statements and the diagram relate to game time, not real time. Not sure if this could be made more clear. I still find the diagram above misleading, though, because IMO this first diagram here does not relate to game time but real time:
from game-programming-patterns.
Related Issues (20)
- Decorator Pattern
- Kinda inexact definition in Commad chapter ("reify")
- Giving reference to the Evennia MUD server? HOT 3
- Outdated YT Link
- Subclass sandbox two-stage initialization
- Exposed type object - needs clarification?
- Bug in "Command" pattern HOT 2
- Overlapping Notes in State pattern chapter
- Intel vTune profiler is now freely available
- Typo, Command chapter. HOT 2
- Why would we use a pre-allocated pool of list nodes for the observers?
- Saving data with component pattern instead of inheritance.
- Delete beard joke
- GoF links broken
- Side comment in Chapter I.1 should be placed on the prior paragraph
- Type Object: Making type objects more like types: constructors HOT 1
- DirtyFlag optimization by avoiding remaking decision
- Subclass Sandbox Suggestion
- Incorrect statement in the Spatial Partition chapter HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from game-programming-patterns.