Skip to content

A fast-paced strategy game where players build empires, trade properties, and bankrupt rivals in real-time or turn-based play. Featuring animated boards, timed auctions, power-ups, and live chat, it blends classic wealth-building gameplay with futuristic mechanics like mini-games, player progression, and themed worlds.

Notifications You must be signed in to change notification settings

HelloOjasMutreja/Broke.io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

64 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Broke.io

A modern, web-based reimagination of Monopoly! Build your empire, trade properties, and bankrupt rivals in this fast-paced strategy game featuring animated boards, timed auctions, power-ups, and live chat.

๐ŸŽฎ Features

  • ๐ŸŽฒ Animated Game Board: Beautiful, interactive Monopoly-style board with smooth animations
  • โฑ๏ธ Timed Auctions: Competitive property auctions with countdown timers
  • โšก Power-ups: Special abilities to gain advantages:
    • Double Dice: Roll with advantage
    • Rent Shield: Protection from rent payments
    • Property Swap: Force property trades
    • Banker's Boost: Get bonus money
  • ๐Ÿ’ฌ Live Chat: Real-time communication with other players
  • ๐ŸŽฎ Mini-games: Random challenges to earn extra cash:
    • Target Click
    • Memory Match
    • Quick Math
  • ๐Ÿ“Š Player Progression: Level up system with experience points
  • ๐Ÿ† Leaderboards: Compete with players worldwide
  • ๐ŸŽจ Themed Worlds: Multiple board themes:
    • Classic
    • Cyber City
    • Fantasy Realm
    • Space Station
  • ๐Ÿ‘ฅ Multiple Game Modes:
    • Solo (play against AI)
    • Friends (local multiplayer)
    • Online (play with others globally)
  • ๐ŸŽญ Customizable Tokens: Choose from 8 different player tokens

๐Ÿš€ Getting Started

Prerequisites

  • Python 3.8 or higher (for Django backend)
  • Modern web browser (Chrome, Firefox, Safari, or Edge)
  • pip (Python package manager)

Installation & Setup

  1. Clone the repository

    git clone https://github.com/HelloOjasMutreja/Broke.io.git
    cd Broke.io
  2. Install dependencies

    pip install -r requirements.txt
  3. Run database migrations

    python manage.py migrate
  4. Seed test data (Recommended)

    python manage.py seed_game_data

    This creates sample boards, games, players, and cards for testing. Test credentials:

    • Username: player1-4
    • Password: testpass123
  5. Start the Django development server

    python manage.py runserver
  6. Open your browser

    • Navigate to http://127.0.0.1:8000/
    • You can play as a guest or create an account

User Authentication

The game now includes a Django backend with user authentication:

  • Sign Up: Create a new account at /users/signup/
  • Login: Login to your account at /users/login/
  • Profile: View your profile at /users/profile/
  • Logout: Logout from the header or at /users/logout/
  • Guest Play: You can also play without creating an account

How to Play

  1. Create an Account (Optional)

    • Click Sign Up in the header
    • Choose a username and password
    • Login to save your progress
  2. Choose Your Game Mode

    • Click Solo to play against AI bots
    • Click Friends for local multiplayer
    • Click Online to play with others (coming soon)
  3. Customize Your Token

    • Click on your player token to choose from 8 different options
  4. Start Playing

    • Click Roll Dice to move around the board
    • Buy properties when you land on them
    • Pay rent when landing on opponent properties
    • Use power-ups strategically to gain advantages
  5. Win the Game

    • Bankrupt your opponents by owning properties and collecting rent
    • Build monopolies to charge higher rent
    • Use mini-games and power-ups to maximize your wealth

๐ŸŽฏ Game Rules

Basic Gameplay

  • Start with $1,500
  • Roll dice to move around the board
  • Collect $200 when passing GO
  • Buy unowned properties you land on
  • Pay rent when landing on owned properties

Properties

  • Each property has a purchase price and rent value
  • Own all properties of the same color to form a monopoly
  • Build houses and hotels to increase rent (coming soon)

Special Spaces

  • GO: Collect $200
  • Income Tax: Pay $200
  • Luxury Tax: Pay $100
  • Jail: Just visiting or in jail
  • Free Parking: Safe space
  • Community Chest: Special cards (coming soon)
  • Chance: Special cards (coming soon)

Power-ups

Purchase power-ups during your turn:

  • Double Dice ($100): Roll with advantage next turn
  • Rent Shield ($150): Protected from rent for 3 turns
  • Property Swap ($200): Force a property trade
  • Banker's Boost ($250): Receive $500 bonus

Mini-games

Randomly triggered during gameplay:

  • Complete challenges within 30 seconds
  • Earn bonus money based on your score
  • Gain experience points for leveling up

๐ŸŽจ Themes

Change the board theme from the side panel:

  • Classic: Traditional Monopoly look
  • Cyber City: Futuristic neon aesthetic
  • Fantasy Realm: Magical purple theme
  • Space Station: Dark space theme

๐Ÿ“ Project Structure

Broke.io/
โ”œโ”€โ”€ backend/              # Django project configuration
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ settings.py      # Django settings
โ”‚   โ”œโ”€โ”€ urls.py          # Main URL routing
โ”‚   โ”œโ”€โ”€ asgi.py
โ”‚   โ””โ”€โ”€ wsgi.py
โ”œโ”€โ”€ users/               # User authentication app
โ”‚   โ”œโ”€โ”€ views.py         # Authentication views
โ”‚   โ”œโ”€โ”€ urls.py          # User URL routing
โ”‚   โ”œโ”€โ”€ models.py        # User models (using Django's built-in auth)
โ”‚   โ””โ”€โ”€ migrations/      # Database migrations
โ”œโ”€โ”€ game/                # Game backend models
โ”‚   โ”œโ”€โ”€ models.py        # Core game models (Board, Game, Player, etc.)
โ”‚   โ”œโ”€โ”€ admin.py         # Django admin configuration
โ”‚   โ”œโ”€โ”€ tests.py         # Model tests
โ”‚   โ”œโ”€โ”€ migrations/      # Database migrations
โ”‚   โ””โ”€โ”€ README.md        # Game models documentation
โ”œโ”€โ”€ templates/           # Django templates
โ”‚   โ”œโ”€โ”€ base.html        # Base template for auth pages
โ”‚   โ”œโ”€โ”€ index.html       # Main game page (Django template)
โ”‚   โ””โ”€โ”€ users/           # User authentication templates
โ”‚       โ”œโ”€โ”€ login.html
โ”‚       โ”œโ”€โ”€ signup.html
โ”‚       โ””โ”€โ”€ profile.html
โ”œโ”€โ”€ css/
โ”‚   โ””โ”€โ”€ style.css        # Game styles and animations
โ”œโ”€โ”€ js/
โ”‚   โ”œโ”€โ”€ game.js          # Core game logic
โ”‚   โ”œโ”€โ”€ board.js         # Board animations
โ”‚   โ”œโ”€โ”€ auction.js       # Auction system
โ”‚   โ”œโ”€โ”€ chat.js          # Chat functionality
โ”‚   โ”œโ”€โ”€ powerups.js      # Power-up system
โ”‚   โ”œโ”€โ”€ minigames.js     # Mini-games
โ”‚   โ”œโ”€โ”€ validation.js    # Client-side form validation (NEW!)
โ”‚   โ”œโ”€โ”€ gamestate.js     # Client-side state management (NEW!)
โ”‚   โ”œโ”€โ”€ api.js           # Centralized API client (NEW!)
โ”‚   โ””โ”€โ”€ utils.js         # Common utility functions (NEW!)
โ”œโ”€โ”€ manage.py            # Django management script
โ”œโ”€โ”€ requirements.txt     # Python dependencies
โ”œโ”€โ”€ db.sqlite3           # SQLite database (created after migrations)
โ”œโ”€โ”€ GAME_SETUP.md        # Backend setup and usage guide
โ”œโ”€โ”€ JAVASCRIPT_OPTIMIZATION.md  # JavaScript optimization guide (NEW!)
โ”œโ”€โ”€ index.html           # Original standalone game (still works!)
โ””โ”€โ”€ README.md            # This file

๐ŸŽฒ Game Backend Models

The game includes a comprehensive Django backend with models for:

Core Models

  • Board: Game world grid layout with configurable dimensions and themes
  • Game: Session management with status, victory conditions, and player limits
  • Player: Player identity, stats (money, position, score, level, experience)
  • Tile: Grid spaces with terrain types, ownership, pricing, and improvements

Advanced Features

  • City: Player-built structures with levels, defense, production capacity
  • Resource: Multi-resource economy (gold, food, energy, wood, stone, etc.)
  • Turn: Turn-based gameplay with phases and action tracking
  • Action: Comprehensive action logging (buy, sell, trade, build, attack, etc.)
  • Trade: Player-to-player trading system with offer management
  • PowerUp: Special abilities and temporary bonuses

Backend Features

  • โœ… Comprehensive validation with Django validators
  • โœ… Optimized queries with strategic database indexes
  • โœ… Full admin interface for game management
  • โœ… Extensive test suite (20+ tests)
  • โœ… Flexible design supporting multiple game modes
  • โœ… JSON fields for extensible game-specific data

For detailed documentation, see:


## ๐Ÿ”ง Development

### File Structure
- **HTML**: Single-page application in `index.html`
- **CSS**: All styles in `css/style.css` with animations and responsive design
- **JavaScript**: Modular JS files for different game features

### JavaScript Architecture (Optimized)
The project uses a modern JavaScript architecture to reduce server load:

- **`validation.js`**: Client-side form validation (90% reduction in invalid submissions)
- **`gamestate.js`**: Client-side state management (50% reduction in API calls)
- **`api.js`**: Centralized API client (eliminates code duplication)
- **`utils.js`**: Common utilities (formatting, notifications, storage)

For details, see [JAVASCRIPT_OPTIMIZATION.md](JAVASCRIPT_OPTIMIZATION.md)

### Adding New Features
- **New Properties**: Edit the `propertyData` array in `js/game.js`
- **New Power-ups**: Add to `powerupDefinitions` in `js/powerups.js`
- **New Mini-games**: Add to `minigames` object in `js/minigames.js`
- **New Themes**: Add theme styles in `css/style.css`
- **New Validations**: Add to `js/validation.js` for client-side checks

## ๐ŸŽฎ Controls

- **Mouse**: Click to interact with all game elements
- **Roll Dice**: Click the "Roll Dice" button in the center
- **Buy Property**: Click property spaces or use the buy button in the modal
- **Use Power-ups**: Click power-up buttons in the side panel
- **Chat**: Type messages and press Enter or click Send
- **Theme Change**: Use the dropdown in the side panel

## ๐ŸŒŸ Tips for Success

1. **Buy properties early** to start collecting rent
2. **Form monopolies** (own all properties of one color) for maximum rent
3. **Use power-ups strategically** at critical moments
4. **Complete mini-games** for bonus income
5. **Trade properties** with other players to build monopolies
6. **Manage your money** - don't go bankrupt!

## ๐Ÿšง Coming Soon

- Online multiplayer with WebSocket
- Trading system between players
- Building houses and hotels
- Community Chest and Chance cards
- Mobile app version
- More mini-games
- Tournament mode
- Achievements and badges
- Save/load game state

## ๐Ÿ“„ License

This project is open source and available for educational purposes.

## ๐Ÿค Contributing

Contributions are welcome! Feel free to:
- Report bugs
- Suggest new features
- Submit pull requests
- Improve documentation

## ๐Ÿ‘จโ€๐Ÿ’ป Author

Created with โค๏ธ for the digital age of capitalism!

---

**Enjoy playing Broke.io!** ๐ŸŽฒ๐Ÿ’ฐ๐Ÿ†

About

A fast-paced strategy game where players build empires, trade properties, and bankrupt rivals in real-time or turn-based play. Featuring animated boards, timed auctions, power-ups, and live chat, it blends classic wealth-building gameplay with futuristic mechanics like mini-games, player progression, and themed worlds.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •