tzachshabtay / MonoAGS

AGS (Adventure Game Studio) reimagined in Mono
https://tzachshabtay.github.io/MonoAGS/
Artistic License 2.0
27 stars 8 forks source link

Frame-rate independence #192

Open tzachshabtay opened 6 years ago

tzachshabtay commented 6 years ago

Make sure walk speed, animation speed, tween speed and mouse cursor speed are frame-rate independent. Expose some mechanism to allow frame-rate independence in externally written components.

See: https://www.scirra.com/tutorials/67/delta-time-and-framerate-independence And: https://www.scirra.com/blog/ashley/17/using-lerp-with-delta-time

ghost commented 6 years ago

I have a question: are you going to feature virtual time in your engine, or only use system time always? I was thinking that with virtual time it would be possible to change overall game's speed.

(On other hand, the next question is clearly about whether to apply this virtual time to everything, or only some objects, e.g. except GUI)

tzachshabtay commented 6 years ago

Yes, I want to have a virtual time (like the time scaling mentioned in the first post I linked to). I haven't considered only making it applicable to some objects, but it makes sense. I'll probably allow disabling it on a per-entity basis (like I'm already doing in other places in the code, for example: https://github.com/tzachshabtay/MonoAGS/blob/43a4f01e77a5c08f58d439a594aaf1594bd95f0d/Source/AGS.API/UI/Controls/Panel/ICropChildrenComponent.cs#L29).

ghost commented 6 years ago

May I propose a concept of "entity family" (made that name up), which would make appliance of virtual time simplier? Although I do not know engine well enough yet to see how easy it may be to separate entities into such groups.

tzachshabtay commented 6 years ago

Maybe? Or maybe we can use the layers for this (https://github.com/tzachshabtay/MonoAGS/blob/eab4b4b5ce7819e3fd19ebdfd606c0d298dd5f7c/Source/Engine/AGS.Engine/Graphics/Layers/AGSLayers.cs#L18), as they already group entities. Not sure we need another construct for this.