| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
server for minimalistic RTS game
server is linux only, can only be compiled for linux and will only run on linux
Configure project:
mkdir build cd build cmake ..
Once configuration is successful build project with avaliable tool for example
make
Project can also be built with zig
zig build
zig c++ compiler produces much smaller executable
Command above will target the native system. If you are on other system than linux, then you can cross compile mini-RTS-server to linux (since server is linux only).
zig build -Dtarget=x86_64-linux
You can replace x86_64 with your cpu architecture if you happen to have a different one.
You will find the executable in zig-out/bin/ directory.
./mini-rts-server <port> [config file]
[config file] can adjust game rules. [config file] consists of name value pairs.
millis 3000
maxPlayers 2
unitsToWin 2
startResources 8
boardX 5
boardY 5
resourceHp 20
unitHp 20
unitDamage 5
maxResourceSpawn 2
resourceChance 0.2Pair can appear in any order. If pair not listed default value will be used.
Communication happens via TCP protocol. Messages are separated by \n character. Each message must start with one byte that designates the type of the message. Some messages consist of only type character others contain more data.
Board state update is sent to every player that joins the game room
Structure as follows:
p <amount of players> ;
<player 1 name> <amount of units of player1> ,
<id> <x posion> <y position> <hp> ,
...
<id> <x posion> <y position> <hp> , ;
...
<player N name> <amount of units of playerN> ,
<id> <x posion> <y position> <hp> ,
...
<id> <x posion> <y position> <hp> , ; \n
...
...
r <amount of fields with resource> ;
<x posion> <y position> <hp> ;
<x posion> <y position> <hp> ; \n
...
Numbers are represented as strings of characters (97 ---> "97" not 'a').
1: server sends c
2: client sends n
3: if server responds n => go to step 2
3: else server responds y
4: if client sends n => go to step 3
4: else client sends j
5: if server responds q => wait until server sends p, then r
5: else server reponds p, then r
6: server can send multiple: j l m a d u f messages
6: client can send multiple: m a d messages
6: if client sends q => go to step 4
6: if server sends W or L => go to step 4
6: if server sends l with client's name => go to step 4
7: server sends t => go to step 6
feel free to write your own clients
| Back | FazBrowse Home | New Git URL |