bonfire 4.1.0
bonfire: ^4.1.0 copied to clipboard
(RPG maker) Create RPG-style or similar games more simply with Flame.
Bonfire #
Build RPG-style games (and beyond) with the power of FlameEngine! đŽ
![]() |
![]() |
![]() |
![]() |
đ Documentation #
Complete documentation with examples: docs.page/rafaelbarbosatec/bonfire
⨠Features #
- đ§Š Composable by design (LEGO) â every element is a
GameComponentplus small mixins: snap onMovement,WithLife,WithCollision,WithJumper,WithVision,WithForces... Build the exact player/enemy/object you need instead of accepting a fixed hierarchy. - đ§ RPG-ready components â
Player,Enemy,Ally,Npc,GameDecorationand a completeGameComponentAPI. - đēī¸ 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 {
MyEnemy(Vector2 position) : super(position: position, size: Vector2.all(32)) {
randomMovement.setup(speed: 20, maxDistance: 64);
}
@override
void update(double dt) {
super.update(dt);
randomMovement.run(dt);
}
}
That is also the LEGO side of Bonfire. Player itself is just:
class Player extends GameComponent
with
Movement,
WithLife,
WithVision,
PlayerControllerListener,
MovementByJoystick {}
No sprite, no animation, no drawing. SimplePlayer, RotationPlayer and PlatformPlayer are that same recipe plus a couple of bricks. If the built-in player does not fit â for example, you do not want sprite animations â extend Player (or GameComponent) and snap on only the mixins you want. Same for enemies, decorations and props. See Composition (LEGO mixins).
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), plusWithFollower,WithPushable,WithFlipRender,WithMovePerCell,WithAssetsLoaderandWithLifeBar. - Simplified, velocity-based
Movementâ the only mixin that keeps its direct access style, but was rewritten:direction/hDirection/vDirectionnow 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 â
WithCollisionexposescollision.onBlockMovementListener(...)and abodyTypeAPI instead of the oldBlockMovementCollisionoverrides. - Direction animations â
SimplePlayer/SimpleEnemydrive their 8-direction sprite animations (SimpleDirectionAnimation) fromdirectionautomatically. - Behavior trees â brand-new behavior system (
BSelector,BParallel,BOnce) with debugging support. - Better intervals â
IntervalTickreplaces the oldInternalChecker/checkInterval. - Bug fixes & correctness â exact diagonal normalization (
sqrt(2)/2), forces default to no drag, no double damage onFlyingAttackGameObject, modernColorAPI (withValues). - Upgraded to Flame
^1.38.0, withexample/andawesome/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.1.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 #
đ¤ AI agent skills #
Bonfire ships Agent Skills inside the package, so AI coding agents (Claude Code, Codex, Cursor, Copilot, ...) know the installed version's API instead of guessing from older releases.
dart run skills@ get # choose the skills to install
dart run skills@ get --all # install all of them
There are skills for getting started, player, enemy AI, collisions/sensors,
maps, decorations/effects, dialogs/HUD and a v4 API-object reference. See
skills/ for the list.
đ§Š Bonfire Awesome #
If you build a game using Bonfire, you can open a PR to add your game here.
Useful packages #
| Name | Link |
|---|---|
| bonfire_bloc | |
| bonfire_spine |
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!




