Hi folks!
I currently have a system that demands a grid of entities with only graphics and a pixelmask. Right now, without any optimization, FP can handle roughly 75x75 entities without dropping below 30fps. It starts to drop with 100x100 and going up only slows it down more on my PC (AIR application by the way, not web).
I have tinkered with onCamera()
and turning off super.render()
, active
and collidable
in the entities, but there doesn’t seem to be much of a performance boost. This leads me to believe it’s the overhead of managing these entities performed by the World that is doing the most harm.
So I see two options:
-
Remove and re-add the entities as they come on and off screen. This would require running through an array of entities and adding the ones near camera bounds, and removing those that aren’t. Would need to run every frame.
-
Tinker with overriding the World update function. I’m kind of clueless here, it looks like it does the same kind of thing (maintaining an array of entities) but the functions to add and remove are private (probably with good reason). What would be done is stop updating the entities off camera entirely, but not have to remove them or add them again.
I am unsure how much overhead adding/removing a bunch of entities would add, if it would even be faster. Does anyone have any experience with a situation like this and could offer some suggestions?