MMO Starter Kit

After building UE5 from source and then building your MMOKit project, its possible to build a Linux version of the Chat Server and Dedicated Server using Visual Studio 2022 on Windows 10. Here is how I did it:

To build a Chat Server for Linux
Installed .NET6 SDK from Download .NET (Linux, macOS, and Windows)
I used the Upgrade Assistant to upgrade/port it to .NET6 which can build Linux-compatible programs written in .NET languages Overview of the .NET Upgrade Assistant - .NET Core | Microsoft Learn
After upgrading/porting I had to then build it for Linux with the command: dotnet publish -c release -r linux-x64 --self-contained
For other Linux flavours , just replace linux-x64 with a different RID string listed here: .NET Runtime Identifier (RID) catalog | Microsoft Learn
I then copied the files in the bin/Release/Net6.0/Linux-x64 folder to my CentOS Linux server
I created a new Linux user called unreal with : useradd unreal
Changed the password with passwd unreal
Moved the files to /home/unreal
Changed the ownership of the files to unreal:unreal with the command chown -R unreal:unreal mymmochatfolder
Changed the permission of MMOChatServer with chmod -R 700 mymmochatfolder/MMOChatServer
Copy the hostnames.ini file to your mymmochatfolder (be careful not to create a Linux textfile as using one will cause the Chat Server to no longer be able to get the guild data from the database which I think is due to how Linux uses a different character code for “end of line”).
Run the chat server in the background with ./MMOChatServer &
Note for : there were a few warnings when I created the Linux release of the Chat Server:

D:\Chat\Source>dotnet publish -c release -r linux-x64 --self-contained
Microsoft (R) Build Engine version 17.1.1+a02f73656 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  Restored D:\Chat\Source\MMOChatServer\MMOChatServer.csproj (in 31.99 sec).
D:\Chat\Source\MMOChatServer\Misc.cs(231,46): warning SYSLIB0014: 'WebRequest.Create(string)' is obsolete: 'WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.' [D:\Chat\Source\MMOChatServer\MMOChatServer.csproj]
  MMOChatServer -> D:\Chat\Source\MMOChatServer\bin\Release\net6.0\linux-x64\MMOChatServer.dll
  MMOChatServer -> D:\Chat\Source\MMOChatServer\bin\Release\net6.0\linux-x64\publish\

D:\Chat\Source>

To build a Dedicated Server for Linux
Install the Linux Cross-compile Toolchain, instructions here: Linux Development Requirements for Unreal Engine | Unreal Engine 5.0 Documentation

Then open your game project solution in VS2022 and (make sure the Solution Configuration is still set to Development Editor and Solution Platform is set to Win64).

Click Local Windows Debugger button or Debug > Start Debugging or press F5. Your project then opens in the UE5 Editor.

Then to go Platforms > Linux > MMOServer then Platforms > Linux > Package Project. This will produce a Linux Dedicated Server folder called LinuxServer in your Packaged folder that you can upload to your Linux server.

Ensure that you run the MMOServer as a user other than root. You should also use chown to change the ownership of your files to the chosen user and use chmod to add the executable permission to your MMOServer executable file and then run it in the background with the command

./MMOServer -log &

1 Like