In the previous game engine I was using, I got the habit to put all “every frame actions” on the same event.
Do I get a better performance in GDevelop doing this?
Or there is no problem at all in making a lot of “empty” conditions in GDevelop?
The difference should be minimal. It will be a bit worse if you separate actions related to the same object in multiple events, i.e. if instead:
Conditions: No conditions
Actions: Do = 5 to the X position of Player
Do = 10 to the Y position of Player
You do:
[code]Conditions: No conditions
Actions: Do = 5 to the X position of Player
Conditions: No conditions
Actions: Do = 10 to the Y position of Player[/code]
GD will recreate the Player objects list twice, worse performance for sure but barely noticeable on a small scale… I think
EDIT: Just made a test, added 247 instances of the same object on the scene, and used three approaches:
Added a single event like this:
Conditions: No conditions
Actions: Do = 5 to the X position of Object
Do = 5 to the Y position of Object
Do = 5 to the X position of Object
Do = 5 to the Y position of Object
...x200
In total there is a single event with 200 actions, the total events time is ~0.93 ms per frame (4.7 % of the total time)
Then I did it:
[code]Conditions: No conditions
Actions: Do = 5 to the X position of Object
Do = 5 to the Y position of Object
Conditions: No conditions
Actions: Do = 5 to the X position of Object
Do = 5 to the Y position of Object
…x100[/code]
In total there are 100 events with two actions each, the total time is ~1.2 ms per frame (6.1 % of the total time)
Finally I did it:
[code]Conditions: No conditions
Actions: Do = 5 to the X position of Object
Conditions: No conditions
Actions: Do = 5 to the Y position of Object
Conditions: No conditions
Actions: Do = 5 to the X position of Object
Conditions: No conditions
Actions: Do = 5 to the Y position of Object
…x200[/code]
In total there are 200 events with a single action each, the total time is ~1.4 ms per frame (7.3 % of the total time)
The thing is that 200 events (using the same object) is a lot for some people but it could be something common for others…
Thak you very much for your answer Lizard-13 !