From 67e08c5d1ea2fe971b862f5621cd738dc85e7350 Mon Sep 17 00:00:00 2001 From: bdnugget Date: Mon, 13 Jan 2025 15:12:16 +0100 Subject: [PATCH] Readme --- README.md | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..ead2725 --- /dev/null +++ b/README.md @@ -0,0 +1,75 @@ +# GoonServer + +The server component for GoonScape, handling multiplayer synchronization and chat. + +## Features + +- Tick-based game state synchronization +- Player movement validation +- Global chat system +- Client connection management +- Protobuf-based network protocol + +## Prerequisites + +- Go 1.23 or higher +- Protocol Buffers compiler (protoc) + +## Installation + +1. Clone the repository: +```bash +git clone https://gitea.boner.be/bdnugget/goonserver.git +cd goonserver +``` + +2. Install dependencies: +```bash +go mod tidy +``` + +3. Build and run: +```bash +go run main.go +``` + +## Configuration + +Server settings can be modified in `main.go`: +```go +const ( + port = ":6969" // Port to listen on + tickRate = 600 * time.Millisecond // Server tick rate +) +``` + +## Protocol + +The server uses Protocol Buffers for client-server communication. The protocol is defined in `actions/actions.proto`: + +- `Action`: Player actions (movement, chat) +- `ActionBatch`: Grouped actions from a player +- `ServerMessage`: Game state updates to clients +- `PlayerState`: Individual player state +- `ChatMessage`: Player chat messages + +## Development + +After modifying the protocol (`actions.proto`), regenerate the Go code: +```bash +protoc --go_out=. actions/actions.proto +``` + +## Deployment + +The server is designed to run on a single instance. For production deployment: + +1. Build the binary: +```bash +go build -o goonserver +``` + +2. Run with logging: +```bash +./goonserver > server.log 2>&1 & +```