feat(net/rdr3): extended object id manager
Goal of this PR
Introduces the "length hack" that was previously introduced in FiveM with https://github.com/citizenfx/fivem/commit/e1b1d58dcb3e9147f2b95daf4518ea16593c5631
This expands the amount of Object ID from 8000 in RedM to 65535. This gives servers more then enough object IDs especially with larger servers where having population enabled can exhaust all available Object IDs.
Something that should be noted. The change to citizen-server-impl will be removed and done as a second PR before this is merged. Currently its required in order to test the length hack on RedM servers. But cannot be pushed to server artifacts until after this changeset has been pushed to all redm client channels. Otherwise it introduces the potential for crashes and other weird behaviour.
Initial functionality based on Disquse's object id patch in engineering
How is this PR achieving the goal
Making use of the existing length hack logic in rlNetBuffer and citizen-server-state. This PR hooks several functions to do with serializing object ID's in order to remove the 8000 limit tied to object ID Mapping. This PR also adjusts several net events in order to remove object ID Mapping in onesync as its not needed and can cause problems with ids greater then 8000, while retaining non-onesync compatibility.
This PR applies to the following area(s)
RedM
Successfully tested on
Game builds: 1491
Platforms: Windows
Checklist
- [x] Code compiles and has been tested successfully.
- [x] Code explains itself well and/or is documented.
- [x] My commit message explains what the changes do and what they are for.
- [x] No extra compilation warnings are added by these changes.
Fixes issues
Really great job! Nice one.
constexpr bool canLengthHack =
#ifdef STATE_RDR3
true
#else
true
#endif
i think you should remove the ifdef entirely here
Really great job! Nice one.
constexpr bool canLengthHack = #ifdef STATE_RDR3 true #else true #endifi think you should remove the ifdef entirely here
that will be removed when the second pull request to enable length hack is done, once we get all the tests done.
Good job! I've pushed it to specific/feature/redm-length-hack. Should take effect in ~1 hour. You can also create a topic on forum in Experimental section using one of our topics as an example. Let me know when you need topic approval.
UPD: Deployed
thanks we will be testing this. another pr will come after to enable the length hack
For testing purposes I've merged #3376 into this branch as otherwise clients that load in after or during INIT_SESSION will have cached wrong max data sizes for synced vars. The block level loading patch will need to be merged before object manager can be when it is ready for review