|
1 | 1 | # Simple Game Server |
2 | 2 |
|
3 | | -A very simple logging server, for the purposes of demoing and testing |
4 | | -running UDP and/or TCP based server on Agones. |
| 3 | +A very simple "toy" game server created to demo and test running a UDP and/or |
| 4 | +TCP game server on Agones. |
5 | 5 |
|
6 | | -## Server |
7 | | -Starts a server on port `7654` by default. Can be overwritten by `PORT` env var or `port` flag. |
| 6 | +To learn how to deploy your edited version of go server to gcp, please check |
| 7 | +out this link: [Edit Your First Game Server (Go)](https://agones.dev/site/docs/getting-started/edit-first-gameserver-go/), |
| 8 | +or also look at the [`Makefile`](./Makefile). |
8 | 9 |
|
9 | | -By default listens on UDP. Set `UDP=FALSE` env var or `-udp=false` flag to turn UDP off. |
| 10 | +## Interacting with the Server |
10 | 11 |
|
11 | | -To enable TCP, set `TCP=TRUE` env var or `-tcp` flag. Must have at least TCP or UDP enabled. |
| 12 | +When the server receives a text packet, it will send back "ACK:<text content>" |
| 13 | +for UDP as an echo or "ACK TCP:<text content>" for TCP. |
12 | 14 |
|
13 | | -When it receives a text packet, it will send back "ACK:<text content>" for UDP as an echo or "ACK TCP:<text content>" for TCP. |
| 15 | +There are some text commands you can send the server to affect its behavior: |
14 | 16 |
|
15 | | -If it receives the text "EXIT", then it will `sys.Exit(0)` |
| 17 | +| Command | Behavior | |
| 18 | +| ------------------- | ---------------------------------------------------------------------------------------- | |
| 19 | +| "EXIT" | Causes the game server to exit cleanly calling `os.Exit(0)` | |
| 20 | +| "UNHEATHY" | Stopping sending health checks | |
| 21 | +| "GAMESERVER" | Sends back the game server name | |
| 22 | +| "READY" | Marks the server as Ready | |
| 23 | +| "ALLOCATE" | Allocates the game server | |
| 24 | +| "RESERVE" | Reserves the game server after the specified duration | |
| 25 | +| "WATCH" | Instructs the game server to log changes to the resource | |
| 26 | +| "LABEL" | Sets the specified label on the game server resource | |
| 27 | +| "CRASH" | Causes the game server to exit / crash immediately | |
| 28 | +| "ANNOTATION" | Sets the specified annotation on the game server resource | |
| 29 | +| "PLAYER_CAPACITY" | With one argument, gets the player capacity; with two arguments sets the player capacity | |
| 30 | +| "PLAYER_CONNECT" | Connects the specified player to the game server | |
| 31 | +| "PLAYER_DISCONNECT" | Disconnects the specified player from the game server | |
| 32 | +| "PLAYER_CONNECTED" | Returns true/false depending on whether the specified player is connected | |
| 33 | +| "GET_PLAYERS" | Returns a list of the connected players | |
| 34 | +| "PLAYER_COUNT" | Returns a count of the connected players | |
| 35 | + |
| 36 | + |
| 37 | +## Configuration |
| 38 | + |
| 39 | +The server has a few configuration options that can be set via command line |
| 40 | +flags. Some can also be set using environment variables. |
| 41 | + |
| 42 | +| Flag | Environment Variable | Default | |
| 43 | +| ------------------------- | -------------------- | ------- | |
| 44 | +| port | PORT | 7654 | |
| 45 | +| passthrough | PASSTHROUGH | false | |
| 46 | +| ready | READY | true | |
| 47 | +| automaticShutdownDelayMin | _n/a_ | 0 | |
| 48 | +| readyDelaySec | _n/a_ | 0 | |
| 49 | +| udp | UDP | true | |
| 50 | +| tcp | TCP | false | |
16 | 51 |
|
17 | | -To learn how to deploy your edited version of go server to gcp, please check out this link: [Edit Your First Game Server (Go)](https://agones.dev/site/docs/getting-started/edit-first-gameserver-go/), |
18 | | -or also look at the [`Makefile`](./Makefile). |
|
0 commit comments