Conway's Game of Life
A downloadable game
Conway's Game of Life for Unity DOTS Community Challenge #1
This implementation works by creating an entity for each cell. cells have current alive/dead value and index that represents position in array to read/write data from/to. On cell creation I precalculate all 8 neighbors indexes and store those in dynamicBuffer. Cells are displayed using raw image and texture2d. Here is : https://blog.unity.com/engine-platform/accessing-texture-data-efficiently nice article about efficient ways of accessing texture data.
Main update loop:
- IJobEntity to write current state of cell to nativeArray
- IJobEntity to read data of neighbors from nativeArray and determine cell state
- IJobEntity to write data to texture2D
Currently the second step takes the majority of the frame budget.
I also added the option to manually toggle cells on and off.
Results on my machine (i5-9400F, 16GB ram, 4070)
2048 cells ~50fps
4096 cells ~12fps
Leave a comment
Log in with itch.io to leave a comment.