**This is an old revision of the document!**

This page is a draft for good rule to apply for optimize a game.
This is a draft in progress @Bouh

Game optimization is an important concept of making a game. Good optimization will allow the game to work faster, making it more fluid.

GDevelop 5 gives you total freedom in events. While this can be awesome, it can also be very costly for the processor when running the game.

It is important to understand what events are and that all events are each called once per second.

For example: With a game at 60 frames per second (FPS), if you have a single action, then in this action will be executed 60 times in a second.

Optimization in the engine

The GDevelop engine does one simple thing for optimization, it tells the graphic api to not render the object not in viewport.

This doesn't affect the person creating the game because it's handled in the background.

It can still be important to hide or disable what you don't need. This is the key of the optimization.

Trigger once

The Tigger once condition causes event actions to only run once each time the conditions have been met.

Let's take an example where we want to create an object every time the mouse button is clicked. This will show you the wrong way and the right way to do it.

  • What should happen : When the mouse left button is pressed, an object is created called MyObject.
  • What actually happens : When the mouse left button is pressed, multiple objects called MyObject are created.

This occurs because when the mouse button is pressed, it is likely held down for longer than a single frame like 0.3 seconds. During this period of time the event is called multiple times, and the object is created more than once.

For fix that we need add the condition Trigger once in the condition.


There is multiple behaviors, Pathfinding and Physic Engine 2.0 are the biggest consumers of power.

Delete the object unused

Let's take the example where I have a gun and I create one bullet when i do fire. This bullet have a force toward a direction. If you shot very often bullets will increase in number on scene and each have a physic. If you didn't manage the bullets you will get some lag during the game. The good solution is to delete the bullets if there is off screen.

An behavior exist “Destroy when outside of the screen” attach it on the bullet object. All bullets moving offscreen will be deleted.

Disable the object unused

Behaviors can be disable. This is perfect when you didn't need to affect the instance out of the screen.

Let's take the example where I want 100 enemies to move to a position each 2 seconds close to their taking into account the obstacles (For simulate guardian rounds with random paths).

Bad way is to move the enemies like this : If you do only this all objects will move, but maybe you don't need the objects are not in viewport.

Why calculate something what we didn't see?

Instead you can move only the object visible (in viewport), there is a simple way:

  • Disable the behavior Pathfinding of the objects not in viewport once time.
  • And do the invert event, when the objects are in viewport, enable the behavior once time.