Home Game Development physics – Explaination of Extrapolation from Game Programming Patterns

physics – Explaination of Extrapolation from Game Programming Patterns

0
physics – Explaination of Extrapolation from Game Programming Patterns

[ad_1]

I’m in search of assist as a result of there may be one factor from the sport loop which I do not clearly perceive.

I’m not directly of doing implementation of my very own 2D sport engine primarily based on e-book „Build Your Own 2D Game Engine and Create Great Web Games” 2nd Edition, and after the sport loop there are some sources about doing extrapolation. I’ve dug some and I do know precise each mathematic and implementation-based particulars of those two (interpolation and extrapolation), however I do not perceive that time from Game Programming Patterns – Game Loop – Stuck within the Middle:

The renderer is aware of every sport object and its present velocity. Say that bullet is 20 pixels from the left facet of the display screen and is shifting proper 400 pixels per body. If we’re midway between frames, then we’ll find yourself passing 0.5 to render(). So it attracts the bullet half a body forward, at 220 pixels. Ta-da, easy movement.

From that quote, I perceive that my render() operate should parse that lagTime / millisecondsPerUpdate (which tells us how a lot time left we have now to the subsequent body) as a parameter.

But what then? What do I have to do inside render( lag/ms_per_update parameter ) technique, to be able to use that lag/ms_per_update parameter? How might I even inform the renderer that he should render it after precise lag/ms_per_update worth to make sure that it can render worth X on the fitting body? There are some issues inside render() that I’m lacking or I merely do not perceive.

Did you ever applied extrapolation or perhaps you do know this e-book (Game Programming Patterns) and will you please assist me perceive what I’ve to do within the render() operate to be able to correctly use that lag/ms_per_update parameter to render values at correct frames?

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here