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
- Clone the repository:
git clone https://gitea.boner.be/bdnugget/goonserver.git
cd goonserver
- Install dependencies:
go mod tidy
- Build and run:
go run main.go
Configuration
Server settings can be modified in main.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 playerServerMessage
: Game state updates to clientsPlayerState
: Individual player stateChatMessage
: Player chat messages
Development
After modifying the protocol (actions.proto
), regenerate the Go code:
protoc --go_out=. actions/actions.proto
Deployment
The server is designed to run on a single instance. For production deployment:
- Build the binary:
go build -o goonserver
- Run with logging:
./goonserver > server.log 2>&1 &
Languages
Go
100%