Citrus-Engine
Citrus-Engine copied to clipboard
Feature request: "persistent = true" ( Stops MediatorState from removing these objects automatically on state change )
So I want to push the idea of allowing Nape/Box2D to be created only once and not have to be recreated every state change for performance reasons(Adobe Scout agrees with me, this is rather personal but, read below for a solution that could benefit all CE users).
Since the 'physics' (Box2d/Nape) is a CitrusObject, instead of the above request, why not make a persistent:Boolean = false by default in the CitrusObject class. Then the MediatorState will need modifying, to check if 'persistent' is set to 'true', if it is, ignore this object from being deleted when changing state. (To remove a 'persistent' object manually, maybe that "_ce.state.removeImmediately(
I got this 'persistent' idea from back in my GameMaker days where an object could exist through as many 'room' changes as you wanted. The great thing is, I understand not everyone will need 'persistent' physics, because their 'next' state may not contain physics objects, simply NOT writing 'persistent = true' on any of your CitrusObjects and it's good for both worlds.
Hey, that's a really interesting idea concerning physics engine. For Hero it may be useful too!
It seems to be simple to prevent removing an object from a state. However dealing with its view sound very complicated with the current engine architecture.