A modernized version of the Tribes Discord bot, converted to a web-based interface using WebSockets. This project transforms the original Discord-based game into a standalone web application that can be run locally or deployed via Docker.
-
Build the container:
./build-docker.sh
-
Run the server:
./run-docker.sh
-
Access the game:
- Local: http://localhost:8000
- Network: http://[YOUR-IP]:8000 (run
./setup-network.shto get your network URL) - Health Check: http://localhost:8000/health
-
Install dependencies:
npm install
-
Run the development server:
./run-dev.sh
-
Access the game:
- Game Interface: http://localhost:8000
- Health Check: http://localhost:8000/health
- Open the web interface at http://localhost:8000
- Select your tribe from the dropdown (Bear, Flounder, Bug, etc.)
- Enter your player name and optional password
- Register/Login by clicking the "Register/Login" button
- Browse available commands in the left sidebar, organized by category
- Select a command to see its parameters and description
- Fill in parameters and click "Execute Command"
- View game data in the tabs (Population, Children, Game Status)
To allow others on your local network to join the game:
-
Get your network setup info:
./setup-network.sh
-
Share the network URL with friends on the same WiFi/network:
- They visit:
http://YOUR-IP:8000(script will show the exact URL) - Each player registers with their own name
- Everyone can join the same tribes and play together
- They visit:
-
Requirements:
- All players must be on the same local network (WiFi/Ethernet)
- Firewall must allow connections on port 8000
- Server computer must keep running the tribes server
-
Troubleshooting:
- Test with:
curl http://YOUR-IP:8000/health - Check firewall settings on host computer
- Ensure all devices are connected to the same network
- Test with:
The game includes all original Discord commands, organized into categories:
join- Join a tribesecrets- View secret informationspecialize- Choose a professionvote- Vote on tribal matters
banish- Remove a player from the tribedecree- Create tribal lawsendgame- End the current gameinduct- Add new membersmigrate- Move the tribestartfood,startrepro,startwork- Begin game phases
attack- Attack other players or tribesdefend- Defend against attacksdemand- Make demandsfaction- Create or join factionsrun- Flee from conflict
give- Give items to other playersinventory- View your possessionsstatus- View game statehistory- View game historyhelp- Get command help
romance,invite,consent,decline- Relationship managementbabysit,children- Child care
feed- Feed yourself or othersready- Mark yourself ready for next phase
gather,hunt,craft- Resource collectionguard,train- Skill developmentidle- Rest turn
- Unified Command System: Dynamically loads all Discord commands and makes them available via WebSocket
- Mock Interaction Layer: Converts WebSocket messages to Discord interaction format for compatibility
- Real-time Communication: Instant updates for game state changes
- User Authentication: Basic user registration and login system
- Modern UI: Clean, responsive interface with tabbed layout
- Command Browser: Categorized command list with descriptions
- Dynamic Forms: Auto-generated parameter forms based on command definitions
- Real-time Updates: Live game data updates via WebSocket
- Error Handling: Comprehensive error messaging and connection status
- Production-Ready Container: Optimized Alpine Linux image
- Health Checks: Built-in container health monitoring
- Volume Persistence: Game data persists between container restarts
- Security: Non-root user execution
TribesAgent/
โโโ commands/ # All game commands (organized by category)
โ โโโ admin/ # Administrative commands
โ โโโ chief/ # Chief-only commands
โ โโโ conflict/ # Combat and conflict
โ โโโ general/ # General gameplay
โ โโโ reproduction/ # Romance and children
โ โโโ rounds/ # Turn-based mechanics
โ โโโ work/ # Resource gathering
โโโ libs/ # Core game logic libraries
โโโ tests/ # Unit tests
โโโ websocket-server.js # Main WebSocket server
โโโ tribes-interface.html # Web interface
โโโ Dockerfile # Container definition
โโโ build-docker.sh # Docker build script
โโโ run-docker.sh # Docker run script
โโโ run-dev.sh # Development server script
- Create command file in appropriate
commands/subdirectory - Follow Discord.js command structure with
dataandexecuteexports - Server will automatically load and expose the command via WebSocket
- Edit
tribes-interface.htmlfor UI changes - Commands and parameters are dynamically generated
- WebSocket protocol is documented in server code comments
npm testdocker logs -f tribes-serverdocker stop tribes-serverdocker restart tribes-serverdocker stop tribes-server
docker rm tribes-serverPORT- Server port (default: 8000)NODE_ENV- Environment mode (development/production)
Game data is stored in JSON files:
users.json- Player accounts[tribe-name]-tribe/- Tribe-specific game data
- Port 8000 - Main server (WebSocket + HTTP)
- Outbound Internet - For npm package installation during build
This version maintains full compatibility with the original Discord bot logic:
- All commands retain their original parameters and behavior
- Game state files are compatible between versions
- Users can migrate existing games by copying tribe data files
- Check if port 8000 is available
- Verify firewall settings
- Try accessing http://localhost:8000/health
- Ensure Docker is running
- Check available disk space
- Try rebuilding with
./build-docker.sh
- Check file permissions in tribe directories
- Verify JSON file integrity
- Check server logs for detailed errors
ISC - See original project license
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Submit a pull request
Enjoy playing Tribes in your browser! ๐ฎ