just_game_engine 1.5.3 copy "just_game_engine: ^1.5.3" to clipboard
just_game_engine: ^1.5.3 copied to clipboard

A feature-rich 2D game engine for Flutter with ECS, physics, audio, tilemaps, particles, animation, and input systems for building cross-platform games.

Just Game Engine #

A comprehensive 2D game engine built for Flutter, providing everything you need to create high-performance games with rich visual effects, animations, and physics.

๐Ÿ“š Documentation #

Screenshots #

Animation Particles Physics Sprites Tiled Maps

Features #

Just Game Engine is a complete game development framework with 20+ major subsystems:

๐ŸŽฎ Core Engine #

  • Game Loop: Fixed timestep (60 UPS) with variable rendering for consistent gameplay
  • State Management: Full lifecycle management (initialize, start, pause, resume, stop)
  • Time Management: Delta time, time scaling, FPS tracking
  • System Coordination: Centralized management of all subsystems

๐ŸŽจ Rendering Engine #

  • 2D Canvas-Based Rendering: High-performance drawing with Flutter's Canvas API
  • Renderable Objects: Circles, rectangles, lines, text, and custom renderables
  • Ray Renderable: RayRenderable draws a glowing beam / laser / bullet trail with a two-layer glow effect and configurable fade lifetime
  • Camera System: Pan, zoom, and rotation with smooth transforms
  • Layer Management: Z-order sorting for proper depth rendering
  • Debug Visualization: Bounding boxes, coordinate grids, and performance metrics
  • ECS Integration: GameWidget automatically renders ECS entities via RenderSystem alongside the classic pipeline

๐Ÿ–ผ๏ธ Sprite System #

  • Image Rendering: Load and display images with easy asset management
  • Sprite Sheets: Efficiently manage multiple sprites in a single texture
  • Sprite Batching: SpriteBatch submits all sprites sharing an atlas in a single Canvas.drawAtlas() call for dramatic draw-call reduction
  • Nine-Slice Scaling: Scalable UI elements that maintain corner details
  • Flipping: Horizontal and vertical sprite flipping

โœจ Animation System #

  • Sprite Animations: Frame-based animations from sprite sheets with customizable frame rates
    • SpriteAnimation class for sprite sheet playback
    • fromSpriteSheet() factory for easy sprite animation creation
    • Independent frame count and duration per animation
    • Automatic frame calculation from sprite dimensions
  • Property Tweening: Animate position, rotation, scale, opacity, and color
  • Easing Functions: 15+ built-in easing curves (linear, quad, cubic, elastic, bounce, etc.)
  • Animation Sequences: Chain animations to play one after another
  • Animation Groups: Run multiple animations in parallel
  • Loop and Ping-Pong: Repeat animations infinitely or bounce back and forth
  • Speed Control: Adjust animation playback speed dynamically (0.1x - 5.0x)

๐Ÿ’ฅ Particle Effects #

  • Particle Emitters: Configurable emission rate, lifetime, and spawning
  • Visual Properties: Size gradients, color gradients, velocity, and gravity
  • Particle Shapes: Circles, squares, and stars
  • Built-in Presets: Explosion, fire, smoke, sparkle, rain, and snow effects
  • Custom Particles: Create your own particle systems

โš›๏ธ Physics Engine #

  • Rigid Body Dynamics: Semi-implicit Euler integration for reliable mass, drag, torque, and inertia simulation
  • Advanced Collision Shapes: Circles, Rectangles, and arbitrary complex Polygons via SAT calculation
  • True Impulse Resolution: Elastic collisions resolving linear constraints and Coulomb surface friction
  • Broad-Phase Optimization: Performant $O(n)$ Spatial Grid queries with Object Sleeping features
  • Physics Caching: Triangulation and expensive geometry processing can be reliably disk-cached

๐Ÿ”ฆ Ray Casting & Tracing #

  • Ray: 2D ray descriptor with origin, normalised direction, and max-distance; Ray.fromPoints() convenience constructor
  • RaycastColliderComponent: ECS component marking an entity as hittable โ€” configurable radius, tag, isBlocker, isReflective, and reflectivity
  • RaycastSystem: Query-only ECS system โ€” castRay() (closest hit), castRayAll() (all hits sorted nearest-first), and hasLineOfSight() for LOS checks
  • RayTracer: Multi-bounce ray tracing against reflective surfaces โ€” configurable maxBounces and minReflectivity; returns a RayTrace containing every path segment

๐ŸŒณ Scene Graph #

  • Hierarchical Structure: Parent-child node relationships
  • Transform Propagation: Automatic world-space transform calculation
  • Scene Management: Create, load, and manage multiple scenes
  • Node Queries: Find nodes by name or traverse the tree
  • Attachable Renderables: Link visual objects to scene nodes

๐Ÿ—บ๏ธ Tiled Map Support (via just_tiled) #

  • TMX / TSX Parsing: Full support for Tiled map editor files โ€” orthogonal, isometric, staggered, and hexagonal orientations
  • Tile Layers, Object Layers, Image Layers & Group Layers: Complete layer hierarchy with custom properties
  • GPU-Batched Rendering: TileMapRenderer uses Canvas.drawRawAtlas to submit all tiles in a single draw call for maximum throughput
  • Texture Atlas: TextureAtlas.fromTileMap() builds a packed atlas from any loaded TileMap
  • Animated Tiles: Per-tile animation sequences driven by the engine game loop
  • Spatial Hash Grid: SpatialHashGrid<T> enables $O(1)$ AABB, point, and radius queries against map objects
  • Encodings & Compression: CSV, Base64, and XML tile data; GZIP, Zlib, and Zstandard compression (via just_zstd)

๐Ÿงฉ Entity-Component System (ECS) #

  • Data-Oriented Architecture: Composition over inheritance for flexible entity design
  • Entity Management: Create and destroy entities with generational IDs for use-after-destroy safety
  • Component System: 34+ built-in components (Transform, Velocity, Physics, Health, RaycastCollider, Shape, UI, Audio, Tiled, Effect, Shader, Parallax, Particle, etc.)
  • System Processing: 17+ built-in systems with standardized priorities for movement, rendering, physics, input, audio, ray casting, effects, post-processing, and more
  • Query System: Find entities by component types with selective cache invalidation and integer-based hashing
  • World Management: Centralized entity and system coordination with LinkedHashSet for $O(1)$ entity removal
  • Command Buffer: Deferred entity mutations via world.commands โ€” safe to call from within system updates
  • Event Bus: Typed inter-system messaging via world.events โ€” subscribe with on<T>(), dispatch with fire()
  • Entity Prefabs: Reusable entity blueprints via EntityPrefab โ€” batch-spawn with world.instantiate()
  • Hierarchy Support: Parent-child entity relationships
  • Reactive ECS (src/reactive/): Signal-driven wrappers powered by just_signals โ€” ComponentSignal, EntitySignal, WorldSignal, ReactiveSystem, and ReactiveComponent enable surgical UI updates without polling
  • Built-in Components (34+): TransformComponent, VelocityComponent, RenderableComponent, SpriteComponent, PhysicsBodyComponent, PhysicsBodyRefComponent, RaycastColliderComponent, HealthComponent, LifetimeComponent, TagComponent, ParentComponent, ChildrenComponent, InputComponent, JoystickInputComponent, AnimationStateComponent, AudioSourceComponent, AudioPlayComponent, TileMapLayerComponent, TiledObjectComponent, UIComponent, TextComponent, ButtonComponent, LinearProgressComponent, CircularProgressComponent, EffectComponent, ShaderComponent, ParallaxComponent, ParticleEmitterComponent, CameraFollowComponent, CircleComponent, RectangleComponent, PolygonComponent, LineComponent, CapsuleComponent
  • Built-in Systems (17+): InputSystem (100), PhysicsSystem (90), PhysicsBridgeSystem (89), MovementSystem (80), AnimationSystemECS (70), EffectSystemECS (65), GameplaySystem (60), HierarchySystem (50), RenderSystem (40), PostProcessSystem (35), BoundarySystem (30), ParticleSystemECS, CameraFollowSystem, LifetimeSystem, HealthSystem, AudioSystem, RaycastSystem, TileMapRenderSystem, TiledCollisionSystem

รฐลธโ€ยท Shape Components #

  • Self-Rendering ECS Components: Five components that extend RenderableComponent and draw themselves every frame รขโ‚ฌโ€ no additional system beyond RenderSystem required

  • CircleComponent: Circle centered on the entity's transform. Properties: radius, color, filled, strokeWidth

  • RectangleComponent: Axis-aligned rectangle with optional rounded corners. Properties: width, height, color, filled, strokeWidth, cornerRadius. Convenience size getter

  • PolygonComponent: Convex or concave polygon defined by local-space vertices (List<Offset>). Properties: vertices, color, filled, strokeWidth

  • LineComponent: Straight line segment in local space. Properties: start, end, color, strokeWidth, roundCaps. Convenience length getter

  • CapsuleComponent: Rectangle with semicircular end caps (orientation auto-flips based on aspect ratio). Properties: width, height, color, filled, strokeWidth. Computed capRadius getter

๏ฟฝ Input Management #

  • Keyboard Input: Key press, hold, and release detection with axis support
  • Mouse Input: Position tracking, button states, scroll wheel, and delta movement
  • Touch Input: Multi-touch support with pressure and size tracking
  • Controller/Gamepad: Analog sticks, triggers, buttons, and D-pad support
  • Virtual Joystick: Touch-based virtual joystick widget with JoystickInputComponent ECS integration
  • Event System: Callbacks for custom input handling
  • Dead Zone: Configurable dead zones for analog inputs
  • ECS Bridge: InputSystem automatically maps InputManager state to InputComponent and JoystickInputComponent each frame
  • Integrated: Automatic event capture through GameWidget with Focus and Listener

๐ŸŽต Additional Systems #

  • Audio Engine: Complete audio playback system with multi-channel mixing

    • Multi-Channel: Master, Music, SFX, Voice, and Ambient channels with independent volume control
    • Sound Effects: Unlimited concurrent SFX via SoLoud's native voice management with automatic cleanup
    • Music: Background music with fade in/out effects and seamless looping
    • Audio Mixer: Per-channel volume control, mute/unmute, and master volume
    • Integration: Built on just_audio_engine for low-latency, game-grade audio
  • Asset Management: Efficient loading and caching of game resources

    • Image Assets: Load PNG/JPG images with memory tracking
    • Audio Assets: Load MP3/WAV/OGG/FLAC audio files as binary data
    • Text Assets: Load plain text files from asset bundle
    • JSON Assets: Load and parse JSON configuration files
    • Binary Assets: Load raw binary data for custom formats
    • Caching: Automatic asset caching with memory usage statistics
    • Asset Bundles: Group multiple assets for batch loading/unloading
  • Networking: Multiplayer and server communication (Not Implemented Yet)

๐ŸŽฌ Post-Processing #

  • Full-Screen Shader Passes: PostProcessPass wraps the rendered scene in an offscreen layer and composites it through a custom FragmentShader
  • Pass Ordering: Multiple passes chained by passOrder โ€” lower order is innermost (closest to scene), higher is outermost
  • Per-Entity Shaders: ShaderComponent(isPostProcess: false) wraps individual entities in a canvas.saveLayer with a custom shader
  • ECS Integration: PostProcessSystem (priority 35) bridges ShaderComponent entities to RenderingEngine.addPostProcessPass / removePostProcessPass each frame
  • Time Uniform: RenderingEngine.elapsedSeconds supplies a time value for animated shader effects via setUniforms callback

๐ŸŒ… Parallax Backgrounds #

  • Multi-Layer Scrolling: ParallaxBackground composites any number of ParallaxLayer instances using configurable scrollFactorX / scrollFactorY per layer
  • Auto-Scroll: Layers scroll continuously via velocityX / velocityY independent of camera movement (great for drifting clouds or rivers)
  • Tiling: Each layer can repeat seamlessly to fill the viewport (repeat: true)
  • Visual Controls: Per-layer scale, opacity, tint, and offset
  • ECS Integration: ParallaxComponent attaches a ParallaxBackground to any entity; RenderSystem renders it automatically

๐Ÿ—‚ Sprite Atlas #

  • Multi-Format Parsing: AtlasParser auto-detects TexturePacker JSON Array, JSON Hash, multi-page, and Aseprite export formats โ€” no manual selection needed
  • Named Regions: Look up any frame by name via atlas.createSprite('hero_idle_0') for one-liner sprite creation
  • Animation Clips: Define and register named AtlasAnimationClip objects; drive a Sprite through variable-duration frames via AtlasSpriteAnimation
  • Draw-Call Reduction: All sprites from the same atlas share a single GPU texture โ€” combine with SpriteBatch for maximum throughput
  • Quick Start: SpriteAtlas.fromAsset('assets/heroes.json') loads and caches the atlas through AssetManager

โœจ Deterministic Effects #

  • Multiplayer-Ready: 11 tick-based effects (MoveEffect, ScaleEffect, RotateEffect, FadeEffect, ColorTintEffect, SequenceEffect, ParallelEffect, DelayEffect, RepeatEffect, ShakeEffect, PathEffect) reproduce identically from integer ticks alone
  • Pure-Delta Contract: applyTick(ctx, prevElapsed, currElapsed) is additive โ€” two effects on the same entity stack correctly; fast-forward via applyTick(ctx, 0, N) for late-join reconnect
  • Serialization: EffectSerializer (JSON factory registry) and EffectBinaryCodec (little-endian v1 wire format) enable snapshot send over the network
  • ECS Integration: EffectSystemECS (priority 65) manages per-entity EffectPlayer queues; schedule effects via effectSystem.scheduleEffect(entity: e, effect: ...))
  • Rollback Support: EffectSnapshot captures mid-flight effect state; PredictionEffectRuntime documents the rollback API contract

๐ŸŒ Localization #

  • Engine-Wide i18n: LocalizationManager serves string lookups to all subsystems including Narrative/Dialogue
  • Namespaces: Organize strings by domain (ns: 'ui', ns: 'game') โ€” load separate JSON files per namespace and locale
  • Fallback Chain: For locale fr_CA, lookups cascade fr_CA โ†’ fr โ†’ en (configurable fallbackLocale) before returning the raw key
  • ICU-lite Templating: StringInterpolator resolves {var} substitutions, {count, plural, =0{โ€ฆ} =1{โ€ฆ} other{โ€ฆ}} plurals, and {gender, select, โ€ฆ} selects
  • Signal-Driven: LocalizationManager.localeSignal (a Signal<Locale>) lets widgets rebuild only when the locale changes
  • Flutter Widgets: LocalizationScope, LocalizationBuilder, LocalizedText, LocaleSelector, and L10nContext extension for BuildContext

๐Ÿ’ฌ Narrative / Dialogue #

  • Yarn Spinner 2.x: Full parser and runtime for .yarn script files โ€” linear dialogue, branching choices, hub-and-spoke, and cutscene patterns
  • Condition & Command Registries: Register Dart callbacks for <<if>> conditions and <<command>> blocks at runtime
  • Expression Evaluator: Handles variables, comparisons, and arithmetic in Yarn if-conditions
  • Localization Bridge: DialogueLocalizer delegates all storage and signal handling to LocalizationManager under namespace 'dialogue'
  • ECS Integration: DialogueComponent + TriggerComponent + DialogueSystem let entities own and trigger scripted dialogue
  • UI Widgets: DialogueBoxWidget and DialogueChoicesWidget for ready-made in-game dialogue UI; fully composable

๐Ÿงฎ Math Module #

  • Vec2: Mutable 2D vector type for zero-allocation hot-path physics โ€” in-place add(), sub(), addScaled(), scale(), setZero(), and Offset interop
  • Quadtree: Spatial indexing for viewport culling with configurable maxItems and maxDepth

๐Ÿ—„๏ธ Memory Management #

  • Object Pool: Generic ObjectPool<T> with configurable maxSize, acquire()/release() lifecycle, and totalAcquired/peakAvailable statistics
  • Cache Manager: Multi-tier caching via just_storage (key-value) and just_database (binary) with LRU eviction, SQL-safe key validation, and configurable maxBinaryEntries

Just Game Engine vs. Flame Engine #

Both engines are strong options for Flutter game development, but they optimize for different workflows. Just Game Engine emphasizes explicit ECS/data-oriented control and a fixed-timestep simulation core, while Flame emphasizes a component-tree workflow and a broad ecosystem.

Feature Just Game Engine Flame Engine
Architecture ECS-first with scene graph support and explicit system ordering; includes a reactive ECS layer (just_signals). Flame Component System (component tree + lifecycle) with optional ECS-style integrations via ecosystem packages.
Game Loop Built-in fixed-timestep simulation with accumulator clamping and interpolation support. Default game loop updates with frame delta (dt); fixed-step behavior is typically implemented at game/app level when needed.
Physics Built-in impulse-based 2D physics (SAT, broad-phase spatial grid, sleeping, ray queries). Core includes collision systems; full rigid-body physics is commonly done with flame_forge2d (Forge2D/Box2D lineage).
Performance Model Predictable simulation cadence from fixed updates; optimized for low-allocation hot paths and spatial partitioning. Strong production performance; behavior depends on component counts, effect usage, and whether Forge2D/extra modules are in play.
Input Handling Unified input manager with polling APIs (isKeyDown, mouse/touch/controller state) integrated each update tick. Primarily callback/mixin-driven input APIs; can also track state depending on architecture.
Ecosystem Focused engine package with sibling packages (just_tiled, just_signals, etc.) for targeted expansion. Large, mature ecosystem (audio, tiled, physics, svg, spine, rive, and more) with extensive examples/community resources.
Learning Curve Great for developers who want direct control and clear data flow through systems. Great for developers who want fast iteration with established patterns, docs, and community support.

Getting Started #

Prerequisites #

  • Flutter SDK 3.11.0 or higher
  • Dart 3.0.0 or higher

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  just_game_engine: ^1.5.3

Then run:

flutter pub get

Architecture #

Just Game Engine
โ”œโ”€โ”€ Core Engine
โ”‚   โ”œโ”€โ”€ Engine (Main orchestrator + performanceStats)
โ”‚   โ”œโ”€โ”€ GameLoop (Fixed timestep loop)
โ”‚   โ”œโ”€โ”€ TimeManager (Delta time tracking)
โ”‚   โ””โ”€โ”€ SystemManager (Subsystem coordination + frame scheduler)
โ”œโ”€โ”€ Math Module
โ”‚   โ”œโ”€โ”€ Vec2 (Mutable 2D vector for hot-path code)
โ”‚   โ””โ”€โ”€ Quadtree (Spatial indexing for culling; cached bounds)
โ”œโ”€โ”€ Memory Management
โ”‚   โ”œโ”€โ”€ ObjectPool (GC-friendly object recycling)
โ”‚   โ””โ”€โ”€ CacheManager (LRU binary caching via just_storage/just_database; memory fallback)
โ”œโ”€โ”€ Rendering Engine
โ”‚   โ”œโ”€โ”€ RenderingEngine (Canvas rendering + post-process pass stack)
โ”‚   โ”œโ”€โ”€ Camera / CameraSystem (View transformation)
โ”‚   โ”œโ”€โ”€ Renderable (Base class)
โ”‚   โ”œโ”€โ”€ SpriteBatch (Canvas.drawAtlas batching)
โ”‚   โ””โ”€โ”€ GameWidget (Flutter integration + debug HUD)
โ”œโ”€โ”€ Post-Processing
โ”‚   โ”œโ”€โ”€ PostProcessPass (Full-screen FragmentShader pass)
โ”‚   โ””โ”€โ”€ PostProcessSystem (ECS bridge; priority 35)
โ”œโ”€โ”€ Sprite System
โ”‚   โ”œโ”€โ”€ Sprite (Image rendering)
โ”‚   โ”œโ”€โ”€ SpriteSheet (Texture atlas frames)
โ”‚   โ””โ”€โ”€ NineSliceSprite (Scalable UI)
โ”œโ”€โ”€ Sprite Atlas
โ”‚   โ”œโ”€โ”€ SpriteAtlas (Named-region lookup + animation clips)
โ”‚   โ”œโ”€โ”€ AtlasParser (Auto-detect TexturePacker / Aseprite formats)
โ”‚   โ””โ”€โ”€ AtlasSpriteAnimation (Variable-duration frame animation)
โ”œโ”€โ”€ Parallax Backgrounds
โ”‚   โ”œโ”€โ”€ ParallaxBackground (Multi-layer compositor)
โ”‚   โ””โ”€โ”€ ParallaxLayer (Per-layer scroll factor + auto-scroll velocity)
โ”œโ”€โ”€ Animation System
โ”‚   โ”œโ”€โ”€ Animation (Base class)
โ”‚   โ”œโ”€โ”€ SpriteAnimation (Frame-based)
โ”‚   โ”œโ”€โ”€ TweenAnimation (Property lerp)
โ”‚   โ””โ”€โ”€ Easings (Curve functions)
โ”œโ”€โ”€ Deterministic Effects
โ”‚   โ”œโ”€โ”€ DeterministicEffect (Abstract tick-based base)
โ”‚   โ”œโ”€โ”€ Effect types (Move, Scale, Rotate, Fade, ColorTint, Sequence, Parallel, Delay, Repeat, Shake, Path)
โ”‚   โ”œโ”€โ”€ EffectSystemECS (priority 65)
โ”‚   โ”œโ”€โ”€ EffectSerializer + EffectBinaryCodec (network wire format)
โ”‚   โ””โ”€โ”€ EffectSnapshot + PredictionEffectRuntime (rollback support)
โ”œโ”€โ”€ Particle Effects
โ”‚   โ”œโ”€โ”€ ParticleEmitter (Emission control)
โ”‚   โ”œโ”€โ”€ Particle (Individual particle)
โ”‚   โ””โ”€โ”€ ParticleEffects (Presets)
โ”œโ”€โ”€ Physics Engine
โ”‚   โ”œโ”€โ”€ PhysicsEngine (Vec2-based simulation)
โ”‚   โ”œโ”€โ”€ PhysicsBody (Rigid body with Vec2 internals)
โ”‚   โ””โ”€โ”€ CollisionEvent (Typed physics event)
โ”œโ”€โ”€ Ray Casting & Tracing
โ”‚   โ”œโ”€โ”€ Ray (Origin + direction descriptor)
โ”‚   โ”œโ”€โ”€ RaycastColliderComponent (ECS hittable marker)
โ”‚   โ”œโ”€โ”€ RaycastSystem (castRay / castRayAll / hasLineOfSight)
โ”‚   โ”œโ”€โ”€ RaycastHit (Intersection result)
โ”‚   โ””โ”€โ”€ RayTracer / RayTrace (Multi-bounce reflection)
โ”œโ”€โ”€ Tiled Map Support (just_tiled)
โ”‚   โ”œโ”€โ”€ TileMapParser (async TMX/TSX parser)
โ”‚   โ”œโ”€โ”€ TileMapRenderer (GPU-batched Canvas.drawRawAtlas)
โ”‚   โ”œโ”€โ”€ TextureAtlas (Packed atlas builder)
โ”‚   โ”œโ”€โ”€ SpatialHashGrid (O(1) spatial queries)
โ”‚   โ””โ”€โ”€ TileMap / Layer / MapObject (Data model)
โ”œโ”€โ”€ Scene Graph
โ”‚   โ”œโ”€โ”€ SceneEditor (Scene management)
โ”‚   โ”œโ”€โ”€ Scene (Node container)
โ”‚   โ””โ”€โ”€ SceneNode (Transform hierarchy)
โ”œโ”€โ”€ Entity-Component System
โ”‚   โ”œโ”€โ”€ World (Entity management + CommandBuffer + EventBus)
โ”‚   โ”œโ”€โ”€ Entity (Generational IDs, component container)
โ”‚   โ”œโ”€โ”€ Component (Data storage + lifecycle callbacks)
โ”‚   โ”œโ”€โ”€ System (Priority-ordered processing logic)
โ”‚   โ”œโ”€โ”€ EntityPrefab (Reusable entity blueprints)
โ”‚   โ”œโ”€โ”€ Built-in Components (34+):
โ”‚   โ”‚   โ”œโ”€โ”€ TransformComponent, VelocityComponent
โ”‚   โ”‚   โ”œโ”€โ”€ RenderableComponent, SpriteComponent
โ”‚   โ”‚   โ”œโ”€โ”€ ShaderComponent, ParallaxComponent, ParticleEmitterComponent
โ”‚   โ”‚   โ”œโ”€โ”€ PhysicsBodyComponent, PhysicsBodyRefComponent
โ”‚   โ”‚   โ”œโ”€โ”€ HealthComponent, LifetimeComponent, TagComponent
โ”‚   โ”‚   โ”œโ”€โ”€ ParentComponent, ChildrenComponent
โ”‚   โ”‚   โ”œโ”€โ”€ InputComponent, JoystickInputComponent, CameraFollowComponent
โ”‚   โ”‚   โ”œโ”€โ”€ AnimationStateComponent, RaycastColliderComponent
โ”‚   โ”‚   โ”œโ”€โ”€ AudioSourceComponent, AudioPlayComponent
โ”‚   โ”‚   โ”œโ”€โ”€ TileMapLayerComponent, TiledObjectComponent
โ”‚   โ”‚   โ”œโ”€โ”€ EffectComponent
โ”‚   โ”‚   โ”œโ”€โ”€ CircleComponent, RectangleComponent, PolygonComponent
โ”‚   โ”‚   โ”œโ”€โ”€ LineComponent, CapsuleComponent
โ”‚   โ”‚   โ””โ”€โ”€ UIComponent, TextComponent, ButtonComponent,
โ”‚   โ”‚     LinearProgressComponent, CircularProgressComponent
โ”‚   โ””โ”€โ”€ Built-in Systems (17+):
โ”‚       โ”œโ”€โ”€ InputSystem (priority 100)
โ”‚       โ”œโ”€โ”€ PhysicsSystem (priority 90)
โ”‚       โ”œโ”€โ”€ PhysicsBridgeSystem (priority 89)
โ”‚       โ”œโ”€โ”€ MovementSystem (priority 80)
โ”‚       โ”œโ”€โ”€ AnimationSystemECS (priority 70)
โ”‚       โ”œโ”€โ”€ EffectSystemECS (priority 65)
โ”‚       โ”œโ”€โ”€ HealthSystem (priority 60)
โ”‚       โ”œโ”€โ”€ HierarchySystem (priority 50)
โ”‚       โ”œโ”€โ”€ RenderSystem (priority 40)
โ”‚       โ”œโ”€โ”€ PostProcessSystem (priority 35)
โ”‚       โ”œโ”€โ”€ BoundarySystem (priority 30)
โ”‚       โ”œโ”€โ”€ ParticleSystemECS, CameraFollowSystem
โ”‚       โ”œโ”€โ”€ AudioSystem, RaycastSystem, LifetimeSystem
โ”‚       โ””โ”€โ”€ TileMapRenderSystem, TiledCollisionSystem
โ”œโ”€โ”€ Reactive ECS
โ”‚   โ”œโ”€โ”€ ComponentSignal (Typed property signal)
โ”‚   โ”œโ”€โ”€ EntitySignal (Entity-level change tracking)
โ”‚   โ”œโ”€โ”€ WorldSignal (Global world state signals)
โ”‚   โ”œโ”€โ”€ ReactiveSystem (Dirty-only entity processing)
โ”‚   โ””โ”€โ”€ ReactiveComponent (Mixin with notifyChange)
โ”œโ”€โ”€ Input Management
โ”‚   โ”œโ”€โ”€ InputManager (Main coordinator)
โ”‚   โ”œโ”€โ”€ KeyboardInput (Key states)
โ”‚   โ”œโ”€โ”€ MouseInput (Position, buttons, scroll)
โ”‚   โ”œโ”€โ”€ TouchInput (Multi-touch)
โ”‚   โ”œโ”€โ”€ ControllerInput (Gamepad support)
โ”‚   โ””โ”€โ”€ VirtualJoystick (Touch joystick widget)
โ”œโ”€โ”€ Asset Management
โ”‚   โ”œโ”€โ”€ AssetManager (Loading & caching)
โ”‚   โ”œโ”€โ”€ ImageAsset (PNG/JPG)
โ”‚   โ”œโ”€โ”€ AudioAsset (MP3/WAV/OGG/FLAC)
โ”‚   โ”œโ”€โ”€ TextAsset (Plain text)
โ”‚   โ”œโ”€โ”€ JsonAsset (JSON config)
โ”‚   โ”œโ”€โ”€ BinaryAsset (Raw data)
โ”‚   โ””โ”€โ”€ AssetBundle (Grouped loading)
โ”œโ”€โ”€ Audio Engine
โ”‚   โ”œโ”€โ”€ AudioEngine (Multi-channel mixer)
โ”‚   โ”œโ”€โ”€ AudioClip (Playback control)
โ”‚   โ”œโ”€โ”€ SoundEffectManager (SFX)
โ”‚   โ”œโ”€โ”€ MusicManager (Background music)
โ”‚   โ””โ”€โ”€ AudioMixer (Volume control)
โ”œโ”€โ”€ Localization
โ”‚   โ”œโ”€โ”€ LocalizationManager (Namespace + fallback chain + plurals)
โ”‚   โ”œโ”€โ”€ LocaleStringTable (Per-locale flat string map)
โ”‚   โ”œโ”€โ”€ StringInterpolator ({var}, plural, select templates)
โ”‚   โ””โ”€โ”€ Flutter Widgets (LocalizationScope, LocalizedText, LocaleSelector)
โ”œโ”€โ”€ Narrative / Dialogue
โ”‚   โ”œโ”€โ”€ DialogueManager (Yarn Spinner facade)
โ”‚   โ”œโ”€โ”€ YarnTokenizer + YarnParser (Yarn Spinner 2.x)
โ”‚   โ”œโ”€โ”€ DialogueRunner (Condition + command registries)
โ”‚   โ”œโ”€โ”€ DialogueLocalizer (delegates to LocalizationManager)
โ”‚   โ”œโ”€โ”€ ECS (DialogueComponent, TriggerComponent, DialogueSystem)
โ”‚   โ””โ”€โ”€ UI (DialogueBoxWidget, DialogueChoicesWidget)
โ””โ”€โ”€ Additional Systems
    โ””โ”€โ”€ Networking (Not Implemented)

Performance Tips #

  1. Use Object Pooling: Reuse particles and projectiles instead of creating new ones
  2. Limit Renderables: Only render what's visible on screen
  3. Batch Rendering: Group similar draw calls together
  4. Profile Regularly: Use Flutter DevTools to identify bottlenecks
  5. Optimize Collision Detection: Use spatial partitioning for many objects
  6. Cache Calculations: Store frequently used values like cos/sin results

Examples #

API Reference #

Core Classes #

  • Engine - Main engine singleton
  • GameLoop - Game loop with fixed timestep
  • TimeManager - Time tracking and delta time

Rendering Classes #

  • RenderingEngine - 2D rendering system
  • Camera - Camera transformation and controls
  • Renderable - Base class for all renderables
  • CircleRenderable, RectangleRenderable, LineRenderable, TextRenderable, CustomRenderable

Animation Classes #

  • Animation - Base animation class
  • SpriteAnimation - Frame-based sprite animation
  • PositionTween, RotationTween, ScaleTween, OpacityTween, ColorTween
  • AnimationSequence - Sequential animations
  • AnimationGroup - Parallel animations
  • Easings - Easing function library

Particle Classes #

  • ParticleEmitter - Particle emission controller
  • Particle - Individual particle instance
  • ParticleEffects - Built-in effect presets

Physics Classes #

  • PhysicsEngine - Physics simulation
  • PhysicsBody - Rigid body with collision

Ray Casting & Tracing Classes #

  • Ray - 2D ray descriptor (origin, direction, maxDistance)
  • RaycastColliderComponent - ECS component marking an entity as hittable
  • RaycastHit - Intersection result (entity, point, distance, normal)
  • RaycastSystem - On-demand query system (castRay, castRayAll, hasLineOfSight)
  • RayTracer / RayTrace / RayTraceSegment - Multi-bounce reflective ray tracing
  • RayRenderable - Glowing beam/laser visual with configurable fade lifetime

Tiled Map Classes (via just_tiled) #

  • TileMapParser - Async parser for .tmx / .tsx files (CSV, Base64, XML; GZIP, Zlib, Zstd)
  • TileMap - Parsed map data model with layers, tilesets, and properties
  • TileLayer, ObjectLayer, ImageLayer, GroupLayer - Layer hierarchy
  • TileMapRenderer - GPU-batched renderer using Canvas.drawRawAtlas
  • TextureAtlas - Packed texture atlas built from a TileMap
  • SpatialHashGrid<T> - Generic $O(1)$ spatial hash for AABB, point, and radius queries
  • MapObject - Tiled object with geometry, type, and custom properties

Scene Classes #

  • SceneEditor - Scene management
  • Scene - Scene container
  • SceneNode - Hierarchical transform node

ECS Classes #

  • World - Entity and system manager
  • Entity - Component container with unique ID
  • Component - Base class for data components
  • System - Base class for processing systems
  • Built-in Components (34+): TransformComponent, VelocityComponent, RenderableComponent, SpriteComponent, ShaderComponent, ParallaxComponent, ParticleEmitterComponent, PhysicsBodyComponent, PhysicsBodyRefComponent, RaycastColliderComponent, HealthComponent, LifetimeComponent, TagComponent, ParentComponent, ChildrenComponent, InputComponent, JoystickInputComponent, CameraFollowComponent, AnimationStateComponent, AudioSourceComponent, AudioPlayComponent, TileMapLayerComponent, TiledObjectComponent, EffectComponent, UIComponent, TextComponent, ButtonComponent, LinearProgressComponent, CircularProgressComponent, CircleComponent, RectangleComponent, PolygonComponent, LineComponent, CapsuleComponent
  • Built-in Systems (17+): InputSystem, PhysicsSystem, PhysicsBridgeSystem, MovementSystem, AnimationSystemECS, EffectSystemECS, HealthSystem, HierarchySystem, RenderSystem, PostProcessSystem, BoundarySystem, ParticleSystemECS, CameraFollowSystem, RaycastSystem, LifetimeSystem, AudioSystem, TileMapRenderSystem, TiledCollisionSystem

Shape Component Classes #

  • CircleComponent โ€” Circle centered on the entity's transform; extends RenderableComponent. Properties: radius, color, filled, strokeWidth
  • RectangleComponent โ€” Axis-aligned rectangle with optional rounded corners; extends RenderableComponent. Properties: width, height, color, filled, strokeWidth, cornerRadius. size getter returns a Size
  • PolygonComponent โ€” Convex or concave polygon from local-space vertices; extends RenderableComponent. Properties: vertices, color, filled, strokeWidth
  • LineComponent โ€” Straight line segment in local space; extends RenderableComponent. Properties: start, end, color, strokeWidth, roundCaps. length getter for segment distance
  • CapsuleComponent โ€” Rectangle with semicircular end caps (orientation flips by aspect ratio); extends RenderableComponent. Properties: width, height, color, filled, strokeWidth. capRadius getter (half the shorter side)

Input Classes #

  • InputManager - Main input coordinator with keyboard, mouse, touch, and controller access
  • KeyboardInput - Key press/hold/release detection with axis support
  • MouseInput - Mouse position, buttons, scroll, and delta tracking
  • TouchInput - Multi-touch support with touch points
  • ControllerInput - Gamepad analog sticks, triggers, and buttons
  • MouseButton - Mouse button constants (left, right, middle)
  • GamepadButton - Gamepad button constants (A, B, X, Y, etc.)
  • GamepadAxis - Gamepad axis identifiers (left stick, right stick, triggers)

Asset Management Classes #

  • AssetManager - Asset loading and caching coordinator
  • Asset - Base class for all asset types
  • ImageAsset - Image asset loader (PNG/JPG)
  • AudioAsset - Audio asset loader (MP3/WAV/OGG/FLAC)
  • TextAsset - Plain text file loader
  • JsonAsset - JSON configuration file loader
  • BinaryAsset - Raw binary data loader
  • AssetBundle - Grouped asset loading/unloading

Audio Engine Classes #

  • AudioEngine - Multi-channel audio playback coordinator
  • AudioClip - Individual audio source controller
  • SoundEffectManager - Sound effect playback wrapper
  • MusicManager - Background music control with fade effects
  • AudioMixer - Volume and mute control interface
  • AudioChannel - Audio channel enum (master, music, sfx, voice, ambient)
  • AudioState - Playback state enum (stopped, playing, paused)

Post-Processing Classes #

  • PostProcessPass - Full-screen FragmentShader pass with passOrder and setUniforms callback
  • ShaderComponent - ECS component for per-entity or post-process shaders
  • PostProcessSystem - ECS system bridging ShaderComponent entities to RenderingEngine (priority 35)

Parallax Classes #

  • ParallaxBackground - Multi-layer parallax compositor
  • ParallaxLayer - Single layer with scrollFactorX/Y, velocityX/Y, repeat, opacity, tint
  • ParallaxComponent - ECS component attaching a ParallaxBackground to an entity

Sprite Atlas Classes #

  • SpriteAtlas - Named-region lookup, clip registration, and sprite/animation creation
  • AtlasParser - Auto-detecting parser for TexturePacker JSON Array, JSON Hash, multi-page, and Aseprite formats
  • AtlasAnimationClip - Named clip with a list of AtlasFrame entries (region name + duration)
  • AtlasSpriteAnimation - Frame-by-frame animation that drives a Sprite through an AtlasAnimationClip

Deterministic Effects Classes #

  • DeterministicEffect - Abstract base; all effects implement applyTick(ctx, prevElapsed, currElapsed)
  • Effect types: MoveEffect, ScaleEffect, RotateEffect, FadeEffect, ColorTintEffect, SequenceEffect, ParallelEffect, DelayEffect, RepeatEffect, ShakeEffect, PathEffect
  • EffectComponent - ECS component storing an entity's EffectPlayer queue
  • EffectSystemECS - Advances all in-flight effects each tick (priority 65)
  • EffectSerializer - JSON factory registry for serializing/deserializing effects
  • EffectBinaryCodec - Little-endian v1 binary wire format
  • EffectSnapshot - Mid-flight state capture for lock-step or rollback

Localization Classes #

  • LocalizationManager - Central i18n service with namespace support, fallback chain, and localeSignal
  • LocaleStringTable - Immutable per-locale flat string map with nested JSON flattening
  • StringInterpolator - ICU-lite template engine: {var}, {plural}, {select}
  • LocalizationScope - InheritedWidget exposing LocalizationManager to the widget tree
  • LocalizationBuilder - Rebuilds on locale change; exposes t() helper
  • LocalizedText - Drop-in Text replacement that resolves keys via LocalizationManager
  • LocaleSelector - Ready-made locale-switching UI widget

Narrative / Dialogue Classes #

  • DialogueManager - High-level facade for loading and running .yarn scripts
  • YarnTokenizer / YarnParser - Full Yarn Spinner 2.x parser
  • DialogueRunner - Executes a parsed dialogue graph; exposes condition and command registries
  • DialogueGraph / DialogueNode - Parsed script data model
  • DialogueLocalizer - Bridges dialogue string keys to LocalizationManager
  • DialogueComponent / TriggerComponent - ECS components for in-world dialogue ownership
  • DialogueSystem - ECS system processing trigger conditions each frame
  • DialogueBoxWidget / DialogueChoicesWidget - Ready-made Flutter UI widgets for in-game dialogue

Contributing #

Contributions are welcome! This engine is in active development. Join us on Discord to discuss ideas, ask questions, and connect with other developers.

License #

This project is licensed under the BSD-3-Clause License - see the LICENSE file for details.

Acknowledgments #

  • Built with Flutter
  • Inspired by Unity, Godot, and Flame engines
6
likes
150
points
309
downloads

Documentation

API reference

Publisher

verified publisherjustunknown.com

Weekly Downloads

A feature-rich 2D game engine for Flutter with ECS, physics, audio, tilemaps, particles, animation, and input systems for building cross-platform games.

Homepage
Repository (GitHub)
View/report issues
Contributing

License

BSD-3-Clause (license)

Dependencies

flutter, just_audio_engine, just_database, just_debugger, just_memory, just_signals, just_storage, just_tiled, meta, web

More

Packages that depend on just_game_engine