nadako / Ash-Haxe

Port of Ash entity framework to Haxe
Other
131 stars 37 forks source link

Limiting Frame Ticks #30

Open ashes999 opened 8 years ago

ashes999 commented 8 years ago

In the frame tick provider, on this line, it basically caps the tick time if it's more than the maximum.

Instead of doing this, because of the way euler integration works, wouldn't it make more sense to write something like:

while (frameTime > maximumFrameTime) { 
     signal.dispatch(frameTime * timeAdjustment);
     frameTime -= maximumFrameTime;
}

This would allow someone to pick a low maximum time (eg. I know I have fast-moving bullets and collision problems, so I pick something like 20ms) and get consistent gameplay.

Does that make sense?

T1mL3arn commented 8 years ago

You can write your own TickProvider. But I suppose you does not need that smart calculation for all systems - it is need only for physics. So you could do your "while" calculation only for specific systems.