When to start optimizing for Godot?

Godot Version

4.3

Question

I would like to ask experienced people on this topic:

From xkcd: Optimization

So we could just carry on and get the game out asap to test things out. Disregard all the optimization first.

But then, this question comes to my head: so for Godot, when should we start optimizing and when can we consider that at this moment in time, it is no longer a “premature optimization”?

In my experience, optimizing early is not a waste of time, especially if it reduces the iteration time of the team working on the project.
So I would say “as soon as it becomes a frustration for someone”

4 Likes

So you seem to be in the prototype stage of your game. Seeing if the mechanics are fun, seeing what graphics work, finding out how you can achieve your goals etc.

During prototyping optimisation is nearly always a waste of time. Unless you are prototyping with thousands of elements and your framerate drops so low you can no longer play it. However this is an exceptional circumstance.

When you start your production build, you have to build with optimisation in mind. This is when you should be watching your framerates, your delta times, your object counts, your screen layouts at different sizes etc etc.

3 Likes

you have to get a working game first. once you have something working you can start worrying about performance.
and what to optimize is more important.
the order of things to optimize is:
1 - physics
2 - graphics
3 - code

physics is the most demanding and there are good practices that can be followed early, like keeping things in different physics layers or the structure of the nodes. these are explained in the docs.
graphics depends on how much graphics quality is in your game. there’s not that much to do from the level of the godot editor, other than maybe shaders. there are also good practices to follow like level design, texture sizes, polygon count, etc. these can be calculated easily and depend on the target platform.
finally code. code doesn’t matter. it’s 2024, it didn’t matter 10 years ago and it doesn’t matter now. unless you write a complex recursive algorithm or use thousands of repeating if/else statements, and even then it still wouldn’t matter that much.
I’ve written brute-force, Astar pathfinding and similar algorithms in gdscript.

the most important part of writing code is writing code that is encapsulated, because then you can extend and improve the different parts of the program separately. this is important for bug-fixing, adding features and optimizations.

you must also iterate, make prototypes, see if the idea works and what are the weak points or the things that could cause problems in the future, and once you have working code you can move that to a more finalized project, and THEN you improve the code and optimize.

3 Likes

The only time I need optimization, is when it already is not fast enough. If it’s working fast enough and not too bad of bugs, then optimization is unnecessarily.

Write the code, it works, move on.

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.