Tugas Besar 1 IF2010 Pemrograman Berorientasi Objek
A C++ implementation of a Monopoly-like board game with a graphical user interface using Raylib. This project demonstrates advanced Object-Oriented Programming concepts including design patterns, game architecture, and complex game mechanics.
- Overview
- Features
- Project Structure
- Requirements
- Installation & Setup
- Building the Project
- Running the Game
- Game Mechanics
- Architecture
- File Descriptions
- Configuration
- Game Commands
- Saving & Loading
- Contributing
- License
Nimonspoli is a digital board game implementation inspired by Monopoly, featuring:
- Turn-based gameplay with human and AI players
- Property acquisition and trading system
- Auction mechanics for contested properties
- Multiple card types with unique effects
- Dynamic game state management
- Persistent game saving and loading
Built with modern C++17 and rendered using Raylib for cross-platform compatibility.
- Multi-player Support: Play with human and computer-controlled players
- Property System: Buy, sell, and develop properties
- Auction System: Competitive bidding for properties
- Card Mechanics:
- Chance cards with random effects
- Skill cards for strategic advantages
- Special event cards (Festival, Election, etc.)
- Jail System: Get jailed, pay bail, or use free-from-jail cards
- Banking System: Loans, interest calculations, bankruptcy handling
- Object-Oriented Design: Clean separation of concerns with design patterns
- GUI Rendering: Graphical interface with Raylib library
- Game State Persistence: Save and load game progress
- Configuration Files: Externalized game settings and properties
- Transaction Logging: Track all game transactions
- Computer AI: Intelligent decision-making for AI players
nimonspoli-gui/
├── src/
│ ├── main.cpp # Game entry point
│ ├── core/ # Core game logic
│ │ ├── GameMaster/ # Main game controller
│ │ ├── GameState/ # Game state management
│ │ ├── Board/ # Board and tile management
│ │ ├── Player/ # Human player class
│ │ ├── ComputerPlayer/ # AI player implementation
│ │ ├── Property/ # Property and street management
│ │ ├── Card/ # Card system and types
│ │ ├── Bank/ # Banking and finance logic
│ │ ├── Dice/ # Dice rolling mechanism
│ │ ├── AuctionManager/ # Auction system
│ │ ├── Commands/ # Command pattern for actions
│ │ ├── Exceptions/ # Custom exception classes
│ │ └── utils/ # Utilities (Config, Logger, SaveLoad)
│ ├── views/ # GUI rendering
│ │ ├── GUIManager.hpp/cpp # Main GUI controller
│ │ ├── Window.hpp/cpp # Window management
│ │ └── screens/ # Different game screens
│ │ ├── GameScreen.hpp # Main gameplay screen
│ │ ├── MainMenuScreen.hpp # Menu screen
│ │ └── WinScreen.hpp # Victory screen
│ └── panels/ # UI panels
│ └── BoardPanel.hpp/cpp # Board display panel
│
├── lib/
│ └── raylib/ # Raylib graphics library
│ ├── include/ # Header files
│ └── lib/ # Library files
│
├── config/ # Game configuration files
│ ├── property.txt # Property definitions
│ ├── railroad.txt # Railroad specifications
│ ├── utility.txt # Utility specifications
│ ├── tax.txt # Tax tile information
│ ├── special.txt # Special tiles
│ ├── aksi.txt # Game actions
│ └── misc.txt # Miscellaneous settings
│
├── data/ # Game data & saves
│ ├── autosave_*.txt # Automatic game saves
│ └── *.txt # Manual game saves
│
├── bin/ # Compiled executable
│ └── nimonspoli # Main game binary
│
├── build/ # Object files (auto-generated)
│ └── core/ # Compiled core modules
│
├── tests/ # Test files
│ ├── test_config.cpp
│ ├── test_logger.cpp
│ └── ...
│
├── Makefile # Build configuration
├── README.md # This file
└── .gitignore # Git ignore rules
- OS: Windows, macOS, or Linux
- Compiler: GCC 7.0+ or Clang with C++17 support
- Memory: Minimum 256MB RAM
- Display: 1024x768 resolution or higher
- C++17 Standard Library
- Raylib 4.0+ (graphics library)
- Make (build tool)
g++orclang++compilermakebuild utility- Text editor or IDE (VS Code recommended)
git clone <repository-url>
cd nimonspoli-guiEnsure Raylib is properly installed in lib/raylib/:
ls -la lib/raylib/include/
ls -la lib/raylib/lib/Check that all config files exist in config/:
ls -la config/cd nimonspoli-gui
make clean
make all# Build only
make all
# Build and run
make run
# Clean build artifacts
make clean
# Full rebuild (clean + build)
make rebuild- Executable:
bin/nimonspoli - Object files:
build/(auto-generated) - Build logs: Displayed in terminal
cd nimonspoli-gui
./bin/nimonspoli- GUI window initializes
- Main menu displays with game options
- Player configuration screen
- Board renders
- Gameplay begins with first player
- Mouse: Click on UI elements to interact
- Keyboard: Enter commands and selections
- ESC: Return to menu / Exit (context-dependent)
Each player's turn consists of:
- Skill Card Distribution: Receive one skill card at turn start
- Dice Roll: Roll dice to determine movement
- Movement: Move pieces based on dice result
- Landing Action: Perform action based on landed tile type
- Turn End: Pass control to next player
- Streets: Buy, pay rent, or receive rent from others
- Railroads: Special income property
- Utilities: Income based on dice roll
- Go To Jail: Instantly sent to jail
- Free Parking: No effect (safe zone)
- Go: Collect $200 salary when passing/landing
- Luxury Tax: Pay fixed amount
- Income Tax: Pay percentage of wealth
- Chance Card Tiles: Draw random effect cards
- Auction Tiles: Trigger property auction
- Ownership: Players can own properties
- Rent Collection: Collect rent from players landing on property
- Development: Properties generate income based on development level
- Trading: Players can negotiate trades
- Mortgaging: Temporarily lease property for cash
- Chance Cards: Random positive/negative effects
- Skill Cards: Strategic advantage cards
- Event Cards:
- Birthday Card: Collect from all players
- Election Card: Potentially higher income
- Festival Card: Boost property income
- Doctor Fee: Medical expense
- Demolition Card: Reduce property value
- And many more...
- Triggered when property is not purchased
- All players can bid
- Highest bidder wins and buys at bid price
- Player who triggered doesn't participate initially
- Players go bankrupt when unable to pay debts
- Eliminated from game
- Last remaining player wins
- Getting Jailed: Land on "Go to Jail" tile
- Release Methods:
- Pay $50 bail
- Use "Free from Jail" card
- Roll doubles (automatic release)
- Pay after 3 turns (automatic release)
BoardFactory: Creates board with all tilesPropertyFactory: Creates property instancesCardFactory: Creates card instancesDeckFactory: Creates card decks
Commandbase class- Specific commands:
BeliCommand,BankruptCommand, etc. - Enables undo/redo and transaction logging
GameStatenotifies players of state changes- Screens observe game state updates
ComputerPlayer: AI decision strategy- Different difficulty levels
Bank: Single instance managing all financesBoard: Single board instance
Main controller orchestrating all game logic:
- Manages turn order
- Processes commands
- Handles player movement
- Manages win conditions
Maintains complete game state:
- Player list and order
- Board state
- Current phase (TURN_START, ROLLING, etc.)
- Game status (RUNNING, GAME_OVER)
Represents game participants:
- Money and assets
- Position on board
- Jail status
- Owned properties
- Card hand
Board representation:
- 40 tiles in standard Monopoly layout
- Tile types: Property, Special, Action
- Tile functionality and effects
Financial management:
- Player accounts
- Transaction processing
- Loan management
- Bankruptcy handling
Handles auction mechanics:
- Bid collection
- Winner determination
- Property transfer
| File | Purpose |
|---|---|
GameMaster.cpp/.hpp |
Main game controller and turn manager |
GameState.cpp/.hpp |
Game state and phase management |
Board.cpp/.hpp |
Board layout and tile management |
Player.cpp/.hpp |
Human player implementation |
ComputerPlayer.cpp/.hpp |
AI player with strategy |
Bank.cpp/.hpp |
Financial transactions and accounts |
Dice.cpp/.hpp |
Dice rolling with random generation |
| File | Purpose |
|---|---|
Property.cpp/.hpp |
Base property class |
StreetProperty.cpp/.hpp |
Street properties |
RailroadProperty.cpp/.hpp |
Railroad properties |
UtilityProperty.cpp/.hpp |
Utility properties |
| File | Purpose |
|---|---|
Card.cpp/.hpp |
Base card class |
ChanceCard.cpp/.hpp |
Random chance effects |
SkillCard.cpp/.hpp |
Strategic skill cards |
BirthdayCard.cpp/.hpp |
Birthday event card |
ElectionCard.cpp/.hpp |
Election event card |
FestivalCard.cpp/.hpp |
Festival event card |
| (and many more) | Other specialized cards |
| File | Purpose |
|---|---|
ConfigLoader.cpp/.hpp |
Load settings from config files |
TransactionLogger.cpp/.hpp |
Log all game transactions |
SaveLoadManager.cpp/.hpp |
Save/load game state |
BoardFactory.cpp/.hpp |
Create board and tiles |
PropertyFactory.cpp/.hpp |
Create property instances |
| File | Purpose |
|---|---|
main.cpp |
Application entry point |
GUIManager.cpp/.hpp |
Main GUI coordinator |
Window.cpp/.hpp |
Window management |
GameScreen.cpp/.hpp |
Main gameplay screen |
MainMenuScreen.cpp/.hpp |
Menu interface |
WinScreen.cpp/.hpp |
Victory screen |
BoardPanel.cpp/.hpp |
Board visualization |
config/
├── property.txt # Define properties and streets
├── railroad.txt # Define railroad properties
├── utility.txt # Define utility properties
├── tax.txt # Define tax tiles
├── special.txt # Define special tiles
├── aksi.txt # Define game actions
└── misc.txt # Miscellaneous settings
Street Name | Price | Color | House Cost | Hotel Cost
Main Street | 100 | RED | 50 | 200
Utility Name | Price
Water Works | 150
Electric | 150
Tile Name | Type | Effect
Free Parking | SAFE | NO_EFFECT
Go To Jail | DANGER | SEND_TO_JAIL
Commands are processed through the command-line interface or GUI:
- Roll Dice:
roll- Roll dice for turn - Buy Property:
buy- Purchase landed property - Pay Rent:
pay- Pay rent to property owner (automatic) - Auction:
auction- Participate in property auction - End Turn:
endturn- End current turn - Save Game:
save <filename>- Save current game - Load Game:
load <filename>- Load saved game - View Hand:
hand- Display card hand - Play Card:
playcard <index>- Play specific card
- New Game:
newgame- Start fresh game - Quit Game:
quit- Exit application - Help:
help- Display command list
- Game auto-saves at end of each turn
- Saves to:
data/autosave_YYYYMMDD_HHMMSS.txt - Maximum of 5 auto-saves retained
./bin/nimonspoli
> save mygame.txtSaves to: data/mygame.txt
./bin/nimonspoli
> load mygame.txt- JSON-based game state representation
- Includes: Player data, board state, card hands, transactions
- Version-compatible for future updates
- Follow C++17 standards
- Use meaningful variable and function names
- Add comments for complex logic
- Maintain separation of concerns
- Test thoroughly before committing
- Indentation: 4 spaces
- Naming:
camelCasefor variables,PascalCasefor classes - Const correctness
- RAII principles
# Run unit tests
cd tests
g++ -std=c++17 test_*.cpp -o test_runner
./test_runner- Create feature branch:
git checkout -b feature/feature-name - Make changes and test
- Commit with clear messages:
git commit -m "Add feature description" - Push branch:
git push origin feature/feature-name - Submit pull request
This project is submitted as part of the IF2010 Object-Oriented Programming Course at Institut Teknologi Bandung (ITB).
Developed as a major assignment (Tugas Besar 1) for the Object-Oriented Programming course.
- Course: IF2010 Pemrograman Berorientasi Objek
- Institution: Institut Teknologi Bandung
- Documentation: See inline code comments and git commit history
Last Updated: April 2026
Version: 1.0