$ show AlmasB/FXGL
FXGL is a JavaFX game development framework that provides a comprehensive set of tools for building 2D (and limited 3D) games. It implements an entity-component system as its core architecture, complemented by dedicated systems for physics (embedded Box2D port), animation, particles, pathfinding (A*, DFS, maze/dungeon generation), UI, input handling, networking (TCP/UDP), localization, save/load, and dialogue editing. The framework exposes a fluent DSL (FXGL facade) for rapid game prototyping, along with a developer console and profiler. Major entry points include the GameApplication abstract class, the FXGL static API, EntityBuilder for entity creation, and AnimationBuilder for animations. Externally, it relies on JavaFX for rendering, Kotlin for DSL syntax, SDL2 for native controller input, and (via the intelligence module) headless browser or MediaPipe WebSocket servers for speech/gesture recognition. The codebase is modular across Maven submodules (fxgl-core, fxgl-scene, fxgl-io, fxgl-tools, etc.) and includes extensive sample applications demonstrating each feature. While most core systems are production‑ready, some areas (e.g., GLImageView, ForeignFunctionCaller) are explicitly marked as work‑in‑progress, and a few components like DFSPathfinder have incomplete implementations.
The LLM identified 6 files worth highlighting for reuse:
A generic, resizable array derived from libGDX, optimized for game workloads. Supports ordered and unordered modes, provides efficient swap-and-pop removal, and caches iterators to reduce GC pressure. Self–contained and directly reusable in any game or real‑time system requiring low‑overhead collections.
High‑performance 2D vector class using floats, with methods for dot product, cross product, normalization, rotation, and interpolation. Uses method chaining and avoids unnecessary allocations. Can be extracted as a standalone math utility for any graphics or physics project.
Fluent DSL for constructing sequenced, parallel, or single animations on JavaFX nodes (translate, fade, scale, rotate). Supports chaining, delays, interpolators, and repeat policies. The builder pattern is isolated and reusable; it demonstrates a clean abstraction over JavaFX timeline internals.
Configurable particle emitter that accepts functional interfaces (Supplier<Point2D> for spawn position, Consumer<Particle> for per‑particle control, Function<Integer, Duration> for emission interval) enabling highly customizable particle effects. The emitter manages a pool of Poolable particles and can be extracted to power particle systems in any JavaFX or similar 2D rendering engine.
A* pathfinding implementation over a generic AStarGrid, using distance heuristics (Manhattan, Diagonal, etc.) and reconstructing paths. Stand‑alone and dependency‑free apart from the grid abstraction. Demonstrates a clean separation of heuristic, grid logic, and path calculation that can be reused in tile‑based or grid‑based navigation systems.
Hierarchical finite state machine implementation supporting nested states, concurrent states, and lifecycle callbacks (onEntry/onExit). Built on a generic State interface and fully tested. The FSM is decoupled from the rest of FXGL and can be extracted for use in any game or simulation that requires robust state management.