A downloadable game

Git Repository


Simulation

The approach for implementing Conway's Game of Life using Unity DOTS was to rely on Native Arrays and the Job System.

The grid singleton owns two native arrays of integers. One to be read by other systems and one acting as a cache to be able to read and write at the same time during simulation.

During a simulation tick, a IJobFor reads cells from the cache and update the main native array. The new state is then cached for the next tick.


Rendering

Rendering was the main performance concern for the simulation.

Two tests have been made for it.

The first method (instance renderer) is using the Graphics.RenderMeshInstanced method to render a quad for each cell. Matrices are pre-computed at start and colors computed each tick from the cells native array.

The second method (texture renderer) is using a texture that get updated each tick from the cells native array. This was the most performant method and thus used in the build and for the performance tests.


Blueprint System

One of the goal was to allow the user to print blueprints (pre-made set of cells). It was done by mapping the mouse input on the grid and queuing blueprint events in a dynamic buffer. This allows to pause the simulation and print several blueprints before starting it again.

The blueprint events are then processed between the simulation and the cache job.

Blueprints events and the Blueprint Controller are also read by the Color System to be able to display current blueprint (red) and queued blueprint events (yellow).


Results

  • 60 FPS - 1140x1140 cells
  • 30 FPS - 1600x1600 cells

Hardware

  • NVIDIA GeForce RTX 2070
  • 3.60GHz Intel Core i7-9700K (8 cores)
  • 32GB Ram

Download

Download
DOTS-GameOfLife.zip 30 MB

Leave a comment

Log in with itch.io to leave a comment.