Design and Development of Monopoly Game Based on EasyX

Ziyu Zhang, Jinfang Jia, Pei YangJournal of Education and Information Technology 2023 · DOI

Abstract: The EasyX Graphics Library, which can be used for graphic algorithm simulation, computer game development and physical simulation test, etc., is a free and widely used graphic library for C and C++. Monopoly game is a multi-player board fun game, in which players allocated money at first, and then bought land, built buildings and earned rent by throwing the dice. The game result depends on the players’ capital amount. This paper introduces the design and development of monopoly game with C++ and EasyX. Through the development of the game, the purpose of learning and being familiar with the programming process of C++ language has been achieved.

Introduction

Learning C++ often involves a steep transition from simple console-based "Hello World" programs to complex, real-world applications. While modern game engines like Unity or Cocos2d-x are powerful, their complexity can overshadow fundamental programming logic for students. This project addresses this educational gap by utilizing EasyX, a lightweight graphics library for C/C++, to build a functional multi-player Monopoly game. The goal is to demonstrate how complex systems—incorporating property management, random events, and turn-based logic—can be constructed using standard Object-Oriented Programming (OOP) principles.

System Architecture

The project is developed in Visual Studio 2022 using a modular OOP approach. The architecture is divided into three primary stages: the Selection Interface, the Game Interface, and the Result Interface, managed by distinct "Table" classes (CtableA, B, and C). This decoupling allows for a clean hand-off of data, such as player count and starting capital, from the setup screen to the active game loop.

UML Class Diagram showing the object-oriented structure of the Monopoly game.

As shown in the class hierarchy, the system uses inheritance and composition to manage game entities. A base Cestate class handles general property logic, while derived classes like CsmallEst, CmidEst, and CbigEst manage specific costs and upgrade paths. The centralized Cstate class coordinates sub-classes for time tracking (Ctime), player data (Cplayer), and random number generation (Crandom).

Game Logic and Flow

The core gameplay follows a turn-based loop where players move across a 36-grid track. User interaction is managed via the ExMessage structure in EasyX, which captures mouse coordinates to trigger UI buttons or menu options.

Flowchart of the main game loop and player turn logic.

The logic flow ensures that each player's turn processes movement, property checks, and event handling sequentially. To handle multiple players occupying the same tile, the rendering system implements a specific redraw loop that checks the player count on a grid and iterates through them, ensuring no player icon is obscured when another moves.

Technical Insights

  • Coordinate Mapping: The game utilizes a custom 1200x800 coordinate system. The map is constructed using two non-filled polygons to create a track of 36 grids, simplifying the mathematics for player movement and collision detection.
  • Animation via Sleep: To create a "speeding up" visual effect for the winner selection at the end of the game, the system uses the Windows API Sleep() function, decreasing the sleep interval in each loop iteration to create smooth acceleration.
  • Economic Systems: The game features a robust economy including initial capital allocation, property purchasing, tiered rent collection, and property upgrades.

Results and Conclusion

The development resulted in a fully functional Monopoly game supporting 2–4 players with distinct color-coded icons. The game includes randomized gameplay through dice-rolling and "Hidden Events" (e.g., government subsidies or tax payments) and a time-limited win condition based on total assets.

While the current version is a robust educational tool, future work will focus on increasing the variety of hidden events, implementing a save/load system for persistence, and developing AI opponents to allow for single-player modes.

Summary updated

Abstract

The EasyX Graphics Library, which can be used for graphic algorithm simulation, computer game development and physical simulation test, etc., is a free and widely used graphic library for C and C++. Monopoly game is a multi-player board fun game, in which players allocated money at first, and then bought land, built buildings and earned rent by throwing the dice. The game result depends on the players’ capital amount. This paper introduces the design and development of monopoly game with C++ and EasyX. Through the development of the game, the purpose of learning and being familiar with the programming process of C++ language has been achieved.
BibTeX
@article{zhang2023design,
  author = {Ziyu Zhang and Jinfang Jia and Pei Yang},
  title = {{Design and Development of Monopoly Game Based on EasyX}},
  journal = {Journal of Education and Information Technology},
  year = {2023},
  doi = {10.57237/j.jeit.2023.01.001},
}
Figure