how to design the group of "GameRoomSesstion"

135 views
Skip to first unread message

Nguyễn Nhân Thiên Lộc

unread,
Jan 5, 2014, 11:50:15 PM1/5/14
to jets...@googlegroups.com
 Hi everybody !

i'm researching the jetserver, and i'm interested in designe of it.so I decided to use jetserver to develope my game. My game is mobile online game like card or chess. It use TCP/IP to communication.In design,my game has a lot of "group of game room" (about 100 groups), one "group of game room " has about 200 "game room" . one "game room" has about ( 2,3, or 4 player ) for a battle . affer user log-in, they can choose "group of room" ("group of room" is a group of game room) then choose "game room" to join a battle . If the user don't want to join a "game room" that had created, he can create a "game room" on "group of game room". A battle will have 2,3,or 4 player. In jetserver, we have class GameRoomSession is designed very good for "game room" function. My question is how do i should design the "groups of game room " but DON'T change and customize the class GameRoomSession so much .

thanks all for helping me !
Paul Nguyen

Abraham Menacherry

unread,
Jan 6, 2014, 8:48:14 PM1/6/14
to jets...@googlegroups.com
Paul,

Thanks for you interest in Nadron. 
From your requirement it looks like you are looking for what is called "lobby" or waiting room kind of functionality. i.e a room whose basic function would be to provide list of other room names, player information within a specific room etc. Did I understand you correctly?

My initial guess to solve the problem will be like this.
1. Extend the game room session just like the zombie example and override the onLogin method.
   something like public class LobbyRoom extends GameRoomSession{.... List<GameRoom> otherGameRooms, }
  
2. Add a SessionEventHandler to this game room which listens for ROOM_LIST event, i.e 0x12 

Abraham Menacherry

unread,
Jan 6, 2014, 8:55:04 PM1/6/14
to jets...@googlegroups.com
Sorry, I posted before I finished the mail...:)

At point 2..
lobbyRoomInstance.addHandler(add your session event handler which listens for ROOM_LIST event).
In the onEvent method of this handler you can write code like
getSession().send(new NetworkEvent(data)) where data is nothing but a list of string of room names that are part of this special LobbyRoom.

3. At client side, you need to send this ROOM_LIST event to server to get back the list of rooms that this LobbyRoom has.

I think this is a common requirement that you are asking. So I will try to provide a default implementation for this in near future. Little bit busy now, but hopefully in couple of weeks.

I have added Issue 60 to track this.
Thanks,
Abraham.

Nguyễn Nhân Thiên Lộc

unread,
Jan 7, 2014, 2:24:36 AM1/7/14
to jets...@googlegroups.com
hi Abraham !
hi All !

thanks for suggesting me the solution. I will try now
thanks again everybody,and happy new year  (sun)



--
You received this message because you are subscribed to a topic in the Google Groups "jetserver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jetserver/yYkv9AtdiQI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jetserver+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Nguyễn Nhân Thiên Lộc

unread,
Jan 7, 2014, 4:00:51 AM1/7/14
to jets...@googlegroups.com
hi Abaraham !
hi All !

i have a question more. In case we use two or more SesstionEventhandler in program. example DefaultSessionhandler and GameRoomSessionhandler, after login step,we can comunicate between client and server .When client send a message to server, which is the first SessionEventHandler handler message and process it. I don't know how the JetLangdispatcher process Event, so it making me confused

Paul Nguyen

abraham menacherry

unread,
Jan 7, 2014, 7:48:11 AM1/7/14
to jets...@googlegroups.com
The first event handler added will process the event first.

Actually, the default event handler does not have any logic for ROOM_LIST event, so it really does not matter the order in which you put the handlers in this particular case.

Thanks,
Abraham.


You received this message because you are subscribed to the Google Groups "jetserver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jetserver+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages