Quote:
Originally Posted by Muzza
I'm using 256x256 bins (I have no idea how the original did it), and process the ones that overlap the camera (which is always either 2 or 4 bins). Currently I only spawn individual entities as they enter the screen area, but I think perhaps I should change this to spawn an entire bin, as sometimes enemies either group up or are divided more than in the original.
|
And you store entities that go out of view into the other 2-4 bins, right?
I assume T2 did not insert whole bins because it would often mean spikes of too many entities at ones. I guess they used a distance threshold within the bin (maybe something like 64 pixels).
A more simple yet fast method how to cull entities is to go through the inactive entity array, but only a few items each frame. For example your world has 256 entities, and you go through 16 entities each frame then you have all entities culled in 16 frames. However, i think T2 used bins.