How to decide an asynchronous multiplayer solution for a turn based mobile chess game?
Hello, I am seeking advice on how to best implement an asynchronous multiplayer solution to my mobile battle chess game. It’s the last thing that I need to add in this project before releasing it. I don’t need Realtime connections or to keep track of gameObjects’ transform positions.
The web developer who I paid a lot of money to create a custom chess api and database for this project randomly ghosted me. I’m very passionate about this project so I figured I can learn the multiplayer part in my limited free time. I read about UNet, Photon (PUN, Bolt), Mirror, PlayFab, MLAPI, SmartFox, Websockets, and many other things. However, I was wondering if you could recommend a particular solution for my game.
Requirements for Multiplayer solution:
Allow a player to be matched with another player based off their chess ELO
Allow a player to send a game request to a friend regardless of ELO
Because chess games can last quite a while, the game MUST be able to run asynchronously. I don’t want the game to automatically end if a player closes the app on their phone for a few hours.
I want the find the cheapest solution that doesn’t compromise functionality. I’m a solo indie developer, I’m young, and I just had a daughter. Money is tight, but I understand that every solution is going to have a fee.
Lastly, is there an online database that you recommend to use to save player data like ELO, unlocked assets, friends, etc.. client side. I’ve been looking at Firebase, but from what I’ve heard it’s a far from ideal solution.
Background information:
I have a fully functioning battle chess game. Currently, a player can play against the computer and play against themself (moving for both sides). The legal moves are validated client side by a C# chess engine that is communicated with via UCI I know that multiplayer solutions can be costly, so I’ve made the game such that the only information needed to make a move is a string and two ints:
A string fen (the current board position in FEN)
An int moveStartIndex (index of the square where the move started)
An int moveEndIndex (index of the square where the move ended)
This is how I imagine multiplayer working.
Instantiating pieces and the environment are done client side with a function called SetPiecesByFEN(string fen).
The current player loads the currentFEN board position from the server
The current player makes a move
The moveStartIndex and moveEndIndex are set
The currentFEN, moveStartIndex, and moveEndIndex are sent to the server and are added to a list called moveHistory
The currentFEN is updated to match the board position after the new move and is sent to the server to be set as the current board position.
The other player is alerted that a move has been made
The other player loads the currentFEN board position from the server
The other player makes a move
Repeat until game over or player resigns
Thank you for your time!!
P.S. For anyone who’s wondering, the moveStartIndex and moveEndIndex are used to be able to show a replay of the latest move played. They aren’t necessary for UCI. It’s a feature that I added for the convenience of the player. Imagine returning to a game several hours later, there is a quick replay of the latest move played before allowing you to make your move.