In 2019 I started my minor at Fontys with the focus on creating a game from start to finish. After finding out I’m not a game designer but a game developer(you know writing the code and stuff).
I started looking into Unity Dots, looking at the potential this could have in the future I started working on a project where I could clearly show the performance benefit Unity Dots workflow could have over the old school Unity Monobehaviour workflow.
What is Unity Dots
In short, Unity Ecs is a way of safely writing multi threaded code for massive performance gains, for more info check out the unity blog post here.
To be honest I’m a curious guy, I love diving head first into stuff I don’t know and trying to understand all the ins and outs of it. So that’s why I did this.
I started by creating a simple Unity project using the normal Monobehaviour and gameobjects workflow. By doing this I could have a baseline to compare the Unity Dots version of the project to, to see how much the performance would improve.
Result: About 4000 game objects in the scene all being scanned to check if they were within the players targeting cone at around 30-40 fps.
After setting a baseline with the Monobehaviour workflow I created a new project using Unity Dots, and using almost the same logic to calculate if an entity is inside the players targeting cone I started stress testing. And boy was I surprised… The stress test above was run on the same machine as the first, but this time using Unity Dots.
Result: 175.000 objects in the scene all being scanned to check if they were within the players targeting cone at around 20 fps.
Yes the fps was a lot lower, but there were around 44 times more objects in the scene. After some more testing I was satisfied with the result and moved on to some polish work.
I added some target reticles that would hover over the entities inside the players’ targeting cone. And remove the bulk of the entities from the stress test to make the project a bit more pleasant to work with.
After creating this tech demo of the targeting I had to finish the project somehow so I turned it into a small space shooter game. The goal was to create a new Naumachia with Unity Dots, but I lost motivation for the project halfway into creating the game part. So that didn’t happen, but if you would like to play this version. You can download it from itch.io here. I also made a small video of it if you don’t have time to play it.
Interested in the code?
Here is a link to my private git server where I keep my own projects