Question:
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.
Answer:
- Get a server.
- Write the server side of your game.
- 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.
- 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.).
- Give players access to the room.
- The players enter (if they haven't changed their mind) and start the game.