Hello. I'm about to make a quick topic since it's over 6AM here but I'm testing my game and I want to optimize it however I can.
A premise: yes, I have read all the articles which talk about optimization.
The game I am making is a top-down puzzle game featuring a vacuum cleaner.
The game is mainly supported by these groups of objects:
- The player, which is followed by a trail made of particles
- the dust, which is made out of semi-small pink coins (the pink is tinted directly in the sprite).
- the room, which contains a good number of aesthetic objects.
Now, I have read how to optimize most of the features. For example, I have reduced many events and removed all the unnecessary "every tick". I was able to make the dust bigger to reduce the amount of it in the room. Deleted many redundant terms and unnecessary values like "wait for 0.000x seconds".
Overall I was satisfied of the result. Until checked the CPU Usage: Over 95%, while the GPU was just 7%.
Now, the CPU is holding all the calculations. It makes sense that it can't be less than 20%.
But 95%? I thought it was too high.
So I made a test, one of those that help you to find out "whodunnit", or which part of the game is stressing the CPU.
So I've started by removing event sheets.
Alright, I have found 2-3 event sheets that take a lot of calculation.
From 95 to 80% of CPU usage.
The room now only has two event sheets, one is used to seeing the percentage without going into debug mode.
Let's start deleting some assets.
Ok, by removing particles I get from 80% to 77%. The gpu dropped from 7% to 5%.
Let's remove all the tiled backgrounds. Not much happened.
Let's remove collisions and other invisible objects. No much happened.
Let's remove the dust: from 77% to 70%. Ok, I definitely need to look at how the dust works in-game.
Now, let's remove all the necessary objects to make the room functional: from 70% to 68%.
Lastly, let's remove all the assets: From 68% to 65%.
Now, thanks to this test I now know where to fix most of the features. But one question pervaded me: Isn't 65% a bit too much?
For a top-down, pixel art game like mine, generally speaking, what is the possible amount of cpu required? I mean, we are talking about a 2D game, not a CryEngine cinematic game.
I checked what, according to the debug tests, makes the game so heavy with the cpu.
The engine and the "draw calls" seem to be the cause of this number.
Considering I am testing a project directly from the editor... does it mean the "draw calls" shouldn't be this heavy after exporting the game due to the compression?
In any case, How else can I do to make the CPU usage as small as possible?
Thank you for reading!