DOTS Spatial Partition

This is not a particle system.

This project implements the Spatial Partition optimization pattern, with the goal of an actor only having to search its neighbors to find the closest person to it, instead of checking all actors in the scene. This is accomplished through a voxel grid and doubly-linked list.

This project is based on the tutorial by Erik Nordeus's Game Programming Patterns in Unity with C# Spatial Partition, which implemented a 2D spatial partition.

This was expanded upon by complete reinterpretation of the project in Unity’s Data Oriented Technology Stack framework. This greatly improves performance by multi-threading movement, spatial partition changes, and material changes with the Job System. Much of the code is also compiled through Burst and everything in the scene uses DOTS’s Entities system.

This production includes simpler additions, such as adding 3D support to the voxel array and having the enemies move inside a sphere.

 

N.B. Updating code to my current standards, as it’s quite lacking comparatively. For example of current standards, see this script.

Live example of the project, clicking in allows user to view other sides of the system.

Previous
Previous

Game Architecture: State Machine