goonserver/README.md
2025-01-13 15:12:16 +01:00

76 lines
1.4 KiB
Markdown

# 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 &
```