Skip to content

tool for playing Tribes (from Steve Jackson games) in Discord

Notifications You must be signed in to change notification settings

kmitcham/tribes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

377 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ›๏ธ Tribes Game - WebSocket Edition

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.

๐Ÿš€ Quick Start

Option 1: Docker (Recommended)

  1. Build the container:

    ./build-docker.sh
  2. Run the server:

    ./run-docker.sh
  3. Access the game:

Option 2: Development Mode

  1. Install dependencies:

    npm install
  2. Run the development server:

    ./run-dev.sh
  3. Access the game:

๐ŸŽฎ How to Play

  1. Open the web interface at http://localhost:8000
  2. Select your tribe from the dropdown (Bear, Flounder, Bug, etc.)
  3. Enter your player name and optional password
  4. Register/Login by clicking the "Register/Login" button
  5. Browse available commands in the left sidebar, organized by category
  6. Select a command to see its parameters and description
  7. Fill in parameters and click "Execute Command"
  8. View game data in the tabs (Population, Children, Game Status)

๏ฟฝ Network Access (Multiplayer)

To allow others on your local network to join the game:

  1. Get your network setup info:

    ./setup-network.sh
  2. 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
  3. 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
  4. Troubleshooting:

    • Test with: curl http://YOUR-IP:8000/health
    • Check firewall settings on host computer
    • Ensure all devices are connected to the same network

๏ฟฝ๐ŸŽฏ Available Commands

The game includes all original Discord commands, organized into categories:

๐Ÿ›๏ธ Admin Commands

  • join - Join a tribe
  • secrets - View secret information
  • specialize - Choose a profession
  • vote - Vote on tribal matters

๐Ÿ‘‘ Chief Commands

  • banish - Remove a player from the tribe
  • decree - Create tribal laws
  • endgame - End the current game
  • induct - Add new members
  • migrate - Move the tribe
  • startfood, startrepro, startwork - Begin game phases

โš”๏ธ Conflict Commands

  • attack - Attack other players or tribes
  • defend - Defend against attacks
  • demand - Make demands
  • faction - Create or join factions
  • run - Flee from conflict

๐ŸŽฒ General Commands

  • give - Give items to other players
  • inventory - View your possessions
  • status - View game state
  • history - View game history
  • help - Get command help

๐Ÿ‘ถ Reproduction Commands

  • romance, invite, consent, decline - Relationship management
  • babysit, children - Child care

๐Ÿ”„ Rounds Commands

  • feed - Feed yourself or others
  • ready - Mark yourself ready for next phase

๐Ÿ› ๏ธ Work Commands

  • gather, hunt, craft - Resource collection
  • guard, train - Skill development
  • idle - Rest turn

๐Ÿ”ง Architecture

WebSocket Server (websocket-server.js)

  • 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

Web Interface (tribes-interface.html)

  • 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

Docker Support

  • 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

๐Ÿ“ Project Structure

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

๐Ÿ› ๏ธ Development

Adding New Commands

  1. Create command file in appropriate commands/ subdirectory
  2. Follow Discord.js command structure with data and execute exports
  3. Server will automatically load and expose the command via WebSocket

Modifying the Interface

  • Edit tribes-interface.html for UI changes
  • Commands and parameters are dynamically generated
  • WebSocket protocol is documented in server code comments

Running Tests

npm test

๐Ÿณ Docker Management

View Logs

docker logs -f tribes-server

Stop Server

docker stop tribes-server

Restart Server

docker restart tribes-server

Remove Container

docker stop tribes-server
docker rm tribes-server

๐Ÿ”ง Configuration

Environment Variables

  • PORT - Server port (default: 8000)
  • NODE_ENV - Environment mode (development/production)

Data Persistence

Game data is stored in JSON files:

  • users.json - Player accounts
  • [tribe-name]-tribe/ - Tribe-specific game data

๐ŸŒ Network Requirements

  • Port 8000 - Main server (WebSocket + HTTP)
  • Outbound Internet - For npm package installation during build

๐Ÿ”„ Migration from Discord

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

๐Ÿ› Troubleshooting

Connection Issues

Docker Issues

  • Ensure Docker is running
  • Check available disk space
  • Try rebuilding with ./build-docker.sh

Game Data Issues

  • Check file permissions in tribe directories
  • Verify JSON file integrity
  • Check server logs for detailed errors

๐Ÿ“œ License

ISC - See original project license

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Submit a pull request

Enjoy playing Tribes in your browser! ๐ŸŽฎ

About

tool for playing Tribes (from Steve Jackson games) in Discord

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages