Skip to content

Porting Spatial Hash #6

@Cleptomania

Description

@Cleptomania

Some of the first work that been completed in this project is improving collision detection performance. This has largely so far been centered around hitboxes and direct brute force polygonal collision detection. While there are still improvements to be made to that system, another desire for collision detection is to see if we can improve the spatial hashing system in Arcade.

Spatial Hashing is a technique by which objects are placed into a sort of "grid" of cells, and when performing collision checks, we need only check items which are in the cells that could possibly collide with an object in a given cell. This significantly reduces the amount of brute force collision checks which are needed, and means the algorithm can in practice support a nearly infinite number of objects.

The downside to this system, is that moving or inserting new objects has a significant cost, making it in most scenarios not suitable for objects which might move, so it is only generally used for things like walls. If by porting this system to Rust we can significantly reduce the cost of this operation, then it may open this algorithm up to be a viable path for many more scenarios.

In terms of the actual implementation of this, this may require starting to port some of SpriteList, but I am unsure to what extent or even if at all that will need done, there is a non-zero amount of coupling between SpriteList and SpatialHash in the pure python version, and having to back and forth between Rust and Python for that could cause a scenario where we don't get any improvement or even make it worse. This will need more investigation and probably won't fully be determined until we get some kind of initial implementation built out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions