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

README overhaul: More complete, and organize as separate pages #101

Merged
merged 25 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Final build document, move cloud deploy to its own document, final cr…
…oss refs

Some cleanup and consistency.
  • Loading branch information
pgilmorepf committed Nov 4, 2021
commit bd751c8f480cac0100a60d5729f4f911b5f18139
82 changes: 15 additions & 67 deletions UnrealPlugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,89 +11,37 @@ It was tested with Unreal Engine 4.26.2, but should work with other engines as w

The sample game these instructions were created with was called ThirdPersonMP, so replace anywhere you see that with your game name.

# Prerequisites:
## Requirements

- Download Visual Studio (the [community version is free](https://visualstudio.microsoft.com/vs/community/))
* Download Visual Studio (the [community version is free](https://visualstudio.microsoft.com/vs/community/))
pgilmorepf marked this conversation as resolved.
Show resolved Hide resolved
- Requires Workloads: .NET desktop development, and Desktop development with C++
- Download Unreal Engine Source Build by following [these instructions](https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/ProgrammingWithCPP/DownloadingSourceCode/) from the Unreal Engine website. This was tested on [4.26.2](https://github.com/EpicGames/UnrealEngine/releases/tag/4.26.2-release) (Link requires permissions)
- Download the [Unreal PlayFabGSDK Plugin folder](https://github.com/PlayFab/gsdk/tree/master/UnrealPlugin)
- [Optional] Download the [LocalMultiplayerAgent](https://github.com/PlayFab/MpsAgent/tree/main/LocalMultiplayerAgent)
* Download Unreal Engine Source Build by following [these instructions](https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/ProgrammingWithCPP/DownloadingSourceCode/) from the Unreal Engine website. This was tested on [4.26.2](https://github.com/EpicGames/UnrealEngine/releases/tag/4.26.2-release) (Link requires permissions)
* Download the [Unreal PlayFabGSDK Plugin folder](https://github.com/PlayFab/gsdk/tree/master/UnrealPlugin)
pgilmorepf marked this conversation as resolved.
Show resolved Hide resolved
* [Optional] Download the [LocalMultiplayerAgent](https://github.com/PlayFab/MpsAgent/tree/main/LocalMultiplayerAgent)
pgilmorepf marked this conversation as resolved.
Show resolved Hide resolved
* [Optional] [PlayFab Marketplace plugin](https://www.unrealengine.com/marketplace/en-US/product/playfab-sdk) or the [source version on GitHub](https://github.com/PlayFab/UnrealMarketplacePlugin/tree/master/4.26/PlayFabPlugin/PlayFab) (Not required for GSDK, but required for most other PlayFab services, including login)

# Project creation
## Project creation

Unreal GSDK is installed into an Unreal server project. You will need a network-enabled multiplayer Unreal project with a dedicated-server mode. If you do not have one, you can follow our [Unreal prerequsitie setup](ThirdPersonMPSetup.md) guide. Once you have a network-enabled, multiplayer game, with a dedicated server, return here and continue.
pgilmorepf marked this conversation as resolved.
Show resolved Hide resolved

# Project GSDK setup
## Project GSDK setup

With a multiplayer project configured for both a network connected game-client and game-server, you're ready to [install the GSDK](ThirdPersonMPGSDKSetup.md). This will allow your server to run on PlayFab Multiplayer Services.
pgilmorepf marked this conversation as resolved.
Show resolved Hide resolved

# Unreal Project Build Configurations
## Unreal Project Build Configurations

Once the GSDK is installed and configured in your project, you can [build your Unreal project](ThirdPersonMPBuild.md). There are multiple build configurations you will need to execute the full range of tests in future steps.

# Test Local Server Deployment
## Test Local Server Deployment

Once you have any client build, and a "Development Server" build, you can [test the MPS deployment process locally](ThirdPersonMPLocalDeploy.md), and verify your server works.
pgilmorepf marked this conversation as resolved.
Show resolved Hide resolved

# Deploy to PlayFab
## Deploy to PlayFab
pgilmorepf marked this conversation as resolved.
Show resolved Hide resolved

Finally, you're ready to deploy your game-server to PlayFab, and test with real game servers in the cloud. _TODO-LINK!_
Finally, you're ready to [deploy your game-server to PlayFab](ThirdPersonMPCloudDeploy.md), and test with real game servers in the cloud.
pgilmorepf marked this conversation as resolved.
Show resolved Hide resolved

# Acknowledgements

Thank you to [Nick Arthur](https://github.com/narthur157) for his amazing [Dockerfile](https://github.com/narthur157/playfab-gsdk-ue4).



TODO: MOVE THIS TO PLAYFAB-DEPLOY FILE

## Packaging the game server

Make sure that you have just built your project in development editor in Visual Studio *before* doing this next step, because sometimes building fails when opening the project directly through the .uproject file.

Right click on the .uproject file in your file editor and select "Generate Visual Studio Project Files".

Then open the .uproject file.

In the top left of the Unreal editor menu, click on File -> Package -> Target Configuration -> [game name]Server and then go to File -> Package -> Windowsx64.
You can now use this packaged version of your game server to [test with LocalMultiplayerAgent](https://docs.microsoft.com/en-us/gaming/playfab/features/multiplayer/servers/locally-debugging-game-servers-and-integration-with-playfab)
or to use it directly with PlayFab by [creating a build](https://developer.playfab.com/) and then using [PlayFab MpsAllocatorSample](https://github.com/PlayFab/MpsSamples/blob/master/MpsAllocatorSample/README.md).

## Setting up a Windows Dedicated Server on PlayFab

An important note about this is that you need to set the start command in process-based mode to \<root folder\>\\Binaries\\Win64\\\<project name\>Server.exe (or however the executable is called in the folder).

In container-based mode use \<mount folder\>\\\<root folder\>\\Binaries\\Win64\\\<project name\>Server.exe (or however the executable is called in the folder).

**If you use the executable in the root folder, the server will fail to initialize with the PlayFab system.**

## Setting up a Linux Dedicated Server on PlayFab

During testing the following Dockerfile + startup.sh script worked excellent with the PlayFab Linux VM:

### The Dockerfile:

```Dockerfile
FROM ubuntu:18.04

# Unreal refuses to run as root user, so we must create a user to run as
# Docker uses root by default
RUN useradd --system ue
USER ue

EXPOSE 7777/udp

WORKDIR /server

COPY --chown=ue:ue . /server
USER root
CMD ./startup.sh
```

### startup&#46;sh bash script:

```bash
chown -R ue.ue $PF_SERVER_LOG_DIRECTORY
su ue -c ./<projectname>Server.sh
```
Make sure that the line endings in the startup&#46;sh file are LF (\\n) and not CRLF (\\r\\n).

Thank you to [narthur157](https://github.com/narthur157) for his amazing [Dockerfile](https://github.com/narthur157/playfab-gsdk-ue4), which this Dockerfile is based on.
Thank you to [Adam Rehn]{https://github.com/adamrehn) for all his work with Unreal and Docker, including code, samples, examples, and tutorials.
49 changes: 45 additions & 4 deletions UnrealPlugin/ThirdPersonMPBuild.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,57 @@ The purpose of this guide is to describe all the build configurations needed to

## Requirements

- Download Visual Studio (the [community version is free](https://visualstudio.microsoft.com/vs/community/))
* Download Visual Studio (the [community version is free](https://visualstudio.microsoft.com/vs/community/))
- Requires Workloads: .NET desktop development, and Desktop development with C++
- Download Unreal Engine Source Build by following [these instructions](https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/ProgrammingWithCPP/DownloadingSourceCode/) from the Unreal Engine website. This was tested on [4.26.2](https://github.com/EpicGames/UnrealEngine/releases/tag/4.26.2-release) (Link requires permissions)
* Download Unreal Engine Source Build by following [these instructions](https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/ProgrammingWithCPP/DownloadingSourceCode/) from the Unreal Engine website. This was tested on [4.26.2](https://github.com/EpicGames/UnrealEngine/releases/tag/4.26.2-release) (Link requires permissions)
* [Completed Unreal Project](ThirdPersonMPSetup.md) with [PlayFab Unreal GSDK](ThirdPersonMPGSDKSetup.md) installed and configured

* Knowledge about [Unreal Build Configuration](https://docs.unrealengine.com/4.27/en-US/ProductionPipelines/DevelopmentSetup/CompilingProjects/) options

## Instructions

TODO:
The [GSDK setup](ThirdPersonMPGSDKSetup.md) guide previously described the steps to "Switch Unreal Engine Version" and "Generate Visual Studio project files". There is also an [Unreal guide](https://docs.unrealengine.com/4.27/en-US/ProductionPipelines/DevelopmentSetup/CompilingProjects/) about the various compilation options, which you should review.

### Development Editor

The development editor should be the first thing you build. To do this, find your ThirdPersonMP.uproject file, right click, and "Generate Visual Studio project files" (You may have already done this in the previous guide, in which case, you can skip this step. Once complete, you can open ThirdPersonMP.sln in Visual Studio.

Once Visual Studio loads, change your configuration to "Development Server". The Solution Configuration dropdown is sometimes hard to read, but can be resized in the toolbar customization options. Now, build. The first time you do this, it can take several hours, but you likely did this in the previous guide. Repeated builds should be fairly fast for a small project. Once finished, you can run/debug the project Solution/Games/ThirdPersonMP. This will start the Development Editor.

### Shipping Client

Run the Development Editor, and from the development editor window, pick these options in this order:

* File -> Package Project -> Build Target -> ThirdPersonMP (Or the name of your project)
* File -> Package Project -> Build Configuration -> Development
* File -> Package Project -> Windows (64-bit)
* (This opens a popup window asking you to pick a location - make sure you remember this location)
* {Wait a very long time}
* The first shipping client build will take upto multiple hours, even if you've already built Development Editor
pgilmorepf marked this conversation as resolved.
Show resolved Hide resolved
* Repeat builds will be much faster for a simple project like ThirdPersonMP
* Open the client location you picked and find ThirdPersonMP.exe

### Development Server

* Close the Development Editor (Unreal is no longer running, only Visual Studio should be open now)
* Toolbars -> Configuration -> "Development Server"
* Build/Rebuild Solution
* {Wait a very long time}
* The first development server build will take upto multiple hours, even if you've already built Development Editor
* Repeat builds will be much faster for a simple project like ThirdPersonMP
* Use Explorer to find {projectLocation}\Binaries\Win64\ThirdPersonMPServer.exe

### Shipping Server

Run the Development Editor, and from the development editor window, pick these options in this order:

* File -> Package Project -> Build Target -> ThirdPersonMPServer (Or the name of your project)+Server
* File -> Package Project -> Build Configuration -> Development
* File -> Package Project -> Windows (64-bit)
* (This opens a popup window asking you to pick a location - make sure you remember this location)
* {Wait a very long time}
* The first shipping server build will take upto multiple hours, even if you've already built Development Editor
* Repeat builds will be much faster for a simple project like ThirdPersonMP
* Open the server location you picked and find ThirdPersonMPServer.exe

## Navigation

Expand Down
74 changes: 74 additions & 0 deletions UnrealPlugin/ThirdPersonMPCloudDeploy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# ThirdPersonMP Example Project Cloud Deployment

The purpose of this guide is the final step, deploying your game to the PlayFab MPS cloud.
pgilmorepf marked this conversation as resolved.
Show resolved Hide resolved

## Goals

* Deploy a game to the cloud.
* Connect to it from a local game client

## Requirements

* Download Visual Studio (the [community version is free](https://visualstudio.microsoft.com/vs/community/))
- Requires Workloads: .NET desktop development, and Desktop development with C++
* Download Unreal Engine Source Build by following [these instructions](https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/ProgrammingWithCPP/DownloadingSourceCode/) from the Unreal Engine website. This was tested on [4.26.2](https://github.com/EpicGames/UnrealEngine/releases/tag/4.26.2-release) (Link requires permissions)
* [Completed Unreal Project](ThirdPersonMPSetup.md) with [PlayFab Unreal GSDK](ThirdPersonMPGSDKSetup.md) installed and configured
* [Release Server](ThirdPersonMPBuild.md) configuration of your project built from Visual Studio or Development Editor
* [Client](ThirdPersonMPBuild.md) configuration of your project built from Visual Studio or Development Editor

## Instructions

### Packaging the game server

Make sure that you have just built your project in development editor in Visual Studio *before* doing this next step, because sometimes building fails when opening the project directly through the .uproject file.

Right click on the .uproject file in your file editor and select "Generate Visual Studio Project Files".

Then open the .uproject file.

In the top left of the Unreal editor menu, click on File -> Package -> Target Configuration -> [game name]Server and then go to File -> Package -> Windowsx64.
You can now use this packaged version of your game server to [test with LocalMultiplayerAgent](https://docs.microsoft.com/en-us/gaming/playfab/features/multiplayer/servers/locally-debugging-game-servers-and-integration-with-playfab)
or to use it directly with PlayFab by [creating a build](https://developer.playfab.com/) and then using [PlayFab MpsAllocatorSample](https://github.com/PlayFab/MpsSamples/blob/master/MpsAllocatorSample/README.md).

### Setting up a Windows Dedicated Server on PlayFab

An important note about this is that you need to set the start command in process-based mode to \<root folder\>\\Binaries\\Win64\\\<project name\>Server.exe (or however the executable is called in the folder).

In container-based mode use \<mount folder\>\\\<root folder\>\\Binaries\\Win64\\\<project name\>Server.exe (or however the executable is called in the folder).

**If you use the executable in the root folder, the server will fail to initialize with the PlayFab system.**

### Setting up a Linux Dedicated Server on PlayFab

During testing the following Dockerfile + startup.sh script worked excellent with the PlayFab Linux VM:

#### The Linux Dockerfile:

```Dockerfile
FROM ubuntu:18.04

# Unreal refuses to run as root user, so we must create a user to run as
# Docker uses root by default
RUN useradd --system ue
USER ue

EXPOSE 7777/udp

WORKDIR /server

COPY --chown=ue:ue . /server
USER root
CMD ./startup.sh
```

### startup.sh bash script:

```bash
chown -R ue.ue $PF_SERVER_LOG_DIRECTORY
su ue -c ./<projectname>Server.sh
```
Make sure that the line endings in the startup&#46;sh file are LF (\\n) and not CRLF (\\r\\n).
pgilmorepf marked this conversation as resolved.
Show resolved Hide resolved

# Navigation

This guide sequence is finished. You can return to the main [Unreal GSDK Plugin](README.md) guide.
5 changes: 2 additions & 3 deletions UnrealPlugin/ThirdPersonMPGSDKSetup.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ We will add and configure the Playfab Unreal GSDK to your project, and test it l

When using the plugin a few things need to be taken care off.
Copy link

@joannaleecy joannaleecy Nov 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to a list so it's easier to follow.

"

  • Go to your Unreal game project
  • Open File Explorer and create a "Plugins" folder in your games' root directory. In the Plugins folder, create a folder called "PlayFabGSDK".
  • Go to the location where you've downloaded and saved the GSDK Unreal plugin. Drag all the files from the UnrealPlugin folder into the Plugins/PlayFabGSDK folder.
  • Lastly, open your game project's .uproject file in a text editor of your choice. In the plugins array, add the PlayFabGSDK plugin.
    "

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bold actual folder and file names to adhere to Microsoft style.


First, open File Explorer and create a folder called Plugins in your games' root directory and in the Plugins folder, create a folder called "PlayFabGSDK". Then, drag all the files from the UnrealPlugin folder in this repo into the Plugins/PlayFabGSDK folder.
First, open File Explorer and create a folder called "Plugins" in your games' root directory and in the Plugins folder, create a folder called "PlayFabGSDK". Then, drag all the files from the UnrealPlugin folder in this repo into the Plugins/PlayFabGSDK folder.

Open the .uproject file in a text editor of your choice. In the plugins array add the PlayFabGSDK.
pgilmorepf marked this conversation as resolved.
Show resolved Hide resolved

Expand Down Expand Up @@ -74,7 +74,7 @@ currently the source build, select it from the dropdown list and then click OK.

![image depicting a window that says "Select Unreal Engine Version"](Documentation/SelectUnrealEngineVersion.png)

Right click on the .uproject file again and select Generate Visual Studio Project Files".
Right click on the .uproject file again and select "Generate Visual Studio Project Files".

Then, build the project in Visual Studio and start the Editor by selecting the Development Editor configuration.

Expand Down Expand Up @@ -249,7 +249,6 @@ bool UMyGameInstance::OnGSDKHealthCheck()
}
```


## Blueprint implementation

In a folder of your choice in the Content Browser right-click and create a Blueprint class. In the All classes dropdown menu find the GameInstance class. In this example the blueprint is named "BP_GameInstance".

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use similar principles as above. Use bulleted list to make it easier to follow the steps. Have a summarized list of all the steps if it's a multiple step process.

Expand Down
Loading