
Optimizations in Colorless Odyssey
C-sharp Unity Shader graph
Context
In my game, Colorless Odyssey, I have a lot of interactions with the world, and I need it to be responsive and to support hundreds of objects on the screen.
So, I use different techniques to optimize the game:
- Pooling system for objects
- Update a group of objects at the same time instead of one by one
- The use of emissive textures instead of lights
Pooling system
The base of the pooling system is that when you need to have the instance of an object, you check if you can take it from a pool of disabled objects, and if not, you create a new one. Because creating and destroying objects are heavy operations, it’s better to reuse them by disabling and enabling them.
My projectiles, particles, trails and many more objects were created and destroyed a lot of times, and it was heavy for the game.
Group update
Within my system of particles and trails, I had a lot of objects to update. It was faster to update them all at the same time instead of one by one due to the overhead of the update function.
Emissive textures
I had a lot of lights in the game, and it was too heavy for the game, so I decided to use emissive textures instead of lights. Gradually, I replaced all the lights with emissive textures, and it was a lot better for the performance.