[Bug] Inconsistent tattoo sync and visibility
Some tattoos are not syncing to other players, even though they are loaded and streamed correctly. This happens only with some tattoos, and the ones that are not visible depend on the server build. The problem does not seem to be related to exceeding the TxdStore pool, loaded ytds, or the number of addon tattoos ingame. The problem also occurs with base GTA tattoos.
📦Reproduction repo: https://github.com/horejsiladislav/fivem_tattoo_sync_bug 👉 Before submiting any suggestions, please read the details, there was a lot of research and debug before submitting this issue, so some ideas may already be known. Thanks!
❗ Steps to reproduce are in README. Please pay attention to the requirements, each server build has this problem with different tattoos. To see it in action, use server build provided in README to see the bug with tattoos predefined in the reproduction repo. (other build would have same problem only with different tattoos).
Details
Also available in details.md in the repo.
Click to expand all details 👇
- The tattoos you don’t see depend on the server build you have. Best guess for this is that each new dlc adds some tattoos and probably shifts some indexes of loaded textures?
- Tattoos sometimes aren't visible even on the player themselves, but most of the time, the player can see their own tattoos while others can't.
- The number of tattoos does not seem to affect the issue. We tried adding different quantities of addon tattoos, and oddly enough, a larger number of tattoos sometimes synced when smaller did not.
- Initially, we thought the issue could be related to having too many addon textures streamed, but even after loading our server with every addon we could find (including a custom addon clothes pack with over 15000 different ytds), the problem remained. The number of ytds that aren't tattoos doesn't seem to affect the problem. (the ytds were loaded for player, we precisely loaded amount to be a bit lower than TxdStore pool to not crash the game if anything else loads)
- We tried it on different PCs and various servers (ESX, QB, vRP, clean, with scripts/without, with small/large amount of addon stuff and more..). Same results on all platforms.
- We made different addon tattoo packs and streamed them as separate scripts for testing. Interestingly, when we loaded e.g. 4 packs and started only 3, the tattoos from the third pack were not visible. When we started the fourth pack (with a server restart to load all textures), tattoos from the third pack started appearing, but some from other packs disappeared. (Another hint to the “index shifting” suggested in first point?)
- We confirmed the problem is not related to exceeding the TxdStore pool. Adding more ytds (as in point 4) results in a crash due to exceeding the pool size (95500), which does not happen in the case of the tattoo syncing issue.
- The ytd file for the non-loading tattoo is correctly listed in both players' streaming lists.
- Manually requesting the ytd for a player who can't see it on another player doesn't fix the issue. The ytd is requested and loads correctly when checked with the native function, but the player still can't see it even after restarting the pack the ytd is from. (Example shown in script provided below)
- It doesn't seem to be an issue with streaming list (F8 > Tools > Streaming > Streaming list) indexes either. For example, a tattoo with index 35793 wasn’t syncing, but one with index 35818 was.
- One idea to overcome this was to check for players in close radius, get their tattoos and request all the ytds for yourself. This idea, as you may have guessed, didn’t work as we found out that requesting and loading the ytd is not the problem as said in point 9.
- If it wasn’t obvious from the points above, we don’t think the addon tattoo files are the problem. They seem to stream just fine when we start different numbers of packs or use them on another server build (where of course some tattoos that worked before stop working).
- You can actually see the non-syncing tattoo on yourself, so it is loaded for you, but can’t get it to sync from other player to see it on their body.
- The character with the tattoo has the texture dict loaded (checking with
HasStreamedTextureDictLoaded), whereas the second char, that does not see it, doesn’t. (Can be tried out in the testing script with/tat_request) - One interesting thing we have found while finishing the bug reproduction script, is that the name of the xml files of addon tattoos affect the loading of the textures. (= differently named xml files resulted in different tattoos visible ingame, both base and addon)
- And the last point where it get’s even crazier.. it does not happen only with addon tattoos, but with base GTA tattoos too. You can see it even in the reproduction package.
There is a limit on the number of presets that can be bRequiredForSync'd (Packed Decorations). Essentially, a bit for each while X*32 bits are reserved in the sync tree. The reason why this works on resource restart is due to an imprecise qsort comparison function when sorting the list of bRequiredForSync'd collections (int overflowing - this is a game-code bug).
It is theoretically possible to increase this limit, but it would probably be best to exhaust all other options before exploring the route (e.g., hijack/replace overlays/textures from previous DLCs).
@gottfriedleibniz Hey, thanks for the quick response! Sorry for the delay, just got back from vacation.
I get that increasing the bRequiredForSync limit might be a big ask. However, considering how fast FiveM development is moving and the trend of using addon tattoos and just addon stuff in general, going the replace route may not be a practical solution for the players.
We've spent a significant amount of time researching the problem and talking to players before submitting this issue and unfortunately, every time we got back to this.
With each new content, it seems like this tattoo sync issue just keeps popping up. So, wouldn't bumping up the bRequiredForSync limit be a more direct, and maybe even a more future-proof solution? Let's be honest, players love their addon stuff – but I am sure you already know that.
Let me know what you think, and a big thank you for looking into this!
Hey there @gottfriedleibniz, hope you're having a good day! I just wanted to ask you about any follow up on this issue? It is still a problem to this date and with more tattoos coming in newly released builds, it is even worse.
Thank you for your help on this and let me know if I can do anything to assist.
So there are two separate issues here:
PedDecorationManager's inconsistent sorting implementation.- Modifying the sync-bits to increase the number of decorations that can be synchronized.
While I can immediately fix the first issue, the concern is that servers may have already compensated for this exact issue. The second case requires careful handling to avoid an inconsistent state between clients on canary vs. beta vs. release and things of that nature.
This will require some thought (see previous discussion: https://github.com/citizenfx/fivem/issues/838).
Just to clarify here, is there a known limit on this?
I've started working on addon tattoos, and it seems like there is a very small limit with which we have to work with. I made a pack of 20 tattoos, and seemingly half (for mp female ped, which leads me to think it may be also be a code/config issue on my part) don't sync between players.
Just to clarify here, is there a known limit on this?
I've started working on addon tattoos, and it seems like there is a very small limit with which we have to work with. I made a pack of 20 tattoos, and seemingly half (for mp female ped, which leads me to think it may be also be a code/config issue on my part) don't sync between players.
I started to notice this bug with around 400-500 addon tattoos.
Just to clarify here, is there a known limit on this? I've started working on addon tattoos, and it seems like there is a very small limit with which we have to work with. I made a pack of 20 tattoos, and seemingly half (for mp female ped, which leads me to think it may be also be a code/config issue on my part) don't sync between players.
I started to notice this bug with around 400-500 addon tattoos.
I'm having issues with even 10-20, so I'm not sure what the limit is, or what could lead to "desynchronization" of tattoos.
Its not about the amount of addon tattoos you're streaming. its a general limit on how many decorations can sync between peds iirc, as gott mentioned in his second point, in theory you should be able to repro the issue even with vanilla tattoos.
Its not about the amount of addon tattoos you're streaming. its a general limit on how many decorations can sync between peds iirc, as gott mentioned in his second point, in theory you should be able to repro the issue even with vanilla tattoos.
We've tried with a ped with no decorations changes (base mp_f model) and had no luck. Only thing I can think of here is either our config files are incorrect (I don't think it is as it matches up with the config files of rcore tattoo, durtycloth, and grzybeek's tattoo tools) or some other limitation.
Very little documentation about this stuff, so I haven't been able to look into what else could cause it, if it's not the error OP is experiencing.
Still very present on the server I play which hits up to 800 players daily. Sometimes tattoos are present for the client and showing for others, sometimes it's present for neither. It's very inconsistent but generally rough to deal with. Has there been any progress from CFX's end on this?
@prikolium-cfx
any update?
If I am not mistaken, the last update we know of is the fix of "PedDecorationManager's inconsistent sorting implementation", which gottfried mentioned above. I remember seeing that in some change log ~1 year ago.
However the limits and crashes themselves have not been fixed/changed as far as I know.
Unfortunate they just seem to be ignoring this issue. :/