Powered by Flame Flutter MIT Licence pub package GitHub stars pub points Telegram

bonfire

Bonfire

Build RPG-style games (and beyond) with the power of FlameEngine! 🎮

📚 Documentation

Complete documentation with examples: docs.page/rafaelbarbosatec/bonfire

✨ Features

  • 🧙 RPG-ready components — Player, Enemy, Ally, Npc, GameDecoration and a complete GameComponent API.
  • đŸ—ēī¸ Maps — Tiled map support, multi-map worlds, custom/matrix maps, collisions and portals.
  • đŸ•šī¸ Input — Joystick, keyboard and mouse controls with 8-direction movement.
  • âš”ī¸ Combat — melee and ranged attacks, projectiles, damage feedback and life bars.
  • 🧠 Behaviors & AI — behavior trees (BSelector, BParallel, BOnce), pathfinding, random movement, sensors and vision.
  • 🎨 Effects & polish — particles, lighting, shaders, camera effects, parallax, color filters and force physics.
  • đŸ–Ĩī¸ Game interface — life bars, dialogs, text effects, minimap and HUD components.
  • 📱 Multi-platform — mobile, desktop and web with Flame.

🎮 Bonfire 4.0 — what's new

Version 4.0 is a major restructuring of the API surface, focused on developer experience when building complex game components.

In previous versions each mixin added methods and fields directly to the component. With several mixins (Movement, Jumper, Sensor, PathFinding, Pushable, RandomMovement...), the component namespace became crowded and autocomplete less useful.

Starting with 4.0, mixins follow a consistent WithFeature + feature.{resource} pattern:

class MyEnemy extends SimpleEnemy
    with Movement, WithCollision, WithRandomMovement, WithPathFinding {
  @override
  void update(double dt) {
    super.update(dt);
    randomMovement.update(dt, speed: 20, maxDistance: 64);
  }
}

Highlights of the release:

  • API-first mixins — WithJumper (jumper), WithSensor (sensor), WithRandomMovement (randomMovement), WithPathFinding (pathFinding), WithCollision (collision), WithAttack (attack), WithVision (vision), WithLighting (lighting), WithShader (shader), WithUtil (util), plus WithFollower, WithPushable, WithFlipRender, WithMovePerCell, WithAssetsLoader and WithLifeBar.
  • Simplified, velocity-based Movement — the only mixin that keeps its direct access style, but was rewritten: direction/hDirection/vDirection now reflect the current velocity, stop()/idle() replace the old stop helpers and legacy members (lastDirection, stopMove, setZeroVelocity, moveFromAngle, *Once, acceleration...) were removed.
  • Event-driven collision — WithCollision exposes collision.onBlockMovementListener(...) and a bodyType API instead of the old BlockMovementCollision overrides.
  • Direction animations — SimplePlayer/SimpleEnemy drive their 8-direction sprite animations (SimpleDirectionAnimation) from direction automatically.
  • Behavior trees — brand-new behavior system (BSelector, BParallel, BOnce) with debugging support.
  • Better intervals — IntervalTick replaces the old InternalChecker/checkInterval.
  • Bug fixes & correctness — exact diagonal normalization (sqrt(2)/2), forces default to no drag, no double damage on FlyingAttackGameObject, modern Color API (withValues).
  • Upgraded to Flame ^1.38.0, with example/ and awesome/ updated to the new APIs and analyzed by CI.

Migrating from Bonfire 3.x? Read the Migration Guide from 3.x to 4.0 — it has the full breaking-change tables. Every pre-release change is also listed in the CHANGELOG.

🚀 Getting started

Add Bonfire to your pubspec.yaml:

dependencies:
  bonfire: ^4.0.0

Then create your first map + character and run it inside a BonfireWidget. The quickest way to see everything working is to open the bundled example app — a complete, runnable project with maps, players, enemies, attacks, life bars and interface.

Run it:

cd example
flutter pub get
flutter run

Bonfire is ideal for building games from the following perspectives:

Test our online DEMO or Download APK.

📚 Documentation

bonfire-engine.github.io

🧩 Bonfire Awesome

Link

If you build a game using Bonfire, you can open a PR to add your game here.

Useful packages

Name Link
bonfire_bloc pub package
bonfire_spine pub package

Encourage my work

Credits

  • The entire FlameEngine team.
  • And thanks to everyone who contributes and has already contributed.

Contribution

If you find any errors or want to add improvements, you can open an issue or develop the fix and open a pull request. Thank you for your cooperation!

Documentation repository

Libraries

background/background_image_game
background/game_background
base/base_game
base/bonfire_collision_config
base/bonfire_game
base/bonfire_game_interface
base/bonfire_quad_tree_collision
base/bonfire_with_collision
base/game_component
base/listener_game_widget
behavior/behavior
behavior/behavior_manager
behavior/behaviors/b_action
behavior/behaviors/b_can_see
behavior/behaviors/b_can_see_type
behavior/behaviors/b_condition
behavior/behaviors/b_custom
behavior/behaviors/b_interval
behavior/behaviors/b_list
behavior/behaviors/b_move_to_component
behavior/behaviors/b_once
behavior/behaviors/b_parallel
behavior/behaviors/b_random_movement
behavior/behaviors/b_see_and_move_to_target
behavior/behaviors/b_see_and_positioned
behavior/behaviors/b_selector
behavior/use_behavior
bonfire
camera/bonfire_camera
camera/camera_config
camera/camera_effects
collision/body_type
collision/collision
collision/collision_api
collision/collision_data
collision/collision_util
collision/elastic/elastic_collision
collision/elastic/elastic_collision_api
collision/elastic/elastic_collision_api_ext
collision/polygons_intersect_util
collision/quad_tree/custom_collision_detection
collision/quad_tree/custom_has_quadtree_collision_detection
color_filter/color_filter_component
color_filter/game_color_filter
decoration/decoration
decoration/decoration_with_collision
forces/forces
forces/forces_api
forces/forces_ext
forces/global_forces_settings
game_interface/game_interface
game_interface/interface_component
game_interface/text_interface_component
geometry/circle
geometry/polygon
geometry/rectangle
geometry/shape
geometry/shape_collision
input/gestures/drag_gesture
input/gestures/gesture_event
input/gestures/move_camera_using_gestures
input/gestures/pinch_gesture
input/gestures/tap_gesture
input/input
input/keyboard/keyboard
input/keyboard/keyboard_config
input/keyboard/keyboard_listener
input/mouse_listener
input/player_controller
input/pointer_detector
joystick/joystick
joystick/joystick_action
joystick/joystick_directional
joystick/joystick_map_explorer
lighting/lighting
lighting/lighting_api
lighting/lighting_component
lighting/lighting_config
lighting/lighting_type
map/base/game_map
map/base/layer
map/base/tile
map/base/tile_component
map/base/tile_layer_component
map/base/tile_with_collision
map/empty_map
map/matrix_map/map_terrain
map/matrix_map/matrix_layer
map/matrix_map/matrix_map_generator
map/matrix_map/terrain_builder
map/spritefusion/builder/spritefusion_world_builder
map/spritefusion/model/spritefucion_map
map/spritefusion/reader/spritefusion_asset_reader
map/spritefusion/reader/spritefusion_network_reader
map/spritefusion/world_map_by_spritefusion
map/tiled/builder/tiled_world_builder
map/tiled/cache_provider/tiled_cache_provider
map/tiled/cache_provider/tiled_memory_cache_provider
map/tiled/model/tiled_data_object_collision
map/tiled/model/tiled_item_tile_set
map/tiled/model/tiled_object_properties
map/tiled/model/tiled_world_data
map/tiled/reader/tiled_asset_reader
map/tiled/reader/tiled_network_reader
map/tiled/world_map_by_tiled
map/tiled/world_map_infinite_by_tiled
map/util/layer_mapper
map/util/map_assets_manager
map/util/map_layer_mapper
map/util/server_image_loader
map/util/world_map_reader
map/world_map
mixins/assets_loader/assets_loader
mixins/assets_loader/assets_loader_api
mixins/attack/attack
mixins/attack/attack_api
mixins/direction_animation/direction_animation
mixins/direction_animation/direction_animation_api
mixins/flip_render/flip_render
mixins/flip_render/flip_render_api
mixins/follower/follower
mixins/follower/follower_api
mixins/jumper/jumper
mixins/jumper/jumper_api
mixins/jumper_animation
mixins/life/life
mixins/life/life_api
mixins/mixins
mixins/move_per_cell/move_per_cell
mixins/move_per_cell/move_per_cell_api
mixins/movement
mixins/movement_by_joystick
mixins/path_finding/path_finding
mixins/path_finding/path_finding_api
mixins/pushable/pushable
mixins/pushable/pushable_api
mixins/random_movement/random_movement
mixins/random_movement/random_movement_api
mixins/sensor/sensor
mixins/sensor/sensor_api
mixins/shader/shader_api
mixins/shader/shader_setter
mixins/shader/shader_util
mixins/shader/with_shader
mixins/tile_recognizer/tile_recognizer
mixins/tile_recognizer/tile_recognizer_api
mixins/update_camera_by_pinch_gesture
mixins/use_barlife/life_bar_api
mixins/use_barlife/use_barlife
mixins/use_sprite
mixins/use_sprite_animation
mixins/util/util
mixins/util/util_api
mixins/vision/vision
mixins/vision/vision_api
npc/ally/ally
npc/ally/rotation_ally
npc/ally/simple_ally
npc/enemy/enemy
npc/enemy/platform_enemy
npc/enemy/rotation_enemy
npc/enemy/simple_enemy
npc/npc
npc/rotation_npc
npc/simple_npc
objects/animated_follower_game_object
objects/animated_game_object
objects/flying_attack_game_object
objects/follower_game_object
objects/game_object
parallax/camera_parallax
parallax/camera_parallax_componet
player/platform_player
player/player
player/rotation_player
player/simple_player
scene_builder/actions/await_scene_action
scene_builder/actions/callback_scene_action
scene_builder/actions/camera_scene_action
scene_builder/actions/delay_scene_action
scene_builder/actions/move_to_position_scene_action
scene_builder/actions/move_while_scene_action
scene_builder/scene_action
scene_builder/scene_builder
scene_builder/scene_manager_component
util/barlife_component
util/bonfire_game_ref
util/bonfire_util
util/collision_game_component
util/component_spawner
util/controlled_update_animation
util/damage_hitbox
util/direction
util/direction_animations/platform_animations
util/direction_animations/render_transform_warpper
util/direction_animations/simple_animation_enum
util/direction_animations/simple_direction_animation
util/extensions/color_extensions
util/extensions/extensions
util/extensions/image_extensions
util/extensions/int_int_extensions
util/extensions/joystick_extensions
util/extensions/movement_extensions
util/extensions/position_component_ext
util/extensions/viewport_extension
util/follower_widget
util/functions
util/interval_tick
util/line_path_component
util/pair
util/priority_layer
util/pulse_value
util/quadtree
util/sprite_animation_render
util/talk/say
util/talk/talk_dialog
util/text_damage_component
util/text_game_component
util/value_generator_component
widgets/bonfire_widget
widgets/map_navigator/map_navigator
widgets/map_navigator/map_navigator_controller
widgets/map_navigator/map_navigator_provider
widgets/mini_map/mini_map
widgets/mini_map/mini_map_canvas
widgets/typewriter/typewriter