Main Module
The Main module serves as the entry point for the Property Tycoon game application. It initializes the core game environment, manages the main application loop, orchestrates transitions between different game states (like menus, gameplay, and end screens), and handles the overall flow of the application from startup to shutdown.
The Main module is responsible for:
Initializing Pygame, sound, fonts, and logging.
Displaying introductory logo screens (show_company_logo, show_logo_screen).
Managing the main menu and navigation between different UI pages (Settings, How To Play, Start Game configuration) within the main async def main() loop.
Gathering game configuration (players, AI settings, game mode) through interaction with UI pages like StartPage, AIDifficultyPage, and GameModePage.
Creating the core Game object and Player objects via the create_game function.
Running the main game loop via the async def run_game() function, which utilizes GameRenderer, GameEventHandler, and GameActions.
Handling the end-game sequence via the async def handle_end_game() function, displaying results using EndGamePage.
Managing window resizing and applying settings via async def apply_screen_settings().
Ensuring safe application shutdown via safe_exit().
High-Level Design
Use Case Diagram
Main Module Use Cases
Domain Model
Main Module Core Classes
State Diagram
Main Application States
Detailed Design
Class Interaction Diagram (Main Orchestration)
Main Orchestration
Logging Setup Class Diagram
Illustrates the custom LogRedirector used to pipe stdout/stderr to the logging framework.
Logging Setup
Sequence Diagram: Game Initialization
This diagram shows the sequence of calls from starting the application (main()) through creating the game instance.
Game Initialization
Sequence Diagram: Game Configuration Flow
Details the user interactions within the main() loop to configure and start a new game.
Game Configuration Flow
Sequence Diagram: Main Game Loop (Simplified)
This diagram shows a simplified overview of the main run_game loop, highlighting event handling, rendering, and AI turn processing.
Main Game Loop
Sequence Diagram: Safe Shutdown
Illustrates the steps performed when the application exits via safe_exit().
Safe Shutdown