[Solved] Is there is an event to process logic for all instances in realtime, NOT one by one?


I have a bot that follows nodes in order. The event that process logic for other action the bot needs to do (like jumping, steering [this is a racing game]) in a [repeat for each object].

The problem

When multiple instances of bots exist, the repeat block mentioned earlier would process the logic for each kart, one by one, which results in some delay before bots do an action. This delay is unacceptable and too long for a racing game where fast response times are needed.

This delay causes multiple bots to fail, making the bots take longer to finish or, sometimes, not finishing the race and just fail continuously.

When there is one instance of the bot, the logic is processed for only one bot which causes no delays, making the bot seem ‘smarter’ and able to finish the race faster or with no fails.

GIF Showing problem

3 Bots Racing in the hardest track in-game


1 Bot Racing in the hardest track in-game


Possible solutions

  • Multithreading/Multiprocessing for repeat
  • A way that process logic for all karts in real time, not one by one.

Emulate this problem in game (Contains a link to the game :grimacing:)

This game is on GD games, you can try to emulate this problem by yourself if you ever wanted to.
If I’m correct, about repeat for action is processing one by one, a machine with better hardware shouldn’t have this problem.

We need to see some of the events. Maybe there’s something that’s causing interference, a variable or condition/action that’s using the wrong object or multiple objects.

What causes a car to explode or reset? Maybe the tolerance is too small. Maybe a mask needs to be modified or an object moved. Or a number range increased. If the event is too sensitive then any delay in checking could cause the vehicle to travel a little further before being checked.

Have you tried running the profiler to see if something is eating a lot of the resources?


I did not understand. I think you want to see the events for bots.
Below is the repeat for each instance loop that process logic:


  • When a bot is hidden, it will trigger the respawn system to spawn it at the latest checkpoint it passed.
  • Node[s] are the set of fixed points for the bot to follow. The bot follows nodes from 1 to infinity until it reaches a node with the object variable, finish, enabled.
  • Race started is self-explanatory
  • Above object variable is true if the bot is trying to jump
  • Tick is triggered ~20 (19.8) times a second
  • Tick system is used to maintain a stable, non frame dependent, acceleration

Nodes (orange dots) are placed like this:

If you want more detail, try experimenting with the level editor or just ask me.

Edit: Yes, I did profile it, bots aren’t consuming a lot (~2% of total).
I did rewrite the bot system before for performance reason.

I haven’t looked at all of it but trigger once with instances works on an object level not an instance. So, it might not work as expected. Try removing the trigger once and if needed replace it with an object Boolean or check for the tween or anything specific to that instance.

This could explain why it’s fine with 1 object but not multiple. For the trigger once to reset or be cleared, all of the objects would have to return to false before 1 could be set to true again.


1 Like

It worked.
I needed to change some things after removing the Trigger Once for it to work properly.
Thank you.

Also, why is your public profile hidden??

1 Like