False event checks should terminate subsequent ones maybe?


Example one shows enemy AI events that puts noticeable stress one the system. But wait, example two is for another enemy that simply never existed during the test run. So all this events grouped under “hostile gunship behaviour” still run in the background and stress the system. I assumed that events condition checks simply terminate once one condition isn’t met, but that doesn’t seem to be the case. The system stress can be be fixed by doing things like in example three (I ran some more tests and it used 1.6ms at some point, still way less expensive than running the full event group all the time).

Example one could probably also be optimized by putting the easy, often false checks in a parent event and the expensive stuff in a sub.

I have no idea how complex this would be to implement, but I’d say that GDev games in general would improve in performance if event checks would terminate by default once one condition is false. Large, single scene games will have a lot of background event checks running, potentially for hundreds of game agents. The stressing checks shouldn’t be executed if the easy stuff isn’t met or the object doesn’t even exist. Optimization would then be as easy as putting the most often false checks first in the condition tab. Just a thought. :neutral_face: :slight_smile: