-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #142 from einaskoi/per/bugFixes
fixed gamebraking bugs
- Loading branch information
Showing
41 changed files
with
954 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,62 @@ | ||
| # Millions | ||
| Main repository for group project in IDATT2003 - Programmering 2 | ||
| # Millions - Stock Trading Simulation | ||
|
|
||
| Millions is a JavaFX-based stock trading simulation game where players navigate a dynamic market, manage their portfolio, and progress through trading ranks from Novice to Speculator. | ||
|
|
||
| ## Features | ||
|
|
||
| - **Dynamic Market Simulation**: Stock prices fluctuate based on trends, noise, and scheduled shocks. | ||
| - **Progression System**: Gain status levels (Novice → Investor → Speculator) based on your net worth and trading activity. | ||
| - **Interactive UI**: A desktop-style interface with multiple "apps" including a Stock Market, Bank, Mail, and Settings. | ||
| - **Audio Support**: Immersive background music and sound effects that change based on game state. | ||
| - **Data Driven**: Load custom stock data from CSV files. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - **Java Development Kit (JDK) 17** or higher. | ||
| - **Maven 3.6** or higher. | ||
|
|
||
| ## Building and Running | ||
|
|
||
| ### Build the Project | ||
| To compile the project and download dependencies, run: | ||
| ```bash | ||
| mvn clean install | ||
| ``` | ||
|
|
||
| ### Run the Application | ||
| To launch the game, use the JavaFX Maven plugin: | ||
| ```bash | ||
| mvn javafx:run | ||
| ``` | ||
|
|
||
| ### Running Tests | ||
| To execute the unit test suite: | ||
| ```bash | ||
| mvn test | ||
| ``` | ||
|
|
||
| ## Project Architecture | ||
|
|
||
| The project follows a modified **Model-View-Controller (MVC)** architectural pattern: | ||
|
|
||
| - **Model**: Contains the core business logic and data structures (`Player`, `Stock`, `Exchange`, `Share`, etc.). Models are independent of controllers and views. | ||
| - **View**: Handles the visual representation using JavaFX. Components are organized into `views`, `apps`, and `components`. | ||
| - **Controller**: Orchestrates the interaction between models and views. `GameController` manages the main loop, while specific app controllers handle individual application logic. | ||
|
|
||
| ### Key Components | ||
|
|
||
| - **EventBus**: A singleton messaging system for decoupled communication between different parts of the application. | ||
| - **MarketController**: Manages stock price updates and history generation. | ||
| - **StockAppController**: Handles the trading logic, searches, and portfolio updates. | ||
| - **TimeAndWeatherController**: Manages in-game time progression and environmental effects. | ||
|
|
||
| ## Design Decisions | ||
|
|
||
| - **Precision**: Used `BigDecimal` for all financial calculations to avoid floating-point errors. | ||
| - **Thread Safety**: UI updates from background timers are wrapped in `Platform.runLater()` to ensure consistency with the JavaFX Application Thread. | ||
| - **Encapsulation**: Collections returned from models (like `Portfolio.getShares()`) are unmodifiable to prevent accidental external modification. | ||
| - **Validation**: Strict input validation in constructors ensures that objects remain in a valid state from creation. | ||
|
|
||
| ## Credits | ||
|
|
||
| Developed as a group project for **IDATT2003 - Programmering 2** at NTNU. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.