1. Game has 3 player slots everyone plays for himself
2. In order to start to play, you search for a game like matchmaking and if 2 other people are searching it will create a game between you 3
I am new to Multiplayer and Playfab, from what I saw is that i have to put a (Unity Server) inside (Playfab multiplayer functionallity). When I do so I will have 1 more component so everything will be: DB Server, PlayFab, Unity Game, PlayFab/Unity Server
It's turn-based game so I imagine based on the above components It should work something like this:
The idea is that I want to use this as dedicated server that gets info from the main DB Server and then returns to users. Not sure if it makes sense but everything should be connected to the main DB Server.
3. Another thing is that I want when a player leaves or disconnects to be replaced with a (BOT/AI) that will take his place until he returns. I think this code should be placed in the Playfab/Unity server to make most sense, but maybe I am wrong. And if that's the case how should I set it up, so when a user leaves AI takes his place and vice versa?
4. Another thing I don't understand is if this is dedicated server + matchmaking how do I separate all the data. Let's say we have 30 users so this should be 10 matches in total for 3 players in a match. So if all our player data goes into 1 server how does the server knows where to return the data to?
I am new to multiplayer and just want to understand how things should work. I looked also into Photon but i think that solution is a bit expesive atm so I was thinking if PlayFab server could do the job for me. I would be grateful if someone can provide pointers to my questions.
Thank you!
Answer by SethDu · Apr 27, 2021 at 05:26 AM
Thank you for the asnwer.
1. That's how I want to use it yes, just the DB Server to be for retrieving data and at the end of the game to save "END data" in it. The other time I will use PlayFab, so from what I saw "Shared Group Data" is the best option I have there?
Shared Group Data is able to store the data you want, but to be clear, as long as "END data" doesn't contain files with large size like replay videos, and only contains some statistics, you may also consider storing in Player Read-Only Data separately for each player. Using Shared Group Data may be not convenient for later reference as you need to store the names of Shared Groups somewhere. There is no API that can list all the shared groups that a player has joined.
Shared group is used to store temporary data like chat logs. Since you are already using hosted server, temporary data can be stored in the running server build.
2. The game is not a big one, it's just a turn based board game, so there are not many "actions" that one player can make and one game will be between 5-10 minutes. As there won't be many users active at the same time I want to create a mechanic that if you are "queue-ing" for 20 seconds for example and don't find a match to automatically start a game against 2 bots, so based on the logic that for every game there will be a separate server I just don't seem to find that efficient. If we have 100 players playing against 100 bots, this will be 100 servers. So what I want to ask is, is it okay if there is 1 server which will just return data based on the "Shared Group Data" for example. So even if 100 players are playing on 1 server they are getting different data back. Or If that's not possible I guess my other option is to create "BOT" system for client and "BOT" for server side, because you should be able to play against bots by urself and against BOT when someone leaves/disconnects a game.
Sorry if some stuff don't make much sense or are not correct, just trying to figure out how things work.
2. You may also consider if it is necessary to implement hosted server. You may refer to Example: Turn-based multiplayer Async games. Shared Group Data can be used without hosted server.
3. Playing with Bots -> When AI scripts are implemented in the client side, you should consider anti-cheating. There is no hosted server that can ensure the validity of the match process. Hence, Multiplayer servers are required. You are able to host multiple connection within one server instance, but will require help from external tools, some developers in the community uses SignalR to handle the connections.
Answer by Vladislav Rashkov · Apr 27, 2021 at 08:44 AM
Thank you for the asnwer.
1. That's how I want to use it yes, just the DB Server to be for retrieving data and at the end of the game to save "END data" in it. The other time I will use PlayFab, so from what I saw "Shared Group Data" is the best option I have there?
2. The game is not a big one, it's just a turn based board game, so there are not many "actions" that one player can make and one game will be between 5-10 minutes. As there won't be many users active at the same time I want to create a mechanic that if you are "queue-ing" for 20 seconds for example and don't find a match to automatically start a game against 2 bots, so based on the logic that for every game there will be a separate server I just don't seem to find that efficient. If we have 100 players playing against 100 bots, this will be 100 servers. So what I want to ask is, is it okay if there is 1 server which will just return data based on the "Shared Group Data" for example. So even if 100 players are playing on 1 server they are getting different data back. Or If that's not possible I guess my other option is to create "BOT" system for client and "BOT" for server side, because you should be able to play against bots by urself and against BOT when someone leaves/disconnects a game.
Sorry if some stuff don't make much sense or are not correct, just trying to figure out how things work.