Skip to content

About

A lightweight, modular 2D game engine written from scratch in Java, designed for building retro-inspired, tile-based RPGs.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

Custom Tile-based Game Engine

Built in Java, this custom 2D tile‑based retro engine is a self‑learning project to explore how 2D engines are made. To keep it engaging, it’s developed in tandem with a Gen‑2 Pokémon–inspired game, with a long‑term goal of supporting MMORPG features.

It currently includes a tiled overworld, grid‑based physics, sprite rendering, a HUD and dialog system, zones and triggers, and an event‑driven interaction model.

preview_2d_engine

Features

  • Tiles defined via JSON with tilesets, frames, and animations
  • Grid-bound physics with cell-based collision and obstacles
  • Sprite-based rendering with states, directions, and animations
  • Event-driven interaction system (controls, text/dialog, scripted events)
  • Zones and triggers (jump zones, trigger zones, platform obstacles)
  • HUD stack with dialog text rendering and input handling
  • Simple demo launcher and NPC spawning for quick iteration

Repository layout

Run the demo (from IDE):

Note:

Quick demo snippet

Create a simple NPC with a sprite and a dialog, then spawn it into the current map.

// Instantiate a test application
GameTester tester = new GameTester();

// Create a player object with overworld map and spawning grid cell
tester.setPlayerSprite("F Allenatrice");
tester.jumpToLand("Pokecity", 9, 9);

// Create an NPC with a sprite and text interaction
GameObject npc = new GameObject();
SpriteGraphicsComponent g = new SpriteGraphicsComponent(npc);
SpriteData data = ResourcesManager.getMgr().getGameObjectGraphics("F Allenatrice");
data.initSpriteGrapComponent(g);
npc.setGraphicsComponent(g);
npc.setInteractionComponent(new InteractionComponent(npc));
npc.getInteractionComponent().addEventHandler(new TextEventHandler("Hello there!"));

// Spawn via the tester helper into a specific grid cell
tester.spawnObject(npc, 9, 10);

// Start the game loop and render
tester.startGameLoop();		
tester.setVisible(true);

About

A lightweight, modular 2D game engine written from scratch in Java, designed for building retro-inspired, tile-based RPGs.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages