Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • General Discussion /
avatar image
Question by Vladislav Rashkov · Apr 27, 2021 at 01:13 AM · Matchmakingmultiplayer

How to create 3 player game multiplayer matchmaking

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

    My current setup is:
  • DB Server - it's database that i am hosting myself that holds the main info of a user and of the game mechanics that I want to get from during the (3 player) multiplayer games.
  • PlayFab - hold the user accounts (that's all for now but will add more stuff in the future)
  • Unity - The game

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:

  • Unity Game (Player 1) -> PlayFab/Unity Server -> calls the DB Server API -> PlayFab/Unity Server retrieves and works with the DB Server API data -> (Player 2,3)

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!

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by SethDu · Apr 27, 2021 at 05:26 AM

  • I don’t think an external DB Server is required in your scenario. Any game mechanics or main info of a user can be stored either on the server build or PlayFab. Only when there are concurrent writes from multiple players, is the queued DB server required. Based on the description. The game mechanism can be stored in Title Data, because it doesn’t change frequently. You may simply call server API to retrieve data.
  • PlayFab matchmaking system work seamlessly with Multiplayer server 2.0, where you may enable auto-allocation for servers. It means that after player 1 and player 2 create a matchmaking tickets and matched, a server instance will become active, then each player can call GetMatch API to get the IP and port for connection. Matchmaking - PlayFab | Microsoft Docs
  • Bot/AI is something can be implemented in the Server build. It is reasonable to keep monitoring the connections in a multiplayer match.
  • The Multiplayer server is hosted with Docker. Each game is independent on data. “have 30 users so this should be 10 matches in total for 3 players in a match” à when you configure the server build, you will need to set up Standy server number and max server number. Those number can be customized based on your real requirement, but you may need to apply for increasing quota as the free quota for testing is limit. I suggest you to look into the document -- Servers - PlayFab | Microsoft Docs. We provide very detailed explanations about these features. Please tell me if you have any other questions.
Comment

People who like this

0 Show 4 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Vladislav Rashkov · Apr 27, 2021 at 09:44 AM 0
Share

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?

avatar image SethDu ♦ Vladislav Rashkov · Apr 28, 2021 at 08:45 AM 0
Share

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.

avatar image Vladislav Rashkov · Apr 27, 2021 at 09:45 AM 0
Share

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.

avatar image SethDu ♦ Vladislav Rashkov · Apr 28, 2021 at 09:02 AM 0
Share

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.

avatar image

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.

Comment

People who like this

0 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    2 People are following this question.

    avatar image avatar image

    Related Questions

    getting started multiplayer on Nintendo Switch with UE4 2 Answers

    Unreal Matchmaking 1 Answer

    When a player disconnects from the server does PlayFab automatically take the player off of the match?,When a player disconnects from the server does PlayFab automatically take the player off of the match 1 Answer

    Connecting multiple clients to the same server! ,Connecting multiple clients to one playfab server 1 Answer

    Trouble with Backfill tickets 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges