Closed lucas-brasmobi closed 3 years ago
This is error is caused by having too many unique room names. Dissonance uses a 16 bit ID (calculated as the hash of the room name) for each room - this error indicates that two rooms were assigned the same ID.
With a normal number of rooms this isn't an issue - in fact you're the first person to ever report this! I assume you are generating hundreds or even thousands of rooms?
Exactly, We use it in 2D card game. We have 30k DAU. Matches are played by 2 or 4 players. A room is created for each match. It can generate up to 15 thousand rooms per day. How can we solve this?
The real issue here is simply that Dissonance really isn't designed for rooms of this scale. Ideally all of the players would be split up into separate network sessions, so Dissonance is only handling 2-4 players instead of 2000! In the longer term I would recommend trying to do this, there is a lot of unnecessary network traffic flowing around to organise a voice chat session with 2000 people in it!
However, I understand that's probably a pretty big change for your game, so here's a workaround instead. As mentioned above Dissonance room names are identified by 16 bit IDs so there's a hard limit of 65535 rooms (2^16), however you're hitting this at much lower numbers because the chance of a collision increases the more rooms you have active. Instead of randomly generating room names (which might cause collisions) you can instead have the server hand out room names which are guaranteed not to collide. Here is a list of 65535 rooms names which will not generate a single hash collision:
This increases your limit from ~2000 concurrent matches (based on random chance it may be higher or lower) to exactly 65535 concurrent matches (this cannot be increased further without changing the underlying network protocol).
Since I haven't heard back from you for a while I'll assume that fix worked for you. Don't hesitate to contact me again if you've still got an issue :)
Context
The error [Error ID: Hash collision between room names '{0}' and '{1}] occurs on the client, when the server has more than 2k of users connected.
Error Log:
Dissonance version used: 7.3.0
Unity version: 2020.3.1f1
Editor Operating System and version: Microsoft Windows 10 Pro
Build Settings: Android