Subsections of Hosting

Hosting using a client

The simplest way to host a game is by using OpenNox game client.

Run OpenNox or OpenNox HD, go to the “Network” page, and host the game. Simple as that!

OpenNox will automatically register the game online (for both OpenNox and Nox Reloaded).

It will also attempt to automatically forward ports for the server (using UPnP on your router).

Info

Servers hosted with OpenNox HD version will not allow non-HD clients!

This is done for fairness reasons. Since not everyone runs OpenNox in HD, it will significantly limit their vision distance, giving a big advantage to HD players.

Hosting a dedicated server

Warning

There are quite a few bug reports about dedicated server freezing.

Thus, it is not recommend to run dedicated server at this stage.

OpenNox also ships with the opennox-server binary, which can be used to run a dedicated server.

Also, Docker images are available for the server.

When hosting a dedicated server, it is important to setup access by remote console and/or HTTP API to control the server remotely.

Remote SSH console

Vanilla Nox supported a telnet-based remote console (RCON) which allowed controlling Nox server remotely.

OpenNox has dropped telnet support in favor of SSH-based remote console.

Info

OpenNox only emulates SSH protocol. It does not allow accessing the host machine via SSH.

To enable RCON, OpenNox must be started with an additional argument:

opennox --rcon=:18522 --rcon-pass=my-secret-password

This will allow SSH connections on port 18522 with a password my-secret-password:

ssh -p 18522 127.0.0.1

See this tutorial

ssh -p 18522 127.0.0.1

Or install PuTTY and connect to 127.0.0.1:18522 with any username and password my-secret-password.

  /888888                                /88   /88           /88   /88
 /88__  88                              | 888 | 88          | 88  / 88
| 88  \ 88  /888888   /888888  /8888888 | 8888| 88  /888888 |  88/ 88/
| 88  | 88 /88__  88 /88__  88| 88__  88| 88 88 88 /88__  88 \  8888/
| 88  | 88| 88  \ 88| 88888888| 88  \ 88| 88  8888| 88  \ 88  >88  88
| 88  | 88| 88  | 88| 88_____/| 88  | 88| 88\  888| 88  | 88 /88/\  88
|  888888/| 8888888/|  8888888| 88  | 88| 88 \  88|  888888/| 88  \ 88
 \______/ | 88____/  \_______/|__/  |__/|__/  \__/ \______/ |__/  |__/
          | 88
          | 88        Version: v1.9.x (xxxxxxxxx)
          |__/

user@opennox:~$

From here, all console commands will work the same way as via in-game console. A good starting point is a help command.

Server HTTP API

Server info

GET /api/v0/game/info

Example request using curl:

curl 'http://127.0.0.1:18580/api/v0/game/info'

Example response:

{
  "name":"OpenNox",
  "map":"estate",
  "mode":"arena",
  "vers":"v1.8.0",
  "players":{
    "cur":1,
    "max":32,
    "list":[
      {
        "name":"Jack",
        "class":"wizard"
      }
    ]
  }
}

Setting the token

You need to run the server with NOX_API_TOKEN=<some-random-string> to allow using control APIs.

Warning

You must set token to something complex. Otherwise, someone can get full control of your server!

All examples below assume NOX_API_TOKEN=xyz.

Change map

POST /api/v0/game/map
X-Token: xyz

estate

Example request using curl:

curl -X POST -H 'X-Token: xyz' -d 'estate' 'http://127.0.0.1:18580/api/v0/game/map'

Run console command

POST /api/v0/game/cmd
X-Token: xyz

load estate

Example request using curl:

curl -X POST -H 'X-Token: xyz' -d 'load estate' 'http://127.0.0.1:18580/api/v0/game/cmd'

Run NS script

POST /api/v0/game/eval
X-Token: xyz

ns4.CreateObject("RedApple", ns4.GetHost().Unit().Pos())

Example request using curl:

curl -X POST -H 'X-Token: xyz' -d 'ns4.CreateObject("RedApple", ns4.GetHost().Unit().Pos())' 'http://127.0.0.1:18580/api/v0/game/eval'

Run Lua script

POST /api/v0/game/lua
X-Token: xyz

p = Nox.Players[1];
apple = Nox.ObjectType("RedApple");
apple:Create(p);

Example request using curl:

curl -X POST -H 'X-Token: xyz' -d 'p = Nox.Players[1]; apple = Nox.ObjectType("RedApple"); apple:Create(p)' 'http://127.0.0.1:18580/api/v0/game/lua'