Does GDevelop read all conditions?

If I have multiple conditions in a single event and the first one is definitely false, are the other conditions still checked?

For example, I have six conditions here that I can’t nest, but I want to optimize the code as much as possible.

Hopefully, someone from within GD will respond with the hard facts.

In the past, I have tested conditions using my own condition. Under most situations, the conditions do not get executed or processed if the previous condition isn’t met.

I have read people who claim that all of the objects for each condition in an event are either checked or some sort of processing. IDK if this part is true. This could be tested with the profiler by putting conditions in subevents instead of all in 1 event.

I do know that if you use an OR condition then all of the conditions inside it are evaluated even if the 1st is true. That can lead to unexpected results and sometimes you need to add more conditions like pick all objects to compensate for it. It can lead to some objects not being available because their condition was false e en though another condition was true.

Hello, and thanks for your response. I would really love to know these details about GDevelop—having certainty about how it works could lead to significant improvements in game optimization.

This official tutorial seems to confirm the idea that GDevelop does not check the second condition in a stack if the first one is not met (clearly, this does not apply to the “or” condition, where multiple conditions need to be checked regardless of whether they are true or false).

(0:20)

  • All events are evaluated from the top of the event sheet down.
  • Each event is evaluated conditions-first, from the first condition down. If a false is evaluated on any condition within the event, no other conditions are read. (There are exceptions to this with “OR” statements because it’ll evaluate everything in the OR statement before considering it false)
  • If all conditions are true, each action is evaluated from the top down.
  • Subevents follow the same rules as above, but only if their parent event has the conditions evaluate true.
3 Likes

You’re very welcome! With this, I can optimize my game a lot!