Table of Contents
Objective: The objective of the Super Mario Bros Game Development project is to recreate the classic Super Mario Bros game leveraging modern software engineering principles. This educational tool facilitates understanding in game design and practical application of object-oriented programming.
Features:
- 2D Platform Gameplay: Faithfully reproduces the mechanics of the original Super Mario Bros including player movement, jumping, and collision handling.
- Interactive Game Objects: Features various game objects such as enemies, power-ups, and obstacles, each with distinct behaviors and interactions.
- Dynamic Game Engine: A robust engine that manages game loops, rendering, and object interactions, ensuring smooth gameplay and accurate physics.
- Modular Architecture: Designed for easy maintenance and scalability, the architecture ensures a clear separation of concerns.
- Customizable Levels: Incorporates a map system allowing for creation and modification of levels using an external editor.
Technologies Used:
- Java (openjdk-19): Offers portability, extensive libraries, and strong community support.
- IntelliJ IDEA (Ultimate Edition 2022.2.3): Utilized for its powerful development environment with advanced coding assistance and debugging tools.
- External Resources:
- Super Mario Bros Reference Manual for accurate recreation of game features.
- Map Editor for designing and implementing game levels.
Development Principles:
- Adheres to object-oriented design principles such as encapsulation, inheritance, and polymorphism, creating a flexible and reusable codebase.
- Utilizes design patterns and best practices for enhanced code readability, maintainability, and performance.
Project Impact: This project serves as a practical case study in complex game development, providing insights into both the technical aspects of game programming and the creative elements of game design. Ideal for educational purposes, it offers a platform for exploring advanced programming concepts and game development strategies.
Function: The Game Engine orchestrates the core game mechanics, including the main game loop which updates game logic and renders graphics in response to player interactions and game rules.
Relationships:
- With Game Objects: Updates game objects each frame based on game logic and player inputs, adjusting positions and states.
- With I/O Handlers: Processes inputs from I/O Handlers to modify game states and trigger actions in game objects, such as movements and attacks.
- With Game Object Managers: Utilizes these managers to dynamically create, modify, or remove game objects as dictated by gameplay needs and player actions.
- With Game Map: Interacts with the Game Map to correctly place game objects and enforce game rules related to environmental constraints.
Function: Represents all interactive entities in the game, each equipped with properties like position and behaviors like move or interact.
Relationships:
- With Game Engine: Controlled by the game engine, receiving updates on their state and interactions every game loop.
- With Game Object Managers: Managed by these managers, which handle their lifecycle events such as spawning and removal.
- With I/O Handlers: Respond directly to player inputs received via I/O handlers, affecting behavior (e.g., moving or jumping).
- With Game Map: Engage with static elements of the map, such as colliding with obstacles or navigating terrain.
Function: Specialized systems that manage specific groups of game objects, responsible for their instantiation, destruction, and state management.
Relationships:
- With Game Engine: Implement changes as directed by the game engine to update game objects according to gameplay rules.
- With Game Objects: Oversee the lifecycle of game objects, from creation to removal based on game dynamics.
- With Game Map: Use map data to strategically place or remove objects in alignment with game progression.
Function: Manage all player interactions with the game through input devices (like keyboards and mice) and facilitate the output of game state changes to the display.
Relationships:
- With Game Engine: Forward player inputs to the game engine, influencing game state adjustments.
- With Game Objects: Directly affect game objects through player commands, triggering specific actions like movements and abilities.
Function: Defines the layout and environmental boundaries of the game world, incorporating static elements like terrain, platforms, and scenery.
Relationships:
- With Game Engine: Provides a structural framework for the game engine's operations, setting physical limits and interaction rules.
- With Game Objects: Acts as the physical space where game objects exist and interact, including elements such as collision detection and navigation.
- With Game Object Managers: Informs managers about optimal object placement and removal in response to player advancement and environmental cues.
This comprehensive overview of the key components and their interactions provides a deeper understanding of the game's architecture and operational dynamics, essential for both developers and enthusiasts looking to engage with or modify the game.
- Java version: openjdk-19
- IDE: Intellij 2022.2.3 (Ultimate Edition)
- Resources:
Action | Key |
---|---|
Move Left | LEFT |
Move Right | RIGHT |
Jump | UP |
Shoot Fireballs | F |
Select in Main Menu | ESC |
Pause/Resume in Game | ESC |
- If you have the JavaLauncher.app on your device, you can run the .jar as follows: Right Click .jar -> Open with -> JavaLauncher.app(default). Otherwise proceed to the steps below to build and run the project in Intellij.
When the code is compiled and ready, you can package your application in a Java archive (JAR) to share it with other developers. A built Java archive is called an artifact.
-
From the main menu, select File | Project Structure ⌘; and click Artifacts.
-
Click + , point to JAR, and select From modules with dependencies.
-
To the right of the Main Class field, click and select the main class in the dialog that opens (for example, HelloWorld (com.example.helloworld)).
- IntelliJ IDEA creates the artifact configuration and shows its settings in the right-hand part of the Project Structure dialog.
-
Apply the changes and close the dialog.
-
From the main menu, select Build | Build Artifacts.
-
Point to the created .jar (HelloWorld:jar) and select Build.
- If you now look at the out/artifacts folder, you'll find your .jar file there.
- to be updated...
- To run a Java application packaged in a JAR, IntelliJ IDEA allows you to create a dedicated run configuration.
-
Press ⇧ ⌘ A, find and run the Edit Configurations action.
-
In the Run/Debug Configurations dialog, click + and select JAR Application.
-
Add a name for the new configuration.
-
In the Path to JAR field, click and specify the path to the JAR file on your computer.
-
Under Before launch, click +, select Build Artifacts in the dialog that opens.
- Doing this means that the JAR is built automatically every time you execute the run configuration.
-
Run configurations allow you to define how you want to run your application, with which arguments and options. You can have multiple run configurations for the same application, each with its own settings.
-
After completing the steps above you are ready to Run the Game using Intellij.