Hosting의 하위 섹션

Hosting via client

The simplest way to host Nox game is via OpenNox game client.

Run OpenNox or OpenNoxHD, go to “Network”, 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 open ports for the game (via UPnP on your router).

참고

Servers hosted with OpenNoxHD 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 too much advantage to HD players.

Hosting a dedicated server

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

Also, Docker images are available for the server.

When hosting a dedicated server, it’s important to consider remote console and/or HTTP API to control the server remotely.

주의

We got quite a few bug reports about dedicated server freezing.

Thus, we do not recommend running dedicated server at this stage.

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.

참고

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

Or in terms of 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.

주의

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

Or in terms of 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

Or in terms of 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())

Or in terms of 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);

Or in terms of 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'