android – How to connect players with each other in a paired online game?


There was an idea to create a sea battle online for Android. The game is already done, but here's the problem: I don't know how to get two players to be driven into the same room when searching for a game. Those. in the main menu there is a button to search for a game, you press and wait until there is another player, as there is – both players are driven into one room and play a naval battle.

If the solution is obvious to you, please share, because I don't know how to implement it. At least briefly on the steps, what to do.


  1. Get a server.
  2. Write the server side of your game.
  3. Do match-making for the players (selection of pairs). For example, all players, by pressing their buttons, report to the server that they are ready to play, and he selects pairs between them.
  4. When there is a pair, create a "room" for it on the server, this is a type of logical mini-server for the game, where players can exchange data with each other (moves, etc.).
  5. Give players access to the room.
  6. The players enter (if they haven't changed their mind) and start the game.
Scroll to Top