This repository contains a custom game engine and a sample 2D platfomer game demonstrating its features. The engine provides foundational components for building 2D games, including scene management, rendering, basic physics, input handling, and resource management.
Are you interested in learning how to build the project from scratch? Check out the JP Engine Guide!
The engine is built upon several key modules:
- Application (
app): The main entry point and core orchestrator. It manages the game loop, window creation and handling, and owns the root of the scene graph. - Scene Graph (
node,layer): The game world is structured as a tree ofNodeobjects. EachNodecan have a parent and multiple children, facilitating hierarchical transformations and event propagation (update, render). Nodes manage their own insertion/removal and recursively handle updates and rendering for their children.Layerprovides a mechanism to group nodes (e.g., separating game elements from UI) for potentially different processing or rendering passes. - Rendering (
camera,sprite_sheet_animation,tilemap,tileset,tile):Camera: Manages the viewport and view transformations, defining what part of the game world is visible.- Sprite & Animation:
SpriteSheetAnimationhandles frame-by-frame animation using texture sheets. - Tile System:
Tilemapefficiently manages and renders large grids ofTileobjects, defined within aTilesetwhich groups tiles from a single texture sheet.
- Physics (
physics,collider,circle_collider,rectangle_collider): A basic physics simulation layer (Physics) manages collision detection. It uses an abstractColliderbase class with concrete implementations likeCircleCollider(radius-based) andRectangleCollider(rectangle-based). - Input (
input): Handles keyboard input, providing functions to query the state of keys (pressed, released, held). - Resource Management (
resource_manager): Loads and manages game assets like textures, fonts, and sounds. It acts as a cache to avoid redundant disk I/O operations when assets are requested multiple times. - State Management (
fsm,state,transition): A generic Finite State Machine (FSM) implementation. It usesStateobjects (with entry, update, exit logic) andTransitionobjects (defining conditions to move between states). In the sample game, this is used for managing animations. - Utilities (
derived): Includes helper components, such asderivedfor enforcing generic type constraints.
A sample platformer-style game is included to demonstrate the engine's usage.
It covers most of essential functionalities that the engine provides, making it a perfect fit for those who like learning hands-on.
The demo game features:
- Entry Point (
main): Initializes the engine'sAppand starts the game. - Scene Setup (
default_scene,background):default_sceneconstructs the entire game level layout, including placing thebackground. - Player (
player): The controllable player character. - Camera Control (
follow_player): A component likely attached to theCameranode to make it follow the player (player). - Enemies (
mushroom,plant,plant_bullet): Different types of enemies with their specific behaviors and projectiles (plant_bullet). - Collectibles (
banana): Items the player can collect, represented as bananas. - Level Goal (
end): Represents the end-of-level trigger or object (e.g., the cup). - Game Logic (
game_manager,score_manager):GameManager: Tracks and controls the overall state of the game (e.g., playing, paused, won, lost).ScoreManager: Manages the player's score and updates the UI display.
- User Interface (
win_canvas,lose_canvas): UI screens displayed on game win or game lose conditions.
The goal of the character is to reach the "end cup" while avoiding to fall or to take damage from the various enemies along the way.



