A high-performance 2D game engine built from scratch with Pure Java, recreating the classic mechanics of "Asteroids".
The goal of this project was not just to create a game, but to implement a vector-based physics system from scratch, studying fundamental concepts of computer graphics, linear algebra, and real-time memory management.
Unlike games built with commercial engines (Unity/Godot), all physics and rendering logic were manually implemented:
- Custom Vector Physics: Manual implementation of vectors for calculating velocity, acceleration, inertia, and angular rotation. No pre-built physics libraries were used.
- Collision Detection: Geometry-based algorithms (polygons) to detect interactions between the ship, asteroids, and projectiles.
- Active Game Loop: Utilization of JavaFX's
AnimationTimerto create a stable 60 FPS rendering loop, decoupling update logic from draw logic. - Object-Oriented Design: Extensive use of Polymorphism to manage the lifecycle of game entities (Enemies, Player, Projectiles).
- Java 21 (Core Language)
- JavaFX 21 (Graphics Rendering & Keyboard Input)
- Design Patterns: Game Loop, Component Pattern.
- Newtonian Movement: The ship possesses inertia and acceleration, simulating movement in a vacuum.
- Wrap-around Mechanics: Entities leaving one side of the screen reappear on the opposite side (modular coordinate calculation).
- Progressive Difficulty: Gradual increase in complexity over time.
- Particle System: Visual feedback for collisions and destruction.
- Java JDK 21 installed.
- IDE (IntelliJ IDEA or Eclipse) configured with JavaFX support.
- Clone the repository:
git clone https://github.com/cgmarquess/Asteroid-Game.git
- Open the project in your IDE.
- Locate the main class and configure the run configuration.
- Run the
mainmethod.
Developed by [Gabriel Marques] - [LinkedIn]
