Scenes in Ethanon Engine are partitioned into several rectangular buckets, which allows many software optimizations to take place.
The default bucket size is 256 x 256
pixels, but this dimension may be customized. A bucket consist in a rectangular area that own all entities inside its boundaries. A bucket is identified by its coordinates on a 2D board that represents the scene, as illustrated by the image below:
The buckets are identified by their two-dimensional key. The bucket (1,1)
contains four barrels, the bucket (-1,0)
contains two pillars, etc.
Notice that the entities on buckets (-1,1)
and (0,0)
exceed their bucket boundaries, but they are owned by the bucket in which their origin is located.
The core engine automatically sorts all entities and places them into their respective bucket, so the programmer must not worry about managing it. However, the programmer may take advantage of this system to optimize his own code. For instance, if the game requires collision detection testing between a character and other scene elements, it is possible to retrieve an array containing only those buckets around the character, checking collision only against those buckets instead of the whole scene or other unnecessary entities.