Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tweak(gta-five-net): network synchronised scene id hacks #3149

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tens0rfl0w
Copy link
Contributor

Goal of this PR

The original game code assigns global IDs for synchronized network scenes by using the physical player index as a unique identifier. The ID space is padded to a maximum of 64 concurrent synchronized scenes (physicalIndex * 64). However, in our network implementation, the local player's physical index is always set to 128, leading to scene ID collisions when multiple machines trigger networked scenes simultaneously and also integer range overflows (13-bit = 8191 / 64 = 127 < 128).

How is this PR achieving the goal

  1. Expansion of Scene ID Serialization:

    • The local scene ID variable was already of type int32_t, but the serialization process previously limited scene IDs to 13 bits.
    • This patch expands the serialization logic to utilize the full 32-bit space for scene IDs.
  2. Replacement of Physical Player Index with Server ID:

    • Instead of using the physical player index (128 for all local players), we now use the player's server-id as an uniquifier.

This PR applies to the following area(s)

FiveM, Server

Successfully tested on

Game builds: 1, 1604, 2060, 2189, 2372, 2545, 2612, 2699, 2802, 2944, 3095, 3258, 3407

Platforms: Windows

Checklist

  • Code compiles and has been tested successfully.
  • Code explains itself well and/or is documented.
  • My commit message explains what the changes do and what they are for.
  • No extra compilation warnings are added by these changes.

Fixes issues

fixes #2910

@github-actions github-actions bot added the invalid Requires changes before it's considered valid and can be (re)triaged label Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid Requires changes before it's considered valid and can be (re)triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Network synchronized scenes will fail for remote clients with >2 clients present.
1 participant