Open parkm opened 10 years ago
I'm interested as to how much of an increase in performance this would yield.
Do particles really even need to be an object? Should we classify menu/upgrade/etc buttons as objects? If yes on either, then I think BasicObjects should be a thing.
Particles need to belong to a state and update. That basically meets the requirements of a BasicObject. Particles also do use images but since it's one image it doesn't really need to have the display object property syncing stuff. And currently I believe Particles are still GameObjects.
Since we'll probably be pausing the game when menus are around we'll just make them GameObjects so they can take advantage of the display property syncing. I'm going to look into extending Pixi display objects so things like NineSlice will be a DisplayObject rather than a GameObject.
But yes this could improve performance quite a bit. Imagine looping over only bubbles and pins for collisions (since they are the only things that register collisions) instead of also looping over 1000 particles, and other rendering stuff. But this won't be much of a problem if we don't have too many objects.
So I'm going to leave this up if we need to find some more performance later on. It shouldn't change that much so we should be able to implement it whenever.
Has this been fully implemented?
Haven't done anything with this yet.
Oh okay. I thought you might've since you created the BasicObject class
Yeah this is about the State.objects
which has both GameObjects and BasicObjects. So until collisions start becoming a performance problem I'll hold off on this. But the fire element may start affecting performance since each bubble on fire checks for collisions. This should be able to be implemented whenever though since we have wrappers for object adding/removing.
Okay, sounds good.
If we separate BasicObjects from GameObjects this could potentially improve performance depending on what we're doing. For example with our current collision code it goes through all objects.
Particles are an object so it would go through them as well. If there were to be thousands of particles this could impact performance. So we should try to only loop through what we need.
So if there's any intensive stuff that just needs GameObjects, it might be worth separating the two if performance increase is necessary.