Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
A jam submission

DOTS Chalange #1 - Game of LifeView project page

Submitted by micz (@micz84) — 2 days, 18 hours before the deadline
Add to collection

Play project

DOTS Chalange #1 - Game of Life's itch.io page

Git Repository
https://github.com/micz84/GameOfLife-DOTS-Chalange

Performance Strategy
My take on Game of Life in DOTS. I have decided to use ECS only to represent cells. The simulation uses native arrays. My simulation is without boundaries, which means cells at the left edge are neighbours of cells at the right edge, and the same for the top and the bottom. This way I avoid the if statement to check for edges. There is also a way to avoid that without this approach an example of that can be found in my other implementation of Game of Life (https://github.com/micz84/GameOfLife). I store indices of neighbours in int4x2. The state is stored as a byte, this way I can just add the value of the state to test for a number of active neighbour cells.

Test Machine:

CPU: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz 4.01 GHz
RAM: 48,0 GB​​ 2.6 GH DDR4
GPU: GTX 1070 8 GB
Performance test results:

85-90 FPS when simulating and displaying 512x512 cells
68-72 FPS when simulating 1024x1024 cells but displaying 512x512
20 FPS when simulating and displaying 1024x1024​
50 FPS when simulating 2048x2048 and displaying 8x8​
13 FPS when simulating 4096x4096 and displaying 8x8 - 512x5​12
9 FPS when simulating 4096x4096 and displaying 1024x1024​
4 FPS when simulating 4096x4096 and displaying 2048x2048
3 FPS when simulating 8192x8192 and displaying 1024x1024​

From this data, we can see that the display may be a big limiting factor for performance, but also we can see some amount of parallelism between simulation and rendering. When simulating 8192x8192 there was almost no difference between displaying 8x8 and 512x512 it took about 340 ms.


EDIT#1:
I have also tried not to cache neighbours' indices but to calculate them in the simulation step. It was about 3 times slower but used much less memory. For 8192x8192 it was 2522 MB vs 316 MB. Maybe if I have time I will try to improve the performance of this approach.
EDIT#2.
I have done some optimisation and now it is "only" 60% slower but uses only 12% of the memory used by the more performant solution. It can be found in performance-experiments branch.
EDIT#3
I almost had a solution that was performant and not memory heavy but it was not working for grids with sizes more then 4k so I had to revert to old solution. It was using bitwise AND operation instead of modulo.

Leave a comment

Log in with itch.io to leave a comment.

Comments

No one has posted a comment yet