We have a problem involving players switching what levels they are on and making sure instantiated player objects don't spawn and destroy before they reach the correct level.
We wanted to do a workflow like this, but it appears not to work because of how ismessagequeuerunning functions:
https://docs.google.com/drawings/d/18AVXz90KCMa3IxaHtdhL_FNUiHNEmcxh6unwmxJ8JNI/edit?usp=sharing
Basic idea when joining a room:
joinroom-> turn off message queue -> check room properties for level to load -> loading (could take between 2 seconds and minutes if they have to download the map from our server) -> check if the level you loaded is the one the room is currently on again (room properties) ->turn messaging queue back on
The problem happens if the room level switches while one of the players is loading the old level. Since the message queue is off, they have no way of being told that they have loaded the wrong level until after they turn the message queue back on. If you turn the message queue back on again however, it spawns instantiated players and RPCs before realizing you are in the wrong level. Then if you try to switch to the correct level after that, the instantiated players and other objects get destroyed.
I've also tried a method of instantiated players in group 1 instead of 0 and to turn off receiving RPCs from group 1 until you are sure you are on the correct level, problem is that when you turn group 1 receiving back on, you don't get the instantiation of the players that are already on the level. (I thought these were supposed to be buffered?).
I'm really not sure how to solve this without leaving rooms and joining again if your level is wrong?
We wanted to do a workflow like this, but it appears not to work because of how ismessagequeuerunning functions:
https://docs.google.com/drawings/d/18AVXz90KCMa3IxaHtdhL_FNUiHNEmcxh6unwmxJ8JNI/edit?usp=sharing
Basic idea when joining a room:
joinroom-> turn off message queue -> check room properties for level to load -> loading (could take between 2 seconds and minutes if they have to download the map from our server) -> check if the level you loaded is the one the room is currently on again (room properties) ->turn messaging queue back on
The problem happens if the room level switches while one of the players is loading the old level. Since the message queue is off, they have no way of being told that they have loaded the wrong level until after they turn the message queue back on. If you turn the message queue back on again however, it spawns instantiated players and RPCs before realizing you are in the wrong level. Then if you try to switch to the correct level after that, the instantiated players and other objects get destroyed.
I've also tried a method of instantiated players in group 1 instead of 0 and to turn off receiving RPCs from group 1 until you are sure you are on the correct level, problem is that when you turn group 1 receiving back on, you don't get the instantiation of the players that are already on the level. (I thought these were supposed to be buffered?).
I'm really not sure how to solve this without leaving rooms and joining again if your level is wrong?