just_game_engine 1.4.2
just_game_engine: ^1.4.2 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.
Changelog #
All notable changes to the Just Game Engine will be documented in this file.
1.4.1 - 2026-04-02 #
- Engine performance improved
- Engine stats updated
[1.4.1] - 2026-03-25 #
Changed - Documentation & Examples #
- README: Overhauled and streamlined — removed outdated sections and links to provide a cleaner, more up-to-date overview.
- Example: Consolidated the example suite into a single
example.dartfile covering the core engine setup. Removed the separatecore_system_example.dart,ecs_example.dart, andinput_test_example.dartfiles to reduce onboarding friction.
1.4.0 - 2026-03-21 #
Changed - Architecture & Performance #
- Major change in architecture and imporved performance
Added - Parallax Background System #
New first-class subsystem for multi-layer scrolling backgrounds, accessible via Engine.parallax.
- ParallaxLayer — Individual layer with depth-based scrolling.
scrollFactorX/scrollFactorYcontrol camera-relative scroll speed (0.0 = fixed, 1.0 = camera speed).velocityX/velocityYfor continuous auto-scroll independent of camera movement.scale,repeat,offset,opacity, andtintfor full visual control.ParallaxLayer.uniform()convenience constructor for equal X/Y scroll factors.
- ParallaxBackground — Ordered container of
ParallaxLayerinstances (index 0 = furthest back).addLayer(),insertLayer(),removeLayer()for runtime layer management.update(deltaTime)advances auto-scroll offsets;render(canvas, size)paints all layers back-to-front.- Per-layer camera-driven + auto-scroll + static offset compositing.
- Tiling logic handles images smaller than the viewport with seamless horizontal/vertical wrapping.
- ParallaxSystem — Engine subsystem managing all registered backgrounds.
addBackground()/removeBackground()/clear()lifecycle methods.update(deltaTime, cameraPosition)feeds camera position into every background each frame.render(canvas, size)called viaRenderingEngine.onRenderBackgroundin screen space (before camera transform).
Added - Virtual Joystick Widget #
Reusable Flutter widget for touch-based directional input on mobile platforms.
- VirtualJoystick —
StatefulWidgetthat handles pointer events and emits normalised direction vectors.JoystickVariant.fixed— always-visible joystick anchored at a set position.JoystickVariant.floating— appears at the touch-down point and follows the finger.JoystickAxisconstraint:both,horizontal, orverticalaxis locking.- Configurable
radius,showWhenInactive,inactiveOpacity, andanchorAlignment. onDirectionChangedcallback delivers a normalisedOffseteach frame for ECS integration.- Rendered via
CustomPaintwith base ring and thumb knob visuals.
- JoystickInputComponent — ECS component storing joystick state on an entity.
direction,basePosition,thumbPositionfor runtime access.layout(fixed / floating) andaxisconstraint properties.hasInput,reset(),setDirectionFromDelta()helpers.- Automatically processed by
InputSystem._updateJoystickComponents()alongside keyboard input.
1.3.0 - 2026-03-15 #
Added - Tiled Map ECS Integration #
just_tiled is now a first-class runtime dependency of just_game_engine. The engine ships four new types that bridge parsed Tiled map data directly into the ECS world, covering rendering, collision, and object-to-entity spawning.
- TileMapLayerComponent — ECS component that attaches a
TileLayerand its pre-compiledTileMapRendererto a single entity. One entity per tile layer keeps the world free of per-tile entity bloat. - TiledObjectComponent — ECS component for Tiled map objects. Exposes
properties,type, andnamedirectly on the entity for easy custom-logic dispatch. - TiledMapFactory — Static factory that translates an entire
TiledMapinto ECS entities in one call.- Tile layers → one entity with
TileMapLayerComponent+TransformComponent(respects layer offset). - Object groups → one entity per visible
TiledObjectwithTransformComponent+TiledObjectComponent. GroupLayerchildren are traversed recursively.ComponentMappercallback maps any Tiled class name + custom properties to additional engine components (e.g.HealthComponent,EnemyAIComponent).
- Tile layers → one entity with
- TileMapRenderSystem — ECS
Systemthat GPU-batches allTileMapLayerComponententities. UsesCamera.getVisibleBounds()for viewport frustum culling so only in-view tiles are processed. Runs at priority100so tile layers are painted before game entities. - TiledCollisionSystem — ECS
Systemthat converts TMX object-group collision shapes into staticPhysicsBodyinstances and registers them withPhysicsEngine.- Supports rectangle, polygon, and ellipse shapes (mapped to
RectangleShape,PolygonShape,CircleShape). - Per-object
restitutionandfrictionread from Tiled custom properties. - Optional
SpatialHashGrid<PhysicsBody>for O(1) proximity queries. loadCollisions(TiledMap)/loadObjectGroupCollisions(ObjectGroup)/clearCollisions()lifecycle methods.
- Supports rectangle, polygon, and ellipse shapes (mapped to
1.2.1 - 2026-03-15 #
Changed #
- GameWidget:
_GamePainter.paint()now also callsengine.world.render(canvas, size), so ECS entities registered withRenderSystemare drawn automatically alongside the classic rendering pipeline.
Added - Audio ECS Integration #
Audio playback is now fully ECS-driven alongside the existing AudioEngine API.
- AudioSourceComponent — Persistent audio source on an entity. Properties:
clipPath,volume,pan,loop,playOnAdd,channel(AudioChannel),is3d. Whenis3distrue, stereo pan is ignored and 3D position is derived fromTransformComponent. - AudioPlayComponent — Fire-and-forget one-shot playback trigger.
AudioSystemplays the sound and removes the component automatically. - AudioListenerComponent — Marks an entity (typically the camera or player) as the SoLoud 3D listener.
AudioSystemforwards the entity'sTransformComponentposition to the native listener each frame. - AudioSystem — ECS
Systemthat drives all audio ECS components. Runs at priority-10(after transforms) to ensure 3D positions are up to date before the listener and source positions are sent to SoLoud.
Fixed #
- Example: Simplified
example/example.dartto a minimal renderer setup for easier onboarding.
1.2.0 - 2026-03-12 #
Added - Ray Casting & Ray Tracing #
- Ray — 2-D ray descriptor with origin, normalised direction, and maximum travel distance.
Ray.fromPoints()convenience constructor for aiming between two world positions.at(t)helper returns the world-space point at a given distance along the ray.
- RaycastColliderComponent — ECS component that marks an entity as hittable by rays.
- Configurable
radius, semantictagfor filtering,isBlockerflag, andisReflective/reflectivityproperties for multi-bounce tracing.
- Configurable
- RaycastHit — intersection result containing the hit entity, world-space point, distance, and outward surface normal.
- RaycastSystem — query-only ECS system for ray-vs-collider tests.
castRay()returns the closest hit;castRayAll()returns all hits sorted nearest-first.hasLineOfSight()performs a line-of-sight / LOS check between two points.
- RayTracer — multi-bounce ray tracing against reflective surfaces.
- Configurable
maxBouncesandminReflectivitythresholds. trace()returns aRayTracecontaining everyRayTraceSegment(path segment + optional hit).
- Configurable
Added - Ray Renderable #
- RayRenderable — a
Renderablethat draws a glowing beam / laser / bullet trail in world space.- Two-layer visual: a sharp core line and a wider blurred glow halo for a neon/laser effect.
- Automatic fade-out over a configurable
lifetime;isExpiredflag for easy cleanup. - Customisable
color,width,glowWidthMultiplier, andglowBlurSigma.
1.1.2 - 2026-03-08 #
Changed #
- Audio Engine: Replaced
audioplayerswithflutter_soloud(^3.5.0) as the audio backend.- SoLoud is a low-latency, C++-based audio engine purpose-built for games.
- Removed the fixed-size
AudioPlayerpool; SoLoud handles unlimited concurrent voices natively. AudioClipnow holds anAudioSource+SoundHandleinstead of anAudioPlayer.AudioEngine.initialize()is nowasyncand callsSoLoud.instance.init(); the engine properlyawaits it during startup so audio is guaranteed ready before any play calls.- Added
isInitializedguard ininitialize()to be safe against duplicate init (e.g. hot restart). playSfx()andplayMusic()return early with a debug message if called before initialization.- Music fade-in/fade-out now delegates to
SoLoud.instance.fadeVolume()instead of a manual step loop. dispose()callsSoLoud.instance.deinit()to fully shut down the engine.
1.1.1 - 2026-03-07 #
- Homepage URL updated in
pubspec.yaml. - Added reactive ECS components and signals for improved state management.
1.1.0 - 2026-03-01 #
Added - Advanced Physics Engine #
- Rigid Body Dynamics
- Upgraded physics integration to Semi-Implicit Euler.
- Added new dynamic properties to
PhysicsBody:angularVelocity,angle,torque,inertia, andfriction. - Added support for static bodies by setting
mass: 0.0.
- Advanced Collision Shapes
- Implemented
CollisionShapehierarchy replacing simpleradius. - Added
CircleShape,RectangleShape, andPolygonShape. - Implemented Separating Axis Theorem (SAT) for true polygon-polygon and circle-polygon collision detection.
- Implemented
- Impulse-Based Resolution
- Added rigorous impulse delivery resolving velocity along collision normals using inverse mass scaling.
- Included Coulomb friction handling for sliding objects.
- Broad-Phase Optimization
- Implemented $O(n)$
SpatialGridbroad-phase for massive performance gains in dense scenes. - Added Object Sleeping: resting bodies are excluded from integration until awoken, saving CPU cycles.
- Implemented $O(n)$
- Physics Caching
- Integrated
CacheManagerutilizingjust_storageandjust_database. - Added
cachePolygonShapeandgetCachedPolygonShaperoutines to persist heavy math computations across sessions.
- Integrated
1.0.1 - 2026-02-24 #
Fixed #
- Audio Engine
- Fixed
AudioClip.play()crash caused byAudioCachedouble-prefixing the asset path (assets/assets/...) when the caller passed a path already starting withassets/. The path is now stripped of theassets/prefix before being passed toAssetSource.
- Fixed
Changed #
- License
- Changed project license from Apache 2.0 to BSD-3-Clause.
1.0.0 - 2026-02-16 #
Added - Core Systems #
-
Engine Core
- Main
Enginesingleton class for orchestrating all subsystems GameLoopwith fixed timestep (60 UPS) and variable renderingTimeManagerfor delta time tracking and FPS calculationSystemManagerfor coordinating subsystems- Full lifecycle management (initialize, start, pause, resume, stop, dispose)
- Engine state machine with 6 states (uninitialized, initializing, initialized, running, paused, error)
- Main
-
Rendering Engine
- Canvas-based 2D rendering system
Cameraclass with pan, zoom, rotation, and lookAt functionality- Layer-based rendering with Z-order sorting
- Built-in renderables:
CircleRenderable,RectangleRenderable,LineRenderable,TextRenderable,CustomRenderable GameWidgetfor Flutter integration with CustomPainter- Debug mode with bounding boxes and coordinate grids
- Background color support
- FPS display overlay
Added - Advanced Features #
-
Sprite System
Spriteclass for image rendering with source rectanglesSpriteSheetfor managing sprite atlasesNineSliceSpritefor scalable UI elements- Horizontal and vertical flipping support
- Static
fromAssetmethod for easy loading
-
Animation System
- Base
Animationclass with play, pause, stop, reset controls SpriteAnimationfor frame-based sprite animations:- Automatic frame cycling based on normalized time
fromSpriteSheet()factory method for easy creation- Support for variable frame counts (any number of frames)
- Configurable frame dimensions (width/height)
- Manual frame list support via
List<Rect>frames parameter
- Generic
TweenAnimation<T>with custom lerp functions - Property tweens:
PositionTween,RotationTween,ScaleTween,OpacityTween,ColorTween AnimationSequencefor chaining animationsAnimationGroupfor parallel animationsEasingsclass with 15+ easing functions:- Linear
- Quadratic (in, out, in-out)
- Cubic (in, out, in-out)
- Quartic (in, out, in-out)
- Sine (in, out, in-out)
- Exponential (in, out, in-out)
- Elastic (in, out, in-out)
- Bounce (in, out, in-out)
- Loop and ping-pong support
- Speed control (0.1x - 5.0x) with dynamic adjustment
- Normalized time (0.0 - 1.0) for progress tracking
- Completion callbacks
- Base
-
Particle Effects
ParticleEmitterwith configurable emission rate and lifetime- Individual
Particleclass with full lifecycle - Size gradient support (start → end)
- Color gradient support with smooth transitions
- Gravity and velocity simulation
- Multiple particle shapes: circle, square, star
- Built-in effect presets:
- Explosion (burst of orange/yellow particles)
- Fire (rising orange flames with flicker)
- Smoke (upward gray particles with fade)
- Sparkle (twinkling yellow/white particles)
- Rain (falling blue droplets)
- Snow (gentle falling white flakes)
- Custom particle system creation
-
Physics Engine
PhysicsBodyrigid body class- Circular collision detection
- Elastic collision resolution with restitution
- Mass, velocity, drag, and radius properties
- Gravity simulation (configurable)
- Debug rendering with:
- Body visualization (green = active, red = inactive)
- Velocity vector arrows
- Collision boundary circles
- Broad-phase and narrow-phase collision optimization
-
Scene Graph
- Hierarchical
SceneNodestructure - Parent-child transform relationships
- Local and world-space coordinate systems
- Transform propagation (position, rotation, scale)
SceneEditorfor scene managementScenecontainer class- Node finding by name (recursive search)
- Active/inactive state per node
- Depth calculation
- Custom update callbacks per node
- Renderable attachment to nodes
- Hierarchical
-
Entity-Component System (ECS)
Worldclass for managing all entities and systemsEntityclass representing game objects with componentsComponentbase class for pure data containersSystembase class for processing logic- Entity lifecycle management (create, destroy, query)
- Component filtering and queries
- System priority and ordering
- Entity statistics and debugging
- 13 built-in components:
TransformComponent- Position, rotation, scale with transform methodsVelocityComponent- Velocity vector with max speed and angle utilitiesRenderableComponent- Links to renderable objects with sync optionsPhysicsBodyComponent- Radius, mass, restitution, drag, collision layersTagComponent- Simple string tagging for entity identificationLifetimeComponent- Time-based entity expirationHealthComponent- HP system with damage, heal, and invulnerabilityParentComponent- Parent reference with local offset and rotationChildrenComponent- Child entity list managementInputComponent- Movement direction and button stateAnimationStateComponent- Current animation state trackingSpriteComponent- Sprite path, frame, flip flags, and tint color
- 9 built-in systems:
MovementSystem- Applies velocity to transform with max speed clampingRenderSystem- Renders entities with transform syncLifetimeSystem- Updates lifetime and destroys expired entitiesPhysicsSystem- Full physics with gravity, drag, collision detection/resolution, layer-based filteringHierarchySystem- Propagates parent transforms to childrenHealthSystem- Health regeneration and death handlingAnimationSystemECS- Animation time updatesBoundarySystem- World boundary enforcement with 4 behaviors (clamp, bounce, wrap, destroy)
- Data-oriented architecture for performance
- Composition over inheritance design
- Query system for finding entities by components
- Example implementation in
ecs_example.dart
Added - Supporting Systems #
-
Input Management
InputManagermain coordinator with subsystem accessKeyboardInputwith key press/hold/release detection- Key state tracking with previous frame comparison
- Horizontal and vertical axis support for WASD/Arrow keys
MouseInputwith position, button, and scroll tracking- Mouse delta and scroll delta calculation
- Support for left, right, and middle mouse buttons
- Screen-to-world coordinate conversion support
TouchInputwith multi-touch support- Touch point tracking with pressure and size
- Touch start/end events per frame
ControllerInputwith gamepad support- Analog stick support (left/right sticks)
- Trigger and button detection
- Configurable dead zone for analog inputs
- Event callback system for custom input handling
- Automatic integration with
GameWidgetvia Focus and Listener - Input state updates each frame in game loop
-
Audio Engine
AudioEnginemain coordinator with multi-channel mixingAudioClipwrapper for individual audio playback controlSoundEffectManagerfor managing sound effectsMusicManagerfor background music with fade effectsAudioMixerfor volume and mute control- 5 audio channels: Master, Music, SFX, Voice, Ambient
- Per-channel volume control with independent mute/unmute
- Unlimited concurrent SFX via SoLoud's native voice management
- Automatic cleanup of finished audio clips
- Music fade in/out support (configurable duration)
- Looping support for music and ambient sounds
- Built on
audioplayerspackage (^6.1.0) (replaced by flutter_soloud in v1.1.2) - Supports MP3, WAV, OGG, FLAC audio formats
- State tracking (stopped, playing, paused)
- Integration methods:
playSfx(),playMusic(),stopMusic(),setMasterVolume()
-
Asset Management
AssetManagerfor loading and caching game resourcesAssetbase class with load/unload lifecycleImageAssetfor loading PNG/JPG images withui.ImageAudioAssetfor loading audio files as binary dataTextAssetfor loading plain text filesJsonAssetfor loading and parsing JSON configurationBinaryAssetfor loading raw binary dataAssetBundlefor grouping related assets- Automatic caching system to prevent duplicate loads
- Memory usage tracking per asset (in bytes)
- Cache statistics: total assets, images, audio, text, JSON, binary counts
- Total memory usage calculation
- Async loading with futures
- Integration with Flutter's rootBundle
- Support for atlas/sprite sheet metadata
- Unload functionality to free memory
- Type-safe asset retrieval methods
-
Networking (Placeholder)
- Structure for multiplayer support
- Client-server communication
Examples #
core_system_example.dart- Complete engine setup exampleecs_example.dart- Entity-Component System with physics and collisionsinput_test_example.dart- Comprehensive input system demo with keyboard, mouse, and touch
Technical Details #
- Minimum Flutter SDK: 3.11.0
- Minimum Dart SDK: 3.0.0
- External dependencies:
audioplayers: ^6.1.0(for Audio Engine) (replaced by flutter_soloud in v1.1.2)
- Singleton pattern for Engine
- Observer pattern for lifecycle events
- Component-based architecture
- Fixed timestep game loop (60 UPS)
- Variable rendering for smooth visuals
- Efficient collision detection with spatial awareness
Performance #
- Maintains 60 FPS with 20+ objects
- Handles 100+ particles simultaneously
- Real-time collision detection for multiple bodies
- Optimized rendering pipeline
- Low memory footprint
Version History #
- 1.4.2 - Performance improvements
- 1.4.1 - Documentation overhaul and example consolidation
- 1.4.0 - Parallax Background System, Virtual Joystick Widget, and showcase app improvements
- 1.3.0 - Tiled Map ECS integration (TiledMapFactory, TileMapRenderSystem, TiledCollisionSystem) and Audio ECS integration (AudioSourceComponent, AudioSystem)
- 1.2.1 - GameWidget ECS rendering integration and example cleanup
- 1.2.0 - Ray Casting, Ray Tracing, and Ray Renderable systems
- 1.1.0 - Complete Physics Engine overhaul (Rigid Body Dynamics, SAT Shapes, Spatial Grid, and Impulse Resolution)
- 1.0.1 - Bug fix for audio asset path and license update to BSD-3-Clause
- 1.0.0 - Full production release with all core features