How do I execute "For each" loop with a delay for each instance

0 favourites
  • 2 posts
From the Asset Store
For Adventure, Action, Heroes, Sci-fi and Action-RPG games.
  • Hi there!

    What i am doing is calling "for each" to get each intance of enemy synced in multiplayer built with Photon. As by now - following events are causing each object to sync within a single tick each 0.04 seconds , which causes a small lag (instant freeze at the moment of sync) when amount of objects is going higher than ~20.

    How can it be optimized so each instance will have it's own timer and they will not try to sync within the same milisecond.

    Thank you guys in advance! :)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Normally you do it like this:

    For each Sprite
    .. Wait loopindex*0.5
    .. // other actions
    

    But if you put this loop inside "Every 0.04s" event, it will cause havoc.

    I don't think syncing every 2-3 ticks is necessary. And if it is, you should choose a different method. Perhaps combining the properties of all bots into a single string and sending that string.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)