Both yes.
Design and implementation of the special data structure for the collision detection system is in progress.It's tentatively called a
"Buckets on Shelves Structure" ("BOSS" - pretty nifty abbreviation eh?) due to the way I came up with the idea.
This structure aids in a few very important areas of the engine, such as heavily reducing the amount of objects that need to be checked for bounding-box collisions, and also doubles as a very fast way to find the nearest object in any of the 4 basic directions (there may be a function that calculates the closest object based on distance, too).
Essentially each level is divided up into columns (or rows in vertical mode) of (16? - this number might change) pixels wide, and these are then cut into overlapping sections of (the default) 512 pixels high, resulting in a searchable grid that speeds up finding objects based on their position. Each section of the grid is a
bucket, and each row of sections is a
shelf, thus the name
Buckets on Shelves.
- DELTA_BOSS_ExampleDiagram.png (54.53 KiB) Viewed 199354 times
This structure also has some very unique properties that make it extremely fast to use on each frame...
Once the structure has been allocated, there is no longer a need to do any more allocation during the game. Through careful design, simply setting the root value of the
Bucket Allocation Table to 0 means that the entire structure has been invalidated and is ready for re-use. There is
no need to zero-clear or reset maintenance values because during use, the old values from the previous frame are always overwritten with the new incoming ones.
This in effect means that
I can rebuild the table each and every frame, and I don't need to worry about the objects on each shelf getting out of order and having to do manual sorting - none of that time wasting junk is needed here.