Multiplayer game vaadin 6 application

Hi there,

First of all, I’m new to Vaadin and have little experience with sessions or transaction or threadLocal.
My project has to work with Vaadin 6 not 7. It’s a school project.
But the subject i have questions about hasn’t been handled during the courses.

I’ve made an offline working swing board game. Each player has several pieces on the board.
The business logic is also programmed to handle multiplayer.

So what i need is to make a vaadin frontend and controller for multiplayer purposes to play online.

For starters let’s say the webapp opens with the board on it.
There must be a check if another player is allready present.
If one is present. That one is player1 and the new one entering player2

Now the board consists of buttons. The listener has to pass the user’s identifier to verify if it’s player 1 or 2 to move a piece.
There’s also a difference in the visibility of the pieces on the board.
Player 1 cannot see the pieces of player 2 and visa versa.

Both player’s webapp view has to update if one of the two makes a move. but still retain the visibility restrictions of the pieces on each users’s browser ‘session’.

In a second phase I’d like to add something like playrooms.

I’ve read that Vaadin 7 now uses something like VaadinSession and UI
But have to use Vaadin 6 so that’s no option.
And then there’s the ThreadLocal Pattern.

Could somebody point me in the right direction?

While it is possible to find other applications’s sessions and access them, this easily gets complicated (correct locking of sessions, handling of players leaving the game / expiring sessions, …). Therefore, I would recommend looking for some simple message queue library and using it to pass messages between player sessions.

If you do need to truly share data, I’d recommend doing it so that the shared entity is separate from the sessions and has a suitable API that hides some of the complexity of concurrent access.