Page 1 of 1

Handling minigame rooms

Posted: 30 Mar 2009, 12:38
by falcan
Hi, I'm trying to code minigames working with openSpace map. The question is how to handle this with respect to joining rooms. The minigame should be initialised after clicking on something on the map(I've got this already). I saw only 2 ways:

1) Create an openSpace "virtual" game room which would be joined, so I would emulate what smartfox does, join the player into the new room. And then over that show some movieClip layer with the actual minigame. It would seem a little odd to me, to play tic tac toe or something to disappear from the park where you stand and join this virtual room just to play tic tac toe. But it would work correctly I guess.

2) More natural approach to me seemed to leave the user standing in the park and also join the minigame room. I'm currently sending a command to the server extension to initialize a minigame room for me(+attach extension). Then I join the player in the room, also from server side. Now of course, smartFox gets onJoinRoom event, so I'm checking if the name of the room is minigame_something, if not it is processed like a normal openSpace room, if it is, it should just diplay the new minigame layer which communicates with smartFox server outside of openSpace. After I close the minigame layer it should just remove the player from the dynamic smartfox room and I should be able to continue walking on openSpace map.

Now my questions:
1) Not sure if its right to display another layer with minigame over openSpace(while it is still "active"), wouldn't that mean performance problems?

2) The main problem, after I join the minigame room on the server(and even I see in my admin panel that the user is in BOTH rooms, eg. the "map" room and the "minigame" room), other people see the user joining also the minigame being deleted from openSpace(it shows "removing user id ..."). When that other user now present in 2 rooms tries to move on openSpace map, he is recreated again, but doesn't move, can't chat etc. From the users perspective the user can walk normally but can't chat also. Seems like the user is not really in the room anymore?

Re: Handling minigame rooms

Posted: 01 Apr 2009, 08:31
by Bax
falcan wrote:1) Not sure if its right to display another layer with minigame over openSpace(while it is still "active"), wouldn't that mean performance problems?
This is not recommended, as it may cause performance issues (OpenSpace is resource intensive on its own... if you add another layer and run a game, the Flash Player could have problems).
falcan wrote:2) The main problem, after I join the minigame room on the server(and even I see in my admin panel that the user is in BOTH rooms, eg. the "map" room and the "minigame" room), other people see the user joining also the minigame being deleted from openSpace(it shows "removing user id ..."). When that other user now present in 2 rooms tries to move on openSpace map, he is recreated again, but doesn't move, can't chat etc. From the users perspective the user can walk normally but can't chat also. Seems like the user is not really in the room anymore?
The current version of OpenSpace does not support multi-room join, that is why you are having those issues. We suggest you to stop OpenSpace (with the OpenSpace.clear method) without removing it from the stage, run the game, and then reload the previous map on game end.

Re: Handling minigame rooms

Posted: 06 Apr 2009, 12:24
by falcan
Hey Bax, thanks for your answers!
This is not recommended, as it may cause performance issues (OpenSpace is resource intensive on its own... if you add another layer and run a game, the Flash Player could have problems).
Ok, thanks for clearing that up.
The current version of OpenSpace does not support multi-room join, that is why you are having those issues. We suggest you to stop OpenSpace (with the OpenSpace.clear method) without removing it from the stage, run the game, and then reload the previous map on game end.
Thanks for the clear() method suggestion, works. Just noting for other people who might do this - my game has server logic in another room, so I had to stop OS, server-join that game room while leaving my original room(due to multijoin problems), do my stuff, then

1) on minigame quit send extension response telling the client where to materialize on joining the os room back(coordinates) - I hope it's an ok way to do that.

2) server join my original room back. This fires the onJoinRoom event on the client side and makes the player appear near the minigame entry point thanks to the previous step.

It seems to work correctly for everyone, the only thing is, for some of the cases disappearing player from map is good(singleplayer games that would have 50 players standing near the entry point, well...), for some not so good - let's say I want to play tic tac toe or any other 2-player game with another user, when I want to join that tic tac toe room I have to leave the current room, so we both disappear at the game start from our bench. It will work, but it will look weird to disappear and then reappear in the same map at spawn coords after the game ends. Will the next version of OS support multijoin?