Multiplayer - real-time game Example (Lag/Delay)

  • Why is there a noticeable delay on the client side when testing the game with 2 browser windows in the same PC? This can be seen when i aim and shoot at the host; the "PeerName" Text Object which contains the Health among other info takes a while to get updated on the client side, enough to be quite noticed (around 0.3 seconds, i'd say)

    This feels even worst if you decide to spawn a projectile with Bullet Behavior instead of the "instant hit where you aim at" mechanic made in this example.

    Why am i not getting a near zero lag/delay experience playing the game like this?

  • The bandwidth profile of the Multiplayer object is set to internet by default, which means it does not send updates as frequently as you are expecting, even though you are on the local PC.

    Try using the Set bandwidth profile action ... to LAN. Keep in mind that if your game is intended for online internet play, you will need go back to Internet profile for that.

  • There is no difference

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Lag is unavoidable. I think the reason you may see it locally is that the framework will run at similar update speeds when operating across a LAN or on the internet.

    I am not sure what other suggestions might help you, but I can relate a similar issue I faced when there was too much lag while firing a projectile.

    I found that sending a message to the server to "fire" instead of relying on input bits works out a bit faster. I am not sure if that will hold up on the internet, but at least locally it does. On client I send "fire" message, on server I use on "fire" event, find the player with the Multiplayer.FromId, and fire from that players location (additionally I do some validation that the player is able to actually fire at that time).

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