Unreal Onboarding Guide
Pre-requirements
Your game will need to be built to run with a dedicated Linux server. Your server will be deployed and hosted on Hathora Cloud.
1. Preparing your server build
Your server will need to be able to be built as a dedicated Linux server build. For more info, check out Unreal's guide.
2. Generating a Dockerfile
By providing a Dockerfile with your server build, we will be able to scale your server across the globe.
Sample UE5 Dockerfile:
FROM ubuntu:22.04
# Add these dependencies to enable your server to make outbound TLS requests
RUN apt-get update && \
apt-get install -y ca-certificates && \
update-ca-certificates
# Unreal doesn't like running as root, so let's create a user
RUN groupadd --gid 1000 unreal \
&& useradd --uid 1000 --gid unreal --create-home unreal
USER unreal
# Now copy over your server build
WORKDIR /home/unreal
COPY --chown=unreal:unreal . .
# Make sure your init script and server binary are executable
# If you have any other binaries (e.g. crash handlers), make sure to set those as executable too!
RUN chmod +x init.sh
RUN chmod +x YourGame/Binaries/Linux/YourGameServer
# Start init script (passing any parameters you need)
CMD ./init.sh
3. Deploy server to Hathora Cloud
If this is your first time deploying on Hathora Cloud, we recommend starting with our Deploying on Hathora Cloud guide.
When configuring your transport layer, Unreal requires UDP port 7777 by default.
:::ç
There are 2 ways to deploy your server on Hathora Cloud:
- With command line or CI/CD pipeline
- Drag and drop upload via Hathora Console
- CLI
- Console
hathora deploy \
--file $FILE_OR_DIRECTORY \
--build-tag $BUILD_TAG \
--rooms-per-process $ROOMS_PER_PROCESS \
--container-port $CONTAINER_PORT \
--transport-type $TRANSPORT_TYPE \
--requested-memory-mb $MEMORY_MB \
--requested-cpu $CPU \
--env ENV1=$ENV1_VALUE \
--env ENV2=$ENV2_VALUE \
--idle-timeout-enabled $BOOLEAN\
--app-id $APP_ID \
--token $HATHORA_TOKEN
Your server file needs to be a compressed tar file (e.g. .tgz
, tar.gz
).
The zipped bundle should include your server build, along with your Dockerfile at the root.
Zero-downtime deployments: New deployments will not impact any existing games, your newly deployed version will only be used for subsequent games created after.
4. Creating rooms/processes
There are 2 ways to create rooms on Hathora Cloud:
- Via API call
- Directly with Hathora Console (great for debugging)
- API
- Console
A simple API call: RoomApi.CreateRoom(appId)
.
To learn more about room creation and lifecycle, check out our Room Lifecycle docs
5. Connecting to a room
Once you have created a room, it will take Hathora Cloud a few seconds to spin up your server instance and expose a port for your client to connect to.
We recommend polling RoomApi.GetConnectionInfo(appId, roomId)
until status
is "active" and ExposedPort
is not null
.
We will automatically terminate a process if there are no active connections for 5 minutes (i.e. the process is in an idle state for 5 minutes).
With our Hathora Console, you can get connection info (host:port
) directly, which is useful for testing and debugging.
6. Lobby Service and integration with matchmakers
Check our Lobby Service for a lightweight way to build a lobby system for your game.