Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding C#/C++/Java GSDK info #316

Merged
merged 1 commit into from
Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/assets/images/acr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/allocation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/gameserverstates.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/twomethods.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/gsdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ To integrate with GSDK, follow the guide for the programming language/environmen

- [Unity GSDK](unity.md)
- [Unreal GSDK](unreal.md)
- [C#/C++/Java GSDK](csharpcppjava.md)

> **_NOTE_**: For experimenting with Thundernetes, you can use our [wrapper sample](../howtos/usingwrapper.md). This sample takes care of calling the GSDK for you and launching your game server as a separate process.

Expand Down Expand Up @@ -73,3 +74,5 @@ Congratulations, your game server is up and running on Thundernetes!
### Run your game server on Azure Kubernetes Service with Azure Container Registry

As soon as you build your container image, you should publish it to a container registry. If you are using Azure Kubernetes Service, we recommend publishing your image to [Azure Container Registry](https://docs.microsoft.com/azure/container-registry/). To integrate your Azure Container Registry with your Azure Kubernetes Service cluster, check the instructions [here](https://docs.microsoft.com/azure/aks/cluster-container-registry-integration).

[![Azure Container Registry](../assets/images/acr.png)](../assets/images/acr.png)
21 changes: 21 additions & 0 deletions docs/gsdk/csharpcppjava.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
layout: default
title: C++/C#/Java
parent: GSDK integration
nav_order: 4
---

# Integrating GSDK with C++/C#/Java

You can find the GSDK libraries for each language here:
- [C# GSDK](https://github.com/PlayFab/gsdk/tree/main/csharp)
- [C++ GSDK](https://github.com/PlayFab/gsdk/tree/main/cpp)
- [Java GSDK](https://github.com/PlayFab/gsdk/tree/main/java)

## Usage

In all these programming languages, you need to include the GSDK libraries in your project and call the `Start()` and `ReadyForPlayers()` methods. `Start` will signal to Thundernetes that the game server is initializing whereas `ReadyForPlayers` will signal that the game server is ready for players to connect.

#### Testing with LocalMultiplayerAgent

You can use [LocalMultiplayerAgent](runlocalmultiplayeragent.md) to test your GSDK integration of your game server before uploading to Thundernetes.
12 changes: 8 additions & 4 deletions docs/gsdk/gameserverlifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ This document contains information about GSDK and how it affects the game server

Game server lifecycle is dependent on the [GSDK](https://github.com/PlayFab/gsdk) calls as well as the state of the game server process. For more information on integrating your game server with GSDK, check the docs [here](https://docs.microsoft.com/gaming/playfab/features/multiplayer/servers/integrating-game-servers-with-gsdk).

Your game server can integrate GSDK and run on Thundernetes just by calling the **ReadyForPlayers** GSDK method. However, we recommend calling **Start** as well when your game server process starts so thundernetes is aware that the game server is initializing.
Your game server can integrate GSDK and run on Thundernetes just by calling the **ReadyForPlayers** GSDK method. However, we recommend calling **Start** as well when your game server process starts so Thundernetes is aware that the game server is initializing.

[![Start and ReadyForPlayers](../assets/images/twomethods.png)](../assets/images/twomethods.png)

## States of the game server

Expand All @@ -22,18 +24,20 @@ You can view the states of your GameServers by typing `kubectl get gs`. The stat
- **Empty**: when the GameServer is created, the status is empty since we are waiting for the game server process to start and call the necessary GSDK methods.
- **Initializing**: GameServer transitions to this state when it calls the **Start()** GSDK method. In this state, the game server should be starting to load the necessary assets.
- **StandingBy**: GameServer transitions to this state when it calls the **ReadyForPlayers()** GSDK method. This state implies that the GameServer has loaded all the necessary assets and its ready for allocation.
- **Active**: GameServer transitions to this state when it is [allocated](quickstart.md#allocate-a-game-server) by an external call to the allocation API service. Usually it's the responsibility of your matchmaker or lobby service to make this API call. This state implies that players can connect to the game server. When the server is in this state, it can never go back to the **Initializing** or **StandingBy** state.
- **Active**: GameServer transitions to this state when it is [allocated](../quickstart/allocation-scaling/md) by an external call to the allocation API service. Usually it's the responsibility of your matchmaker or lobby service to make this API call. This state implies that players can connect to the game server. When the server is in this state, it can never go back to the **Initializing** or **StandingBy** state.
- **Terminated**: GameServer process can reach this state by terminating, either gracefully or via a crash. Thundernetes monitors all containers in the Pod you specify and will consider a termination of any of them as the termination of the game server. This can happen at any GameServer state. When this happens, Thundernetes will remove the Pod running this GameServer and will create a new one in its place, which will start from the **Empty** state.

GameServer Pods in the Initializing or StandingBy state can be taken down during a cluster scale-down. Thundernetes makes every effort to prevent Active GameServer Pods from being taken down, since this would have the undesirable effect of breaking an existing game. Moreover, as mentioned, GameServer can never transition back to StandingBy state from Active state. The only way to get a new game server in StandingBy state is if the GameServer process exits. You should gracefully exit your game server process when the game session is done and the last connected player has exited the game.

[![GameServer lifecycle](../assets/images/gameserverstates.png)](../assets/images/gameserverstates.png)

> _**NOTE**_: If the game server process crashes for more than `crashesToMarkUnhealthy` times (specified in the GameServerBuild spec, default value 5), then no more operations will be performed on the GameServerBuild.

> _**NOTE**_: User is responsible for collecting logs while the Pod is running. Check [here](howtos/gameserverlogs.md) on how to do this.
> _**NOTE**_: User is responsible for collecting logs while the Pod is running. Check [here](../howtos/gameserverlogs.md) on how to do this.

## Verifying GSDK integration with your game server

You can use the open source tool **LocalMultiplayerAgent** to test GSDK integration and maybe test the game server in your local environment. You can download it [here](https://github.com/PlayFab/MpsAgent) and you can check the docs [here](howtos/runlocalmultiplayeragent.md) for more information.
You can use the open source tool **LocalMultiplayerAgent** to test GSDK integration and maybe test the game server in your local environment. You can download it [here](https://github.com/PlayFab/MpsAgent) and you can check the docs [here](../howtos/runlocalmultiplayeragent.md) for more information.

## GSDK samples

Expand Down
8 changes: 6 additions & 2 deletions docs/gsdk/unity.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
layout: default
title: Unity
parent: GSDK integration
nav_order: 1
nav_order: 2
---

# Integrating GSDK with Unity
Expand Down Expand Up @@ -40,4 +40,8 @@ CMD ["/game/UnityServer.x86_64", "-nographics", "-batchmode", "-logfile"]

### Samples

For a more robust sample integrating Unity with the popular [Mirror](https://mirror-networking.com/) networking library, check the `MpsSamples` repository [here](https://github.com/PlayFab/MpsSamples/tree/main/UnityMirror).
For a more robust sample integrating Unity with the popular [Mirror](https://mirror-networking.com/) networking library, check the `MpsSamples` repository [here](https://github.com/PlayFab/MpsSamples/tree/main/UnityMirror).

#### Testing with LocalMultiplayerAgent

You can use [LocalMultiplayerAgent](runlocalmultiplayeragent.md) to test your GSDK integration of your game server before uploading to Thundernetes.
8 changes: 6 additions & 2 deletions docs/gsdk/unreal.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
layout: default
title: Unreal
parent: GSDK integration
nav_order: 2
nav_order: 3
---

# Integrating GSDK with Unreal
Expand Down Expand Up @@ -52,4 +52,8 @@ CMD su ue -c ./ShooterServer.sh

### Samples

Check [this guide](https://github.com/PlayFab/MpsSamples/tree/main/UnrealThirdPersonMP) on how to integrate the [Unreal Third Person template](https://docs.unrealengine.com/4.27/en-US/Resources/Templates/ThirdPerson/) with the Unreal GSDK.
Check [this guide](https://github.com/PlayFab/MpsSamples/tree/main/UnrealThirdPersonMP) on how to integrate the [Unreal Third Person template](https://docs.unrealengine.com/4.27/en-US/Resources/Templates/ThirdPerson/) with the Unreal GSDK.

#### Testing with LocalMultiplayerAgent

You can use [LocalMultiplayerAgent](runlocalmultiplayeragent.md) to test your GSDK integration of your game server before uploading to Thundernetes.
2 changes: 2 additions & 0 deletions docs/quickstart/allocation-scaling.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ gameserverbuild-sample-netcore-mveex Healthy Active 52.183.89.4 80:1
gameserverbuild-sample-netcore-pxrqx Healthy StandingBy 52.183.89.4 80:10002
```

[![Allocating a Game Server](../assets/images/allocation.png)](../assets/images/allocation.png)

### Lifecycle of a game server

The game server will remain in Active state as long as the game server process is running. Once the game server process exits, the GameServer Custom Resource will be deleted. This will make the game server pod to be deleted and a new one will be created in its place (provided we are not beyond the GameServerBuild's maximum). For more information on the GameServer lifecycle, please check [here](../gameserverlifecycle.md).
Expand Down