HTML5 Turn Based Multiplayer Games

0 votes

Hi there, 

I would like to develop a multiplayer turn based game with AppWarp on HTML5. 

My problem so far is, that I do not really understand the concept of TurnBased Multiplayer (one on one!). 

What I did understand so far is: 

  1. Connect to AppWarp using initialize and connect and bind listeners
  2. On Matchmaking try to join existing room (joinRoomInRange(0, 1, true);)
  3. If the onJoinRoomDone is called with an error, I call createTurnRoom
    1. if someone connects to the room (onUserJoinedRoom) I can start the game (startGame())
    2. startGame is called with error code 0
  4. If onJoinRoomDone succeeds I subscribe to that room
    1. if someone connects to the room (onUserJoinedRoom) I can start the game (startGame())
    2. startGame is called with error code 4

Is this the correct implementation? Why am I seeing that error code 4 if there is already an existing room?

Does anyone have some example code for an HTML5 app (e.g. something like tic tac toe) where I could check the basic structure out?

How would you handle multiple open turn based games (e.g in two rooms its my time to play, in 2 others I'm waiting for the opponent to play)?


Thanks for your help! I really need some obviously! 


asked Sep 2, 2014 in AppWarp by Sebastian Zillessen (10 points)

1 Answer

0 votes
You have to call startGame only once. Once the game is started you don't need to call startGame again. startGame will invoke onGameStarted notification describing who sent that request in which room and whose next turn it is. The player whose turn it is, will call sendMove which will invoke onMoveCompleted. Further moveEvent will contain who's next turn it it. Similarly it will go on.
You can not be in multiple rooms simultaneously. You have to play one game at a time i.e. be in a one room at a time.
answered Sep 3, 2014 by Suyash Mohan (900 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on