Coder Social home page Coder Social logo

playfab / mpssamples Goto Github PK

View Code? Open in Web Editor NEW
147.0 34.0 74.0 7.71 MB

Samples that show how to use PlayFab's Gameserver SDK for Multiplayer Servers

Home Page: https://docs.microsoft.com/en-us/gaming/playfab/features/multiplayer/servers/

License: Apache License 2.0

C# 97.42% ShaderLab 1.99% HLSL 0.29% Dockerfile 0.07% PowerShell 0.02% Smalltalk 0.01% Shell 0.02% JavaScript 0.19%

mpssamples's Introduction

MpsSamples

This repository contains samples that show how to use Azure PlayFab Multiplayer Servers Gameserver SDK (GSDK) as well as additional resources.

Wrapping GSDK

You could try GSDK without modifying your game server (even though we don't recommend it for production deployments). This sample also contains a sample fake game server you can try in order to familiarize with the Multiplayer Servers service. You can find instructions here.

MpsAllocatorSample

This is a simple .NET Core console app that lets you easily see your MPS Builds/Game Servers/VMs plus allocate a game server (uses the RequestMultiplayerServer API call). More information here.

UnityMirror

Unity Server and Client sample that utilize the GameServer SDK.

More information here.

UnrealThirdPersonMP

Unreal Server and Client sample that utilize the GameServer SDK which is integrated through an Unreal plugin.

More information here.

OpenArena

This sample wraps the open source OpenArena game using a .NET Core app and Linux containers.

More information here.

Debugging Docker containers

MPS service uses Docker containers to schedule game servers. You can see some advanced debugging/diagnosing instructions here.

Matchmake Sample

The Matchmake sample logs in a configurable number of clients and attempts to matchmake them together, following the steps described in the Single user ticket matchmaking sample.

WindowsRunnerCSharp

Simple executable that integrates with PlayFab's Gameserver SDK (GSDK). It starts an http server that will respond to GET requests with a json file containing whatever configuration values it read from the GSDK. More information here.

Community samples

Here you can find a list of samples and utilities created and supported by our community. Let us know if you have created a sample yourself and would like to have it mentioned here.

Videos

MPS team has published a series of videos in the past, check them on our videos page.

Questions

If you have any questions, feel free to engage in the repo's discussions here or find us in Discord here

mpssamples's People

Contributors

andhesky avatar brianwp3000 avatar chris-gong avatar crhasher avatar dependabot[bot] avatar dgkanatsios avatar emmayspark avatar haroniti avatar je-die avatar joannaleecy avatar lesterbjackson avatar mirkosrsens avatar nassosterz-ms avatar nishsinghal20 avatar pgilmorepf avatar ravarnamsft avatar starburst997 avatar structed avatar valexao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mpssamples's Issues

Unity Multiplayer Server's heartbeat vanishes

I moved this to the unity SDK as that is where the bug resides. https://github.com/PlayFab/UnitySDK/issues/225#issue-601638231

Been chasing an issue where our game server loses its heartbeat. Our server actually switches scenes during its startup.

Root cause is missing code in PlayFabMultiplayerAgentView

Adding the following to the class fixed the issue:

public class PlayFabMultiplayerAgentView : MonoBehaviour
{
private float _timer;

    /// <summary>
    /// Awake constructor
    /// </summary>
    private void Awake()
    {
        Debug.Log($"{Time.fixedTime} PlayFabMultiplayerAgentView awake ");

        // Need to keep this game object alive through scene changes.
        DontDestroyOnLoad(this);
    }

    /// <summary>
    /// Called when gameobject is destroyed
    /// </summary>
    private void OnDestroy()
    {
        Debug.Log($"{Time.fixedTime} PlayFabMultiplayerAgentView destroyed ");
    }

UNITYTLS_X509VERIFY_FATAL_ERROR on Linux server

If you get error in Unity that looks like this:

Curl error 35: Cert handshake failed. verify result: UNITYTLS_X509VERIFY_FATAL_ERROR. error state: 7\n","stream":"stdout","time":"2022-05-21T19:40:05.368326753Z"}

/Server/GetUserData: Unable to complete SSL connection\n","stream":"stdout","time":"2022-05-21T19:40:05.387915285Z"}

It means you are missing certificates which are not included when building image or the server. This dockerfile for unity: https://github.com/PlayFab/MpsSamples/blob/main/UnityMirror/Dockerfile should be modified to look like this

FROM ubuntu:20.04
WORKDIR /game
ADD . .
RUN apt update
RUN apt install -y --reinstall ca-certificates
EXPOSE 7777/udp
CMD ["/game/Game.exe"]

which will install certificates inside the image and it should work (or at least remove that issue). EXOPOSE 7777/udp is not needed. Many ppl with no Linux experience will struggle to figure it out (as did I).

Challenge in simulating multi-players

HI,

I was exploring on if we can simulate the multi-players to a game to generate the data insights, so wanted to know if there is a way of simulating the multi-players.

Thanks,
Amit Kumar

Getting GSDK not found error when trying to build Openarena

Facing issue when trying to build Openarena, please find the error message below

Error Message

Unhandled Exception: Microsoft.Playfab.Gaming.GSDK.CSharp.GSDKInitializationException: GSDK file - not found

OpenArena for Azure PlayFab Multiplayer Servers

at Microsoft.Playfab.Gaming.GSDK.CSharp.InternalSdk.GetConfiguration()

at Microsoft.Playfab.Gaming.GSDK.CSharp.InternalSdk.Start(Boolean debugLogs)

at Microsoft.Playfab.Gaming.GSDK.CSharp.GameserverSDK.LogMessage(String message)

at openarena.Program.Main(String[] args) in /source/Program.cs:line 19

Remove unnecessary scenes from UnityMirror project

Discussed in #44

Originally posted by calebsmith12890 October 5, 2021
I'm dead set on trying to get a project going with Unity/Mirror/PlayFab that has the Client and Servers in separate projects, like you have in this sample. When I download and run these two samples everything seems to connect just fine so long as I just use the Server and Client scenes. Where I'm getting confused is the implementation of the Online/Offline/Room scenes. What exactly was the intention with these scenes, are they finished, how are they supposed to be setup? It seems like I've tried every combination of using the scenes in the client and/or server network managers and the only way I can seem to get the online scene to trigger is by hosting in the single build. I hope this question makes any sense. I'd love a bit more guidance or work on this sample if possible. Thank you!

All scenes apart from ServerScene should be removed.

Most recent commit of Unity Client/Server is missing PlayFab SDK code

I updated my project to the latest release of the Unity Sample, and noticed that all the PlayFab SDK code is missing. I've tried downloading it multiple times and on different devices - just incase of personal error - but to no avail. Please fix this asap, this may delay some from starting their project, thanks for your time.
Screen Shot 2022-04-13 at 3 47 37 AM

Unity Mirror in 2 projects?

Hey I was trying to use your Unity Mirror project as a starting point for a project, but having it in two different projects is definitely a hindrance and causing a lot of issues trying to work around it. Is there any way you can combine it into 1 project like this one that's used in the DapperDino youtube tutorial?
https://github.com/natepac/playfabmirrorgameexample/tree/master

I managed to get my project working with the above repo as a starting point, but the problem there is that he's using an old version of Mirror and Playfab sdk, and upgrading causes a boatload of errors.

Need to create Unreal Sample Instructions

These instructions will include how to set up a third person multiplayer game and a dedicated server, how to use the playfab gsdk plugin, and how to use LocalMultiplayerAgent and the MPS Allocator sample with your server in container mode.

OnServerConnect is never called

For some reason the function in UnityNetworkServer:

private void OnServerConnect(NetworkMessage netMsg)

is never called before:

private void OnReceiveAuthenticate(NetworkMessage netMsg)

So for any request from the client _connections is empty and all requests to the server fail.

UnityEditor.log

Unable to use UDP (KCP) with playfab on localhost docker.

info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
      User profile is available. Using 'C:\Users\Tony\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
Local Multiplayer Agent is listening on port 56001
Player1, Player2
info: PlayFabLocalMultiplayerAgent[0]
      game_port (UDP): Local port 56100 mapped to container port 7777

Port is opened in firewall.

    "PortMappingsList": [
        [
            {
                "NodePort": 56100,
                "GamePort": {
                    "Name": "game_port",
                    "Number": 7777,
                    "Protocol": "UDP"
                }
            }
        ]
    ],

Works in localhost server.
Any tips to debug this issue or UDP is not supported at all?

Connection timed out after not receiving any message for 10000ms. Disconnecting.

I set Deplay server at multipaler tab and test at UnityClient but it time out every time.
How to fix this issue.

KCP: Connection timed out after not receiving any message for 10000ms. Disconnecting.
UnityEngine.Debug:LogWarning (object)
kcp2k.KcpConnection:HandleTimeout (uint) (at Assets/Mirror/Runtime/Transport/KCP/kcp2k/highlevel/KcpConnection.cs:154)
kcp2k.KcpConnection:TickIncoming_Connected (uint) (at Assets/Mirror/Runtime/Transport/KCP/kcp2k/highlevel/KcpConnection.cs:250)
kcp2k.KcpConnection:TickIncoming () (at Assets/Mirror/Runtime/Transport/KCP/kcp2k/highlevel/KcpConnection.cs:362)
kcp2k.KcpClient:TickIncoming () (at Assets/Mirror/Runtime/Transport/KCP/kcp2k/highlevel/KcpClient.cs:89)
kcp2k.KcpTransport:ClientEarlyUpdate () (at Assets/Mirror/Runtime/Transport/KCP/MirrorTransport/KcpTransport.cs:117)
Mirror.NetworkClient:NetworkEarlyUpdate () (at Assets/Mirror/Runtime/NetworkClient.cs:1198)
Mirror.NetworkLoop:NetworkEarlyUpdate () (at Assets/Mirror/Runtime/NetworkLoop.cs:182)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.