Hmm, if you’re asking if it should be part of the physics module, I think fixed_update
should exist even if the engine is compiled without a physics engine. Someone might want to implement their own physics and fixed_update
is still useful in that scenario. (though concievably, one could implement the behaviour of fixed_update()
using update()
, it’s just more work and an extra thing to pay attention to)
As for non-physics related things, you can simulate so many non-physics things: Think Factorio, for example. Each of their tiles have particular behaviours they do each tick and ideally that shouldn’t be tied to the framerate. Or events and troop movements in a military simulation, etc…
Can these be done in a FPS-independent way using just update()
? Probably yes, by implementing a similar logic as you have and calling your tick more/less times per frame depending on dt.
Is it good to have a convenience function for this? Definitely and I will be switching some simulation code for our tower defence mini-game in GMAI to fixed_update()
if it gets implemented. Getting that timing behaviour right without stutters is not an easy task and I think it’s good if you give Defold users a “known good” implementation of it.
One place where fixed_update()
is really necessary and no other alternative exists, is when wanting to sync up with the built-in physics engine.