b3dgs/lionengine
Über uns
Java 2D Game Engine
Spiele und EmulationWhat 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
Gemessener Sternzuwachs
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- Verlauf wird gesammelt
- in 1 month
- Verlauf wird gesammelt
Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.
README.md
OriginalA Java 2D game engine: one game code base for desktop and Android, testable without a window.
Born from the Lionheart Remake project.
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.
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:
AGENTS.md— mandatory rules for agents.docs/how-the-engine-works.md— the engine in a few diagrams.docs/engine-features.md— what a game can do with the engine, area by area, and the state of each area.docs/vision.md— scope and goals.docs/requirements.md— functional and non-functional requirements.docs/architecture/overview.md— principles and boundaries.docs/architecture/modules.md— modules and their dependencies.docs/architecture/interfaces.md— public types per module and the contracts that cross modules.docs/architecture/contracts.md— cross-cutting contracts.docs/conventions.md— code conventions.docs/implementation-guide.md— how to write code that passes the quality gates.docs/testing.md— test strategy.docs/android-compatibility.md— Android/DEX verification checklist.docs/documentation.md— documentation rules.docs/roadmap.md— delivery order.docs/decisions/— architecture decisions (ADRs).docs/open-questions.md— everyTO BE DEFINEDitem, in one place.docs/change-process.md— how to modify a feature or add a module consistently.
Building the engine and games with it (people and agents):
docs/features/— one page per feature with its implementation batches, in order: the entry point for implementers.docs/game-development-guide.md— path from nothing to a small game.docs/api-index.md— find the right types by task.docs/agent-workflow.md— division of work between local and cloud agents.docs/local-agents.md— delegating work to local models: profiles, machine setup, task files, escalation, merge gate, benchmark (ADR-0053).docs/local-agent-entry.md— compact entry file of a local worker.local-agents/— owner's guide, not for agents: how to set up the machines and run the benchmark of the local models.docs/templates/LOCAL-TASK-TEMPLATE.md— task file given to a local worker.docs/templates/GAME-AGENTS-TEMPLATE.md—AGENTS.mdtemplate for a game repository.
Reference material:
docs/glossary.md— terminology.docs/traceability.md— requirement → decision → test matrix.docs/dependencies.md— every dependency with its purpose, license and Android status.docs/templates/DECISION-PACKET-TEMPLATE.md— note to fill in during a discussion, then hand to an agent to propagate the change consistently.docs/templates/FEATURE-TEMPLATE.md— template for a feature batch.docs/templates/BATCH-PROMPT-TEMPLATE.md— format of the prompt that starts a batch.scripts/check-docs.py— documentation consistency check (python3 -I scripts/check-docs.py).docs/decisions/ADR-TEMPLATE.md— template for an architecture decision.docs/logo/— the logo as vector, and its two compact marks.REVIEW_REPORT.md— full review of 2026-12-01: findings, CI metrics, proposed batches and the decisions to double-check.
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.
Ähnliche Projekte entdecken
Wird geladen…