Skip to content
프로젝트

소개

Java 2D Game Engine

게임 및 에뮬레이션

이 수치를 측정하는 방법

What you can do

  • Game loop and scenes - Fixed-step loop, pause, slow motion, background loading with progress; scenes, overlays (pause menu) and a declared scene flow
  • Rendering - A logical resolution scaled to any window (fit, whole multiples, stretch), layers and views, windowed, borderless and exclusive full screen, output filters (smooth, pixel-art scaler, CRT, custom and libretro shaders)
  • Images and sprites - PNG and GIF everywhere (JPEG, BMP, WebP per platform), sprite sheets from JSON, tint, fade, flash, team colors, animations, bitmap text, parallax backgrounds, screen flash and fade
  • Audio - Short sounds on voices with priorities, random variants, streamed music and playlists, volume groups with fades; WAV and OGG Vorbis on desktop and Android

측정된 스타 증가

in 24h
0
in 7 days
+1
in 15 days
기록 수집 중
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

LionEngine

A Java 2D game engine: one game code base for desktop and Android, testable without a window.

Born from the Lionheart Remake project.

Build Dev License


LionEngine is a library, not an editor: you write a game in Java against small engine contracts, and the engine runs it in a desktop window (Java AWT, or OpenGL through LWJGL), on Android (OpenGL ES 2.0, from API 26) or headless in a test. Version 11 is a rewrite, developed on the branch rewrite/v11; the previous engine line stays on master.

Fox Hop, the platform game of the showcase Star Moth, the shooter of the showcase Pearl Puff, the maze chase of the showcase Neon Rally, the ball game of the showcase

The four games of lionengine-showcase, written on the public API of the engine (screenshots of the AWT platform).

Why LionEngine

  • Same game everywhere. The game talks to engine contracts only; windows, renderers, input devices and audio outputs are plug-in modules. The examples run one scene unchanged on AWT, LWJGL and Android.
  • Deterministic by design. A fixed-step simulation (60 updates per second by default) drawn with interpolation, a seeded random generator, and the same results at 30, 60 or 120 updates per second.
  • Testable without hardware. A headless platform, a recording renderer, a fake audio backend and a controllable clock: a whole game runs in a unit test.
  • Predictable cost. No reflection, no hidden thread, no allocation on the per-frame paths; 1,000 objects with four behaviors step in about 30 µs on the CI runner.
  • Documented for people and for AI agents. Every public type has Javadoc, every capability has a compiled example, and the API index tells which type solves which task.

Features

Area What a game gets
Game loop and scenes Fixed-step loop, pause, slow motion, background loading with progress; scenes, overlays (pause menu) and a declared scene flow
Rendering A logical resolution scaled to any window (fit, whole multiples, stretch), layers and views, windowed, borderless and exclusive full screen, output filters (smooth, pixel-art scaler, CRT, custom and libretro shaders)
Images and sprites PNG and GIF everywhere (JPEG, BMP, WebP per platform), sprite sheets from JSON, tint, fade, flash, team colors, animations, bitmap text, parallax backgrounds, screen flash and fade
Audio Short sounds on voices with priorities, random variants, streamed music and playlists, volume groups with fades; WAV and OGG Vorbis on desktop and Android
Objects Objects with composable traits and ordered systems, queries, objects described in JSON; ready-made movement, gravity, jump (coyote time, jump buffer), collision with layers and triggers, lifetime
Tile maps and camera Tiled maps (JSON) with object layers, auto-tiling, destroyable and one-way tiles, tile collision; a camera that follows, zooms, shakes and stays inside the level
Input Actions bound to keys, mouse, touch and gamepads, rebinding, several local players, recording and replay
Network A server as the reference with client prediction and interpolation, player list and chat, local discovery, a simulated bad link for tests
Extras A distance-map path finder, four small complete games in lionengine-showcase

The detail, area by area, with what works today: docs/engine-features.md. How it works, in a few diagrams: docs/how-the-engine-works.md.

Quick start

Requirements: JDK 25 or later and Maven 3.9 (the build refuses an older JDK); Python 3 for the checks.

git clone -b rewrite/v11 https://github.com/b3dgs/lionengine.git
cd lionengine && mvn -B -q install -DskipTests

Play a showcase game (Neon Rally, a two-paddle ball game; Pearl Puff, a maze chase in a coral reef; Fox Hop, a platform game in a meadow; Star Moth, a shooter in a nebula):

mvn -B -q -pl lionengine-showcase exec:java -Dexec.mainClass=com.b3dgs.lionengine.showcase.meadow.FoxHop

The other games are com.b3dgs.lionengine.showcase.rally.NeonRally, com.b3dgs.lionengine.showcase.reef.PearlPuff and com.b3dgs.lionengine.showcase.nebula.StarMoth. Each one opens in an AWT window; add -Dexec.args=--lwjgl for the OpenGL window of the LWJGL platform, with gamepads (set MAVEN_OPTS="--enable-native-access=ALL-UNNAMED --sun-misc-unsafe-memory-access=allow" to silence the JDK warnings of the native libraries; on macOS that platform needs -XstartOnFirstThread, so launch it from an IDE; it is unverified on macOS, as are physical gamepads there). Both platforms offer a CRT setting in the menus. On Android, the application android/showcase runs the four games from the same code, played by touch or with gamepads (docs/android-compatibility.md for the build).

A game in a desktop window is a platform, a renderer, scenes and a loop (from the compiled example MovingRectangleDesktop):

final AwtPlatform platform = new AwtPlatform(320, 240,
                                             new DisplayRequest(ScreenMode.WINDOWED, null, null, ScalingPolicy.FIT,
                                                                Collections.emptyList()),
                                             log.getSink());
final AwtRenderBackend backend = new AwtRenderBackend(platform);
platform.attach(backend);

Next steps: the path from nothing to a small game in docs/game-development-guide.md, the type for each task in docs/api-index.md, and one runnable example per capability in lionengine-examples.

Modules

Thirty-five Maven modules (lionengine-<name>), plus the Android library modules built by Gradle in android/. A game depends only on what it uses.

Group Modules Role
Foundation core, runtime, resources Units, data files, logging, random; game loop and scenes; file access by key
Contracts platform-api, render-api, audio-api, input-api What a platform, a renderer, an audio output and an input device must provide
Media graphics, audio-mixer, audio-codec-ogg, render-libretro Images, sprites, animations, text; software mixer; OGG Vorbis; libretro shader files
World ecs, traits, physics, tilemap, camera, pathfinding, composition (planned) Objects and behaviors, collision, tile maps, camera, path finding
Online network, multiplayer Transport, sessions and messages; world replication and prediction
Resource providers resources-file, resources-memory, resources-archive (planned) Folders, memory, ZIP archives
Desktop platform-awt, render-awt, input-awt, platform-lwjgl, render-opengl, input-glfw, input-sdl, audio-javasound, graphics-imageio AWT window and renderer; GLFW window drawn with OpenGL; SDL3 gamepads; Java Sound
Android (android/) platform-android, resources-android, graphics-android, input-android, audio-android (with the shared render-opengl) Activity, assets, image decoding, touch and gamepads, AudioTrack
Tests and samples test-support, examples, showcase Headless platform and recording renderer; one example per capability; four small games

Boundaries and allowed dependencies: docs/architecture/modules.md, checked by scripts/check-modules.py.

Building and checking

Goal Command
Build, checkstyle, tests, Javadoc mvn -B verify
One module and what it needs mvn -B -pl lionengine-<module> -am verify
With the tests that open windows mvn -B verify -Pplatform-tests (Linux without a display: xvfb-run -a mvn -B verify -Pplatform-tests)
Benchmarks with their time budgets mvn -B -pl lionengine-traits,lionengine-tilemap -am verify -Pbenchmark
Structural checks python3 -I scripts/check-modules.py, python3 -I scripts/check-api-index.py (after the build), python3 -I scripts/check-provenance.py, python3 -I scripts/check-docs.py
Android/DEX verification docs/android-compatibility.md, section "Android verification job"

Every command and quality gate: docs/implementation-guide.md.

Project state

Version 11 is in development. Every pull request is built and tested on Linux, Windows and macOS, and verified on an Android API 26 emulator. The game loop, scenes, images and sprites, audio, objects and behaviors, tile maps, the camera, input, and network play are available on the desktop; Android runs the same code with rendering, assets, input and sound, the showcase games included (android/showcase); its frame-time measure on a reference phone is still to be run. What is done and what comes next, batch by batch: docs/features/README.md and docs/roadmap.md. Open points: docs/open-questions.md.

Contributing

Every branch starts from rewrite/v11 and every pull request targets it. Read AGENTS.md (the rules, for people and AI agents alike), CONTRIBUTING.md and docs/change-process.md first. Most of the engine is written by AI agents under these rules, in small reviewed batches (docs/agent-workflow.md).

Documentation

The document index: AGENTS.md section 1 refers to this list.

Reading order:

  1. AGENTS.md — mandatory rules for agents.
  2. docs/how-the-engine-works.md — the engine in a few diagrams.
  3. docs/engine-features.md — what a game can do with the engine, area by area, and the state of each area.
  4. docs/vision.md — scope and goals.
  5. docs/requirements.md — functional and non-functional requirements.
  6. docs/architecture/overview.md — principles and boundaries.
  7. docs/architecture/modules.md — modules and their dependencies.
  8. docs/architecture/interfaces.md — public types per module and the contracts that cross modules.
  9. docs/architecture/contracts.md — cross-cutting contracts.
  10. docs/conventions.md — code conventions.
  11. docs/implementation-guide.md — how to write code that passes the quality gates.
  12. docs/testing.md — test strategy.
  13. docs/android-compatibility.md — Android/DEX verification checklist.
  14. docs/documentation.md — documentation rules.
  15. docs/roadmap.md — delivery order.
  16. docs/decisions/ — architecture decisions (ADRs).
  17. docs/open-questions.md — every TO BE DEFINED item, in one place.
  18. docs/change-process.md — how to modify a feature or add a module consistently.

Building the engine and games with it (people and agents):

Reference material:

Statuses used in the documents

  • VALIDATED: approved decision, binding.
  • PROPOSED: suggested direction, open for discussion.
  • TO BE DEFINED: missing information; do not guess it. Tracked in docs/open-questions.md.
  • OUT OF SCOPE: not planned for the version concerned.

ADRs use their own lifecycle (PROPOSED, ACCEPTED, REJECTED, SUPERSEDED); ACCEPTED means the same thing as VALIDATED. Every ADR of docs/decisions/ is ACCEPTED today; the index and the supersession map are in docs/decisions/README.md.

In case of contradiction, a VALIDATED decision prevails over a proposal. If two validated documents contradict each other, stop the work concerned and ask for clarification. Never silently turn a proposal into a decision.

License

See LICENSE.

관련 프로젝트 살펴보기

불러오는 중…