Skip to content

Multiplayer: PlayerPing() never updates on non-host clients #8530

@IDemixI

Description

@IDemixI

Is there an existing issue for this?

Describe the bug

Multiplayer::PlayerPing() returns correct values on the host but never updates on non-host clients. The host computes ping via heartbeat RTT and includes updated playersInfo in heartbeats sent to peers, but the non-host handler in messageManager.ts (around line 2042-2112) reads messageData.playersInfo for join/leave detection only - it never writes the received ping values into the local _playersInfo store. The initial ping value from connection setup is returned forever.

TLDR: Non-host players will see the same ping for themselves and others indefinitely after the initial heartbeat.


Suggested fix

In the non-host heartbeat handler (~line 2042-2112), after processing joins/leaves but before return, add something like:

// Update local playersInfo with latest ping data from host
for (const playerNumber in messageData.playersInfo) {
  _playersInfo[playerNumber] = messageData.playersInfo[playerNumber];
}

I'm happy to raise a PR for this myself if nobody has the time but agrees with the fix.

Cheers!
Ryan

Steps to reproduce

  1. Create a multiplayer game with PlayerPing() displayed for all players
  2. Host the game and have another player/client join
  3. On host: ping values for all players update continuously
  4. On non-host: ping values load once and never change.

GDevelop platform

Desktop

GDevelop version

5.6.266

Platform info

Details

OS (e.g. Windows, Linux, macOS, Android, iOS)

macOS

OS Version (e.g. Windows 10, macOS 10.15)

Version 26.4.1 (25E253)

Browser(For Web) (e.g. Chrome, Firefox, Safari)

Chrome

Device(For Mobile) (e.g. iPhone 12, Samsung Galaxy S21)

Galaxy S21 Ultra

Additional context

The fix appears to be adding a copy of messageData.playersInfo into the local _playersInfo in the non-host branch of handleHeartbeatsReceived.

Reference: Extensions/Multiplayer/messageManager.ts, non-host heartbeat handler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions