Discussion list for Unity developers.
unity-dev at moock.org
Thu Jun 7 02:19:06 CDT 2007
Hey guys, I ran into another problem (bug?) with Unity the other day. I’ve got an app that has multiple chat rooms. These rooms are created dynamically and are persistent once everyone leaves the room. So basically, after a Unity server restart, there are no rooms yet and the first time someone joins a room it’s created and stays around for good. So, once a client connects to the server and creates the namespace, Unity tells the client what rooms exist on in that namespace. The problem I ran into was that Unity got into a state where about 25% of the time the server would not report all the rooms that were in that namespace. Specifically, I had the following rooms; chat, blue, red, red32, green. (I did NOT create the rooms in this order. I believe they were created in the order green, blue red, chat, red32.) Watching the output window in Studio 8, Unity would normally report all the rooms in that order every time (output below) DEBUG: RoomManager now adding NameSpace: server1 DEBUG: UClient notified of new NameSpace object: 'server1'. DEBUG: NameSpace 'server1' added listener: A NamespaceView instance DEBUG: Room factory for NameSpace 'server1' set to: LocationRoomFactory DEBUG: NameSpace 'server1' notifying observers of new room: 'chat'. DEBUG: NameSpace 'server1' notifying observers of new room: 'blue'. DEBUG: NameSpace 'server1' notifying observers of new room: 'red'. DEBUG: NameSpace 'server1' notifying observers of new room: 'red32'. DEBUG: NameSpace 'server1' notifying observers of new room: 'green'. However, I got to a point where Unity would not report the first 2 rooms; chat and blue. So it would just tell me the following DEBUG: RoomManager now adding NameSpace: server1 DEBUG: UClient notified of new NameSpace object: 'server1'. DEBUG: NameSpace 'server1' added listener: A NamespaceView instance DEBUG: Room factory for NameSpace 'server1' set to: LocationRoomFactory DEBUG: NameSpace 'server1' notifying observers of new room: 'red'. DEBUG: NameSpace 'server1' notifying observers of new room: 'red32'. DEBUG: NameSpace 'server1' notifying observers of new room: 'green'. My code would think the chat and blue rooms hadn’t been created yet. So when I wanted to join one of these rooms, my code would call the createRoomOnServer to which Unity would reply with a ROOM_ALREADY_EXISTS. But… the namespace instance did not have those 2 rooms in its room list. So it was impossible for me to join them as I could not get an instance of the rooms (e.g. ns.getRoom(“blue”) would return null). Like I said this was happening about 25% of the time I connected and was happening with different apps as well. So I restarted the server and all was well. Has anyone else experienced anything like this? I'm pretty sure it was a server side issue and not a flash issue because I was seeing it in multiple flash apps. Is there something that would cause this? Notice I do have a custom URoom (Flash side, not server side). Not sure if that is relevant or not. Also, how does Unity decide what order to store these rooms on the server? If I create rooms in the order green, blue, red, the next time I run the app and create the namespace, Unity always reports back with the rooms in the order blue, red, green. i.e. DEBUG: NameSpace 'server1' notifying observers of new room: 'blue'. DEBUG: NameSpace 'server1' notifying observers of new room: 'red'. DEBUG: NameSpace 'server1' notifying observers of new room: 'green'. Sorry, for the super long email but I would appreciate any input as this would be a big problem for me if it happens regularly. Thanks, Derek