Skip to content

Version 4.1.0

Choose a tag to compare

@RafaelBarbosatec RafaelBarbosatec released this 11 Nov 17:06
· 31 commits to master since this release
3d0ada3

4.1.0

Bonfire 4.1 brings a complete lighting system: cutout and additive lights,
gradient falloffs, pulse and candle-like flicker, shadow casting with occluders,
quality and debug helpers, and day/night presets. Occluders can be declared in
Tiled following the same pattern used by collision, and a layer/object can be a
collision and an occluder at the same time.

LightingConfig keeps its previous defaults, so existing lights keep working as
before; the behaviour changes are listed under Fixed.

4.1 also ships Agent Skills with the package, so AI coding agents write code
against the installed version instead of guessing from 3.x.

Lighting

Added

  • LightingMode.additive draws emissive lights (torches, magic, explosions) on
    top of the scene, even when no ambient darkness is configured.
  • LightingApi.animateTo(config, duration, curve) transitions the radius,
    color, blur and alignment of a light smoothly.
  • gameRef.lighting.fadeIn(color) / fadeOut() animate the ambient light.
  • LightFalloff.linear and LightFalloff.smooth render the light edge with a
    radial gradient instead of MaskFilter.blur, with a configurable
    innerRadius (full-intensity core).
  • intensity multiplies the light color alpha and additiveBlendMode allows
    BlendMode.screen and others on additive lights.
  • LightFlicker adds a deterministic candle-like variation to radius and
    intensity.
  • LightSource with gameRef.lighting.addLight(...)/removeLight(...) allows
    lights that are not attached to any component (explosions, muzzle flashes,
    ambient details).
  • LightingType.rect(size) and LightingType.polygon(points) add rectangular
    and polygonal lights. With useComponentAngle: true they rotate with the
    component.
  • Shadow casting: LightingConfig.castShadows clips a light with the registered
    LightingOccluders. Add static geometry with
    gameRef.lighting.addOccluder(...)/removeOccluder(...) or moving obstacles
    with the WithLightingOcclusion mixin.
  • LightingQuality (low, medium, high) controls how many rays are cast
    per light when computing the shadow silhouette (24, 64, 160).
  • gameRef.lighting.debug draws the light shapes, the shadow clip and the
    occluders, to debug lights that are not reaching somewhere.
  • LightingPreset (day, dusk, night, dungeon) with apply(...) fades
    the ambient color for the common day/night setups.
  • Tiled integration: WorldMapByTiled now registers LightingOccluders
    declared in Tiled. Tile layers and objects with the lighting_occluder
    class become occluders; occluder tile layers are not rendered and adjacent
    tiles are merged into rectangles. Object layers and objects can declare
    several roles separated by commas (e.g. collision,lighting_occluder), so
    the same wall blocks movement and light without being duplicated in the map.
    The combination is not supported on tile layers, where collisions come from
    the tileset.

Fixed

  • gameRef.lighting and gameRef.colorFilter no longer throw
    Bad state: No element when read from another component's onLoad
    (for instance WorldMapByTiled registering Tiled occluders). Flame empties
    the viewport children while mounting the tree, so the layers are now
    resolved once in the BonfireGame constructor.
  • LightingConfig.copyWith now preserves align (it used to reset it to zero)
    and accepts align, mode, falloff, innerRadius, intensity,
    additiveBlendMode and flicker.
  • PulseValue now honors pulseCurve, never exceeds pulseVariation and keeps
    the previous pulse timing.
  • Arc lights now respect radius instead of being drawn with twice the
    configured radius, so switching between arc and circle lights keeps the
    same coverage.
  • Arc lights with isCenter: true are now centered on the component angle even
    when startRadAngle is not zero (the start angle was being ignored).
  • Additive lights are now composited below the ambient darkness, so the ambient
    color darkens them instead of the light being painted over the night color.
  • Lights follow the camera transform, staying aligned when the camera is rotated
    or uses a custom anchor.
  • Arc lights rotate around the component absolute center.
  • blurBorder: 0 now produces a crisp edge instead of an invalid blur.
  • Pulse updates no longer depend on rendering and LightingComponent.update now
    calls super.update(dt).

Agent Skills

Added

  • The package now ships Agent Skills in
    skills/: prescriptive guides for AI coding agents covering getting started,
    player, enemy AI, collisions/sensors, maps, decorations/effects, dialogs/HUD
    and the 4.x API-object reference. Install them in a game project with
    dart run skills@ get (or --all). See docs/ai-skills.mdx.