A multiplayer game server implementation for the Sui blockchain ecosystem.
suigserver/
├── go.mod # Go module definition
├── server/
│ ├── cmd/
│ │ ├── game/main.go # Full actor-based server (requires external deps)
│ │ └── simple/main.go # Simple server (no external deps)
│ ├── configs/ # Configuration management
│ ├── internal/
│ │ ├── actor/ # Actor system implementation
│ │ │ ├── messages/ # Message definitions
│ │ │ ├── room_actor.go # Room management
│ │ │ ├── room_manager_actor.go
│ │ │ ├── session_actor.go # Player session handling
│ │ │ └── world_manager_actor.go
│ │ ├── game/ # Game logic
│ │ ├── model/ # Data models
│ │ ├── network/ # Network layer
│ │ ├── simple/ # Simple server implementation
│ │ └── sui/ # Sui blockchain integration
├── contracts/ # Move smart contracts
│ ├── combat_system/
│ ├── game_world/
│ ├── guild_system/
│ ├── items_system/
│ ├── marketplace_system/
│ └── player_system/
└── docs/ # Documentation
- Simple Server: Basic TCP server with room-based chat
- Actor-based Server: Advanced server using actor model (requires dependencies)
- Smart Contracts: Sui Move contracts for game systems
- Player Management: Basic authentication and session handling
- Room System: Join/leave rooms and chat functionality
- Configuration Management: JSON-based configuration
- Sui blockchain integration
- NFT-based player items
- Combat system
- Guild system
- Marketplace
- Player progression
The simple server requires no external dependencies and can be built immediately:
# Build the simple server
go build -o bin/simple-server.exe server/cmd/simple/main.go
# Run the server
./bin/simple-server.exe -port 8080
The full server uses the Proto.Actor framework but requires external dependencies:
# Install dependencies (requires internet connection)
go mod tidy
# Build the full server
go build -o bin/game-server.exe server/cmd/game/main.go
# Run the server
./bin/game-server.exe
The simple server uses command-line flags:
-port
: Port to run the server on (default: 8080)
The full server uses a JSON configuration file. An example config will be created automatically as config.json
.
Connect to the server using telnet or any TCP client:
telnet localhost 8080
Available commands:
/auth <name>
- Authenticate with a player name/join <room>
- Join a room (creates if doesn't exist)/say <message>
- Send a message to all players in the current room/quit
- Disconnect from the server
-
Start the server:
./bin/simple-server.exe -port 8080
-
Connect two clients:
# Terminal 1 telnet localhost 8080 /auth Alice /join gameroom /say Hello everyone! # Terminal 2 telnet localhost 8080 /auth Bob /join gameroom /say Hi Alice!
Build the smart contracts:
# Combat System
cd "c:\file\sui_project\gamessever\suigserver\contracts\combat_system"
sui move build --skip-fetch-latest-git-deps
Each contract directory has its own build scripts:
# For Windows
cd contracts/player_system
.\build.bat
# For Linux/Mac
cd contracts/player_system
./build.sh
sui client switch --env devnet
- Simple Server: Modify
server/internal/simple/server.go
- Full Server: Add new actors in
server/internal/actor/
- Smart Contracts: Add new Move contracts in
contracts/
- Single-threaded with goroutines for each client
- In-memory room and player management
- Basic command parsing and message routing
PlayerSessionActor
: Manages individual player connectionsRoomActor
: Manages game rooms and player interactionsRoomManagerActor
: Coordinates room creation and discoveryWorldManagerActor
: Handles global game state
- Player System: Player NFTs and character data
- Item System: Game items and equipment
- Combat System: Battle mechanics and results
- Guild System: Player organizations
- Marketplace: Trading system for game assets
If you get connection errors when building the full server:
- Use the simple server instead
- Check your internet connection
- Try using Go proxy:
go env -w GOPROXY=direct
If the port is already in use:
- Change the port:
./simple-server.exe -port 8081
- Or stop the conflicting process
- Ensure Go 1.21 or later is installed
- Run
go mod tidy
to fix module issues - Check that all import paths are correct
- Fork the repository
- Create a feature branch
- Make your changes
- Test with both simple and full servers
- Submit a pull request
See LICENSE file for details.