MirrorNetworking / Mirror

#1 Open Source Unity Networking Library
https://mirror-networking.com
MIT License
5.22k stars 770 forks source link

Scene ID Collison Loading Multiples of Same Additive Scene #1612

Closed MrGadget1024 closed 4 years ago

MrGadget1024 commented 4 years ago

Describe the bug Cylinder's sceneId: 70A2BD58 is already taken by: Cylinder.

The subscene of course has networked objects in it, and the conflict is expected, but in order to have easy-to-make multi-match work we need to find a solution to this.

This is really not an issue for clients, since they only have one instance of any subscene loaded, It's only a show stopper for the server.

To Reproduce Steps to reproduce the behavior:

  1. Set up the Additive example per the ReadMe
  2. Select the Network object and increase the Sub Scenes array to 2
  3. Add the SubScene again so it's in there twice.
  4. Play as host.
  5. BUG Error in console

Expected behavior No error / No Scene ID collision

James-Frowen commented 4 years ago

From discord JamesFrowen Today at 14:31

We could use some of the bytes in the id for a load count, and the server would use those to keep track of the object, and the client would ignore them

MrGadget Today at 14:36

1 byte would be enough to distinguish...I honestly can't envision Unity holding up to 255 copies of the same subscene loaded at once. Even if Unity could do that, I'd expect the game workload would knock the server over long before it got that many matches going.

JamesFrowen Today at 14:45

scene id is 8 bytes atm ? 4 of them are the scene hash, and the others are randomly generated id, would 3 bytes be enough for the randomly generated id ? or It might be better to use the space on the scenehash side, it should be possible to make a 24bit hash of the scene address right ?