How ggreborn/cafeservergo works
CafeServerGo is a TCP game server for Café game clients. The principal workflow is a client connection, request parsing and command handling, game-state updates, and responses over the same session. Its command tree also covers player/account actions, café construction and operations, waiters, achievements, and social and cooperative gameplay. The excerpts establish server startup, client transport, database setup, and some state and simulation behavior; wiring among unsampled command handlers is shown only at the dispatcher boundary.
Main entry points: commands.go Command dispatcher · server.go TCP server · client.go Client sessions · game.go Game manager
Components 19
Server runtime
- Application entry
main.go - TCP server
internal/server/server.go - Client sessions
internal/client/client.go - Request parsing
internal/types/requests/request.go
Game commands
- Command dispatcher
internal/commands/commands.go - Player commands
internal/commands/player - Café commands
internal/commands/cafe - Café editor
internal/commands/editor - Waiter commands
internal/commands/waiters - Social and co-op
internal/commands/friends - Progress and games
internal/commands/achievements
Game state
- Game manager
internal/managers/game.go - Cafe locations
internal/managers/location.go - Cafe state
internal/models/cafe/cafe.go - Player state
internal/models/player/player.go - Customer simulation
internal/agents/customer.go
Persistence
- Game database
internal/database/database.go - Authentication
internal/database/auth.go
Other components
- Game client
Connections 19
- Game client → TCP server: opens TCP connection
- Application entry → TCP server: configures and runs
- TCP server → Game manager: creates manager
- TCP server → Game database: connects database
- TCP server → Client sessions: creates sessions
- TCP server → Command dispatcher: starts handling
- Client sessions → Request parsing: parses requests
- Command dispatcher → Player commands: dispatches
- Command dispatcher → Café commands: dispatches
- Command dispatcher → Café editor: dispatches
- Command dispatcher → Waiter commands: dispatches
- Command dispatcher → Social and co-op: dispatches
- Command dispatcher → Progress and games: dispatches
- Game manager → Game database: saves game state
- Game manager → Cafe locations: manages locations
- Cafe locations → Cafe state: holds café state
- Cafe state → Customer simulation: hosts customer activity
- Authentication → Game database: reads and updates accounts
- Client sessions → Game client: sends responses