Hosting with zeuz
zeuz is a service for hosting your dedicated game server application made with Unity, Bolt Pro and using Photon Cloud for matchmaking. It supports hybrid infrastructure of bare metal servers combined with virtual machines.
How It Works
The flow for 2 players duel game mode is:
- Client 1 connects to Photon Cloud and creates a room
- Client 2 connects to Photon Cloud and joins same room
- Photon Cloud calls zeuz API to reserve a game server instance
- Photon Cloud returns IP + Port of target game server to all clients
- All clients disconnect from Photon Cloud and connect to the game server
Get In Touch With zeuz
Visit zeuz.io and request a demo. You will get access to the dashboard.
Important Terms
- Resource Profile: Template for hardware configuration (Bare Metal / VM, provider, ...)
- Game Profile: Template for a mode or map, whatever you want (2vs2, 3vs3, Raid, ...)
- Resource: Basically a single machine
- Service: Game server process
- Server Group: Pairs game profiles with resource profiles and defines scaling settings
Repository
For game server binaries, please create a Steam utility application. Make sure correct platform is selected (windows/linux) - depends on game server binary, not client.
When developing the game, you deploy your dedicated server builds only to this repository and rest is automatically synchronized. Contact zeuz team directly for details and attach Steam CDkey for the server application.
Resource Profiles
Please discuss with zeuz team and let them setup one for you.
Create API Keys
In zeuz dashboard:
- Click
API
- Click
Add API Key
- The
Access Key
andToken Key
will be used as arguments in game profiles
Create Game Profiles
In zeuz dashboard:
- Click
Game Profiles
- Click
+ New Game Profile
- Fill the
Name
(for example Deathmatch) - Enable
Activated
- Click
Next
- Select your
Repository
Game Type
= BaseQuery Protocol
= Counter Strike: SourceRunning Condition
=imagePath
for Windows,processConnected
for Linux- Set
Executable Path
(for example GameServer.exe) - Add mandatory
Arguments
(full example below)- -accessKey [ACCESS_KEY]
- -tokenKey [TOKEN_KEY]
- -ip {ip.primary}
- -gamePort {port.gamePort}
- -queryPort {port.queryPort}
- -groupID {servergroupId}
- -profileID {gameprofileId}
- -serviceID {serviceId}
- Add custom
Arguments
(Unity specific, your own, ...)- -batchmode
- -nographics
- Enable
Can Query Service
- Enable
Auto Restart
- Click
Next
Add Port Range
(name gamePort, set some values)Add Port Range
(name queryPort, set different values, enable IsQuery)- Click
Save
Final execution command example (values in { } will be replaced upon execution):
GameServer.exe -accessKey xQVy3wFosKPkJhO8EqvE9D7ELowNuHI1pEBTsnPN -tokenKey 40JUKSKB8IZX5933YPZB -ip {ip.primary} -gamePort {port.gamePort} -queryPort {port.queryPort} -groupID {servergroupId} -profileID {gameprofileId} -serviceID {serviceId} -batchmode -nographics
Create Server Groups
In zeuz dashboard:
- Click
Server Groups
- Click
+ Create New Server Group
- Fill the
Name
(for example EU) - Click
Next
- Set resource scaling as you like
- Click
Next
- Set service scaling as you like
- Select which game profiles and resources will be used in this group
- Click
Save
Setup Bolt Application
- Visit Photon Dashboard
- Create new / manage existing Bolt application
- Activate zeuz integration
- Fill zeuz API keys in the configuration
- Enable
Allow early reservation
if you want the game server (service) to be reserved when the room has enough players (for example 6/8)
Server Application Requirements
There are important steps for dedicated server to work correctly with zeuz automatic scaling
using Bolt.zeuz;
// Initialize zeuz integration early, Awake() preferred
Zeuz.Initialize(true);
// Deinitialize when the game is over, all clients already disconnected and the game server instance can be destroyed
Zeuz.Deinitialize(true);
The Bolt server should listen on Zeuz.IP
and Zeuz.GamePort
.
You can use Zeuz.ProfileID
to identify the game profile / mode.
The parameter in Zeuz.Initialize(true)
and Zeuz.Deinitialize(true)
means that Unreserve API call will be executed if true
.
This will free the current process (service).
Client Application Requirements
using Bolt.zeuz;
// Use ZeuzClient for matchmaking instead of LoadBalancingClient
ZeuzClient client = new ZeuzClient();
...
// Register delegates to get information about dedicated server
client.OnServerInfoReceived += OnServerInfoReceived;
client.OnServerNotAvailable += OnServerNotAvailable;
...
// It’s mandatory to pass Server Group ID and Game Profile ID to Photon Cloud when creating/joining a room.
// Only players with same IDs can play together.
RoomOptions roomOptions = client.GetRoomOptions(serverGroupID, gameProfileID);
...
client.OpJoinOrCreateRoom(roomName, roomOptions, TypedLobby.Default);
// Both RoomOptions and room properties are supported, just use what you need for the matchmaking
Hashtable roomProperties = client.GetRoomProperties(serverGroupID, gameProfileID);
...
client.OpJoinRandomRoom(roomProperties, maxPlayers);
// You can explicitly tell how many players are needed for a game server to be reserved.
// This way you can start a match with 6/8 players, other players join later.
// Be sure "Allow early reservation" is enabled in Photon Dashboard.
RoomOptions roomOptions = client.GetRoomOptions(serverGroupID, gameProfileID, minPlayers);
A dedicated server instance will be reserved when the room is full. Clients will receive IP + Port in OnServerInfoReceived
.
If there is an error (services exhaustion, wrong setup, ...) OnServerNotAvailable
is called.
Running A Local Server
This feature is aimed for development and debugging purposes.
- Run your game
server
locally with arguments (only-ip
,-gamePort
and-profileID
are mandatory if you use them). For example:GameServer.exe -ip 127.0.0.1 -gamePort 2500 -profileID 69
- In
client
simply use same IP + Port when creating room.RoomOptions roomOptions = client.GetRoomOptions(serverGroupID, gameProfileID, "127.0.0.1", 2500); ... client.OpCreateRoom(roomName, roomOptions, TypedLobby.Default);
- When the room is full,
all players
receive the local server information instead of instance from zeuz. This way, you can even forward production players to your local game server instance (public IP needed) and debug :) - If you want to run the game server directly in Unity Editor, you can set overrides instead of specifying command line arguments:
Zeuz.SetServerOverrides("127.0.0.1", 2500);
Onboarding
Here are some pieces of advice / requirements to run game servers efficiently and provide best user experience to your players
- Try to minimize server build size - focus on largest parts like textures and audio. This will reduce application loading times and saves memory => you can run more processes on single machine => saves money
- Windows and Linux platform builds are supported
- Linux specifics:
mesa-utils
is required to run Unity,HOME
environment variable is not set by default => Asset Bundles won't load - For easier issues resolving, please save Unity logs to the folder with executable file - later it can be accessed via FTP
- Passing data directly from room to reserved game server is not supported