2-D Game Engine

A simple 2-D game engine built with java

Game Gif
Technology Stack
Java
Java Swing
Java AWT

Project Overview

This project is a custom-built 2D game engine developed in Java. It provides a foundation for creating pixel-based games with real-time rendering, audio playback, and a component-based architecture. The engine leverages Java’s standard libraries for graphics, audio, and input handling, and features a custom game loop, physics, and resource management system. The engine is designed to be easy to extend and modify, and is a great starting point for anyone looking to create their own 2D game.

Key Features

  • • Custom game loop with fixed 60 FPS update rate
  • • Pixel-perfect 2D rendering using BufferedImage and BufferStrategy
  • • Component-based architecture for flexible game object management
  • • Built-in physics and collision detection system
  • • Camera system for dynamic scene rendering
  • • Audio playback using Java Sound API
  • • Resource management for images, audio, and fonts
  • • Support for PNG image assets and custom level design via images
  • • Minimal external dependencies (pure Java, no third-party libraries)
  • • Designed for extensibility and educational purposes

Technical Approach

  • • Developed entirely in Java using standard libraries (AWT, Swing, Sound API)
  • • Double-buffered rendering for smooth graphics
  • • Custom input handling for keyboard and mouse events
  • • Game objects managed via a component system for modularity
  • • Physics and collision detection implemented from scratch
  • • Level data loaded from PNG images, enabling visual level design
  • • Audio system supports playback, looping, and volume control

Results & Insights

Performance

The game engine performs well for 60 FPS, and the physics and collision detection system is working as expected. The engine is capable of handling simple 2D games.

Development Insights

I made this project because I wanted to understand how games work at the most basic level. This engine is by no means perfect and can be improved upon greatly (such as it using the cpu instead of gpu) but it tought me the basic level of how games truly work.

100%

Java