A minimalist Flutter game engine

Last update: Aug 8, 2022

flame

A minimalistic Flutter game engine.

Test


English | 简体中文 | Polski | Русский | Español


About 1.0.0

Our goal is to release v1 soon. We are periodically launching RCs (release candidates) as we evolve the code, and we are already quite happy with where we are (but there might still be further changes).

Please use this version to get a preview of the new Flame version and also to give the team feedback about the new structure and/or features.

The main branch is the bleeding edge of the v1 migration. The master-v0.x branch is the latest v0 release (where we are still merging some patches and crucial fixes).

The current v1 release is on pub. The latest stable version so far is . Feel free to choose the one that better suits your needs.


Documentation

Note that the documentation in the main branch of this repo is newer than the latest released version.

Here you can find the documentation for different versions:

The complete documentation can be found here.

We provide many examples of different features which can be tried out from your browser here. You can also check the examples source code here.

The official site for Flame, which also contains the documentation can be found here.

Help

We have a Flame help channel on Blue Fire's Discord, join it here.

We also have a FAQ, so please search for your question there first.

Goals

The goal of this project is to provide a complete set of out-of-the-way solutions for the common problems every game developed in Flutter will share.

Currently it provides you with:

  • a game loop
  • a component/object system
  • a physics engine (Forge2D, available through flame_forge2d)
  • audio support
  • effects and particles
  • gesture and input support
  • images, sprites and sprite sheets
  • basic Rive support
  • and a few other utilities to make development easier

You can use whichever ones you want, as they are all somewhat independent.

Sponsors

The Flame Engine's top sponsors:

Cypher Stack

Want to sponsor Flame? Check our Patreon on the section below or contact us on Discord.

Support

The simplest way to show us your support is by giving the project a star.

You can also support us by becoming a patron on Patreon:

Patreon

Or by making a single donation by buying us a coffee:

Buy Me A Coffee

You can also show on your repository that your game is made with Flame by using one of the following badges:

Powered by Flame Powered by Flame Powered by Flame

[![Powered by Flame](https://img.shields.io/badge/Powered%20by-%F0%9F%94%A5-orange.svg)](https://flame-engine.org)
[![Powered by Flame](https://img.shields.io/badge/Powered%20by-%F0%9F%94%A5-orange.svg?style=flat-square)](https://flame-engine.org)
[![Powered by Flame](https://img.shields.io/badge/Powered%20by-%F0%9F%94%A5-orange.svg?style=for-the-badge)](https://flame-engine.org)

Contributing

Warning: We are working on bringing Flame to its first stable version, updates on 0.x versions are frozen, except for crucial bug fixes. If you want to contribute to that version, please be mindful of that, and use the master-v0.x branch. For contributions for v1, your PR must point to the main branch. If in doubt, make sure to talk about your contribution to the team, either via an issue or Discord.

Any help is appreciated! Comments, suggestions, issues, PRs.

Have you found a bug or have a suggestion of how to enhance Flame? Open an issue and we will take a look at it as soon as possible.

Do you want to contribute with a PR? PRs are always welcome, just be sure to create it from the orrect branch (see above) and follow the checklist which will appear when you open the PR.

Getting started

A collection of guides can be found here. Note that these tutorials are based on the main branch. To make sure you are looking at the tutorials that work with your current version, select the correct version tag.

This collection of guides is a work in progress, more guides and tutorials will be added soon.

We also offer a curated list of Games, Libraries and Articles over at awesome-flame.

Note that some of the articles might be slightly outdated, but they are still useful.

Credits

  • The Flame Engine team, who are continuously working on maintaining and improving Flame.
  • All the friendly contributors and people who are helping in the community.

GitHub

https://github.com/luanpotter/flame
Comments
  • 1. feat: Add `isFirstFrame` and `onStart` event to `SpriteAnimation`

    Description

    This adds isFirstFrame and onStart event callback to sprite_animation.dart. May not be useful for everyone but I needed to trigger another event whenever an animation was called as multiple factors could trigger that animation.

    Checklist

    • [x] The title of my PR starts with a [Conventional Commit] prefix (fix:, feat:, docs: etc).
    • [x] I have read the [Contributor Guide] and followed the process outlined for submitting PRs.
    • [x] I have updated/added tests for ALL new/updated/fixed functionality.
    • [x] I have updated/added relevant documentation in docs and added dartdoc comments with ///.
    • [ ] I have updated/added relevant examples in examples.

    Breaking Change

    • [ ] Yes, this is a breaking change.
    • [x] No, this is not a breaking change.
    Reviewed by munsterlander at 2022-03-26 19:29
  • 2. null safety

    This is a work in progress.

    ordered_set uses override to a branch in my fork until this is merged https://github.com/luanpotter/ordered_set/pull/5.

    As for now, nothing is done in the flame code itself.

    Todo:

    • [x] prepare main pubspec.yaml file
    • [x] migrate main dependencies
    • [x] migrate main code
    • [x] prepare examples pubspec.yaml files
    • [x] migrate examples dependencies
    • [x] migrate examples code
    • [x] ensure CI passes
    • [x] changelog entry
    • [x] rebase on master with null safety backports merged in
    • [x] Dashbook null safety release
    Reviewed by lig at 2020-11-28 22:08
  • 3. feat: Added RouterComponent

    Description

    This PR adds the RouterComponent (see the docs for the description of its functionality).

    https://user-images.githubusercontent.com/4231472/175832885-bcd1b821-c263-4d83-a4a6-daedf8e5f79f.mov

    Checklist

    • [x] The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
    • [x] I have read the Contributor Guide and followed the process outlined for submitting PRs.
    • [x] I have updated/added tests for ALL new/updated/fixed functionality.
    • [x] I have updated/added relevant documentation in docs and added dartdoc comments with ///.
    • [x] I have updated/added relevant examples in examples.

    Breaking Change

    • [-] Yes, this is a breaking change.
    • [x] No, this is not a breaking change.

    Related Issues

    ~~Prerequisite: #1781~~ Closes #1375

    Reviewed by st-pasha at 2022-06-26 20:33
  • 4. `flipHorizontallyAroundCenter` changes component position during position change

    Current bug behaviour

    Components center is to the left by components size.

    Expected behaviour

    Component center remains the same as before applying flips.

    Steps to reproduce

    1. Have component face right direction
    2. Start moving component to left direction applying flipHorizontallyAroundCenter before that.
    3. While component is moving apply flipHorizontallyAroundCenter again. (aka change facing direction back to right)

    Please see video attached

    Flame reference: main branch.

    Flutter doctor output

    Output of: flutter doctor -v

    [✓] Flutter (Channel stable, 2.5.3, on macOS 11.6 20G165 darwin-x64, locale en-UA)
        • Flutter version 2.5.3 at /Users/onov/IdeaProjects/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 18116933e7 (6 weeks ago), 2021-10-15 10:46:35 -0700
        • Engine revision d3ea636dc5
        • Dart version 2.14.4
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc4)
        • Android SDK at /Users/onov/Library/Android/sdk
        • Platform android-31, build-tools 31.0.0-rc4
        • ANDROID_HOME = /Users/onov/Library/Android/sdk
        • Java binary at: /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_232-b09)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 13.1, Build version 13A1030d
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [!] Android Studio
        • Android Studio at /Applications/Android Studio Preview.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        ✗ Unable to find bundled Java version.
        • Try updating or re-installing Android Studio.
    
    [✓] IntelliJ IDEA Community Edition (version 2021.2.3)
        • IntelliJ at /Applications/IntelliJ IDEA CE.app
        • Flutter plugin version 62.0.3
        • Dart plugin version 212.5632
    
    [✓] VS Code (version 1.62.3)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.28.0
    
    [✓] Connected device (3 available)
        • SM A505FN (mobile) • R58M96Y8GWP • android-arm64  • Android 10 (API 29)
        • macOS (desktop)    • macos       • darwin-x64     • macOS 11.6 20G165 darwin-x64
        • Chrome (web)       • chrome      • web-javascript • Google Chrome 96.0.4664.55
    

    More environment information

    • Flame version: main branch
    • Platform affected: Android
    • Platform version affected: Android 10

    Log information

    N/A

    More information

    Worth noticing that I am changing component size dynamically

    https://user-images.githubusercontent.com/6299150/143201803-8e0e91c0-39b1-48ec-8b78-bdef8fc86b0f.mov

    Reviewed by OlegNovosad at 2021-11-24 08:27
  • 5. Memory leak problem

    Hello!

    Using Flame for online window builder

    Current bug behaviour

    For some reason, when removing components from the game field - they remain in memory As a result, a memory leak occurs and the application crashes (when reaching 2gb)

    Steps to reproduce

    image image

    Each step, the components are removed from the game field and the modified ones are added again

    Tried to remove components with Component.shouldRemove flag, Component.remove and Component.removeFromParent methods

    Components removing from game field, but still in memory

    Flutter doctor output

    [✓] Flutter (Channel stable, 2.10.1, on macOS 12.1 21C52 darwin-x64, locale ru-RU)
        • Flutter version 2.10.1 at /Users/username/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision db747aa133 (5 недель назад), 2022-02-09 13:57:35 -0600
        • Engine revision ab46186b24
        • Dart version 2.16.1
        • DevTools version 2.9.2
    
    [!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
        • Android SDK at /Users/username/Library/Android/sdk
        ✗ cmdline-tools component is missing
          Run `path/to/sdkmanager --install "cmdline-tools;latest"`
          See https://developer.android.com/studio/command-line for more details.
        ✗ Android license status unknown.
          Run `flutter doctor --android-licenses` to accept the SDK licenses.
          See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 4.1)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    
    [✓] VS Code (version 1.65.2)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.29.0
    
    [✓] Connected device (3 available)
        • iPhone (Иван) (mobile)              • 00008101-000E211E3E92001E            • ios            • iOS 15.1.1 19B81
        • iPhone SE (2nd generation) (mobile) • E7F342C4-8A95-4C1E-AF73-F65E40314490 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
        • Chrome (web)                        • chrome                               • web-javascript • Google Chrome 99.0.4844.51
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    

    More environment information

    • Flame version: 1.0.0
    • Platform affected: android, ios

    Thanks!

    Reviewed by perfperm at 2022-03-17 11:12
  • 6. [Box2D] Random deletion of body components in release mode

    Hello there 🙂 ,

    Each time I test my game in release mode, I have weird random behaviours, and those bugs never happen in debug mode.

    The most annoying bug is the one that delete randomly some body component of the world. In this video, you can see that the circle component at the half of the worm is destroyed just after launching it.

    ezgif com-video-to-gif (2)

    Here is the slow motion of the moment where the body component is deleted: ezgif com-video-to-gif (3)

    There is another bug I encountered only in release mode (I can't explain this one, but it seems there is an position issue with a body) : ezgif com-video-to-gif (4)

    Thanks 🙏

    Reviewed by tommybuonomo at 2020-09-06 10:27
  • 7. Game not running on web

    Everytime I try to run my game on web it gives me the error below, the game works fine on phone.

    image

    image

    Could not load content for http://localhost:52472/C:/src/flutter/bin/cache/flutter_web_sdk/lib/_engine/engine/dom_renderer.dart (HTTP error: status code 400, net::ERR_HTTP_RESPONSE_CODE_FAILURE)

    Pubspec.yaml

    image

    Error in the terminal:

    Error parsing request.
    Invalid argument (requestedUri): handlerPath "null" and url "null" must combine to equal requestedUri path "/C:/src/flutter/bin/cache/flutter_we
    b_sdk/lib/_engine/engine/dom_renderer.dart".: Instance of '_Uri'
    dart:isolate  _RawReceivePortImpl._handleMessage
    

    I aleady did flutter clean, I tried flutter run with --release and debug, same error. even if I don't render anything (empty constructor) on the screen it gives me the error.

    MyGame(){

    // Empty here

    }

    main.dart

    void main() async{
    
      WidgetsFlutterBinding.ensureInitialized();
    
      if(!kIsWeb){
        await Flame.util.fullScreen();
        await Flame.util.setOrientation(DeviceOrientation.landscapeLeft);
      }
    
      await Flame.images.loadAll([
    
          ...
    
      ]);
      await Flame.audio.loadAll(
        [
    
         ...
    
        ]
      );
    
      // Disable audio logs since it can confuse the log
      Flame.audio.disableLog();
    
      // Get the screen size
      Size size = await Flame.util.initialDimensions();
    
      // Create a singleton to retrieve the screen size in all app
      Config config = Config(screenSize: size);
    
      // Register singletons to retrieve it later
      Get.put(config);
      Get.put(AudioController());
      Get.put(MyGame());
    
      runApp(Get.find<MyGame>().widget);
      //runApp(MyGame().widget); //Also tried without retrieving the game class from the singleton
    
    
    }
    

    flutter doctor -v

    [√] Flutter (Channel beta, 1.19.0-4.3.pre, on Microsoft Windows [versão 10.0.18363.900], locale pt-BR)
        • Flutter version 1.19.0-4.3.pre at C:\src\flutter
        • Framework revision 8fe7655ed2 (8 days ago), 2020-07-01 14:31:18 -0700
        • Engine revision 9a28c3bcf4
        • Dart version 2.9.0 (build 2.9.0-14.1.beta)
    
    
    [√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
        • Android SDK at C:\Users\Dih\AppData\Local\Android\sdk
        • Platform android-29, build-tools 29.0.3
        • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
        • All Android licenses accepted.
    
    [√] Chrome - develop for the web
        • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
    
    [√] Android Studio (version 4.0)
        • Android Studio at C:\Program Files\Android\Android Studio
        • Flutter plugin version 47.1.2
        • Dart plugin version 193.7361
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    
    [√] VS Code (version 1.46.0)
        • VS Code at C:\Users\Dih\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.11.0
    
    [√] Connected device (2 available)
        • Web Server • web-server • web-javascript • Flutter Tools
        • Chrome     • chrome     • web-javascript • Google Chrome 83.0.4103.116
    
    • No issues found!
    
    Reviewed by d-apps at 2020-07-10 04:08
  • 8. feat: Aligned text in the TextBoxComponent

    Description

    • Added option align in the TextBoxComponent which controls the alignment of text.
    • Added option for the TextBoxComponent to have a fixed size (before the only mode was for the textbox to automatically expand/shrink to fit the text).

    Checklist

    • [x] The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
    • [x] I have read the Contributor Guide and followed the process outlined for submitting PRs.
    • [x] I have updated/added tests for ALL new/updated/fixed functionality.
    • [x] I have updated/added relevant documentation in docs and added dartdoc comments with ///.
    • [x] I have updated/added relevant examples in examples.

    Breaking Change

    • [-] Yes, this is a breaking change.
    • [x] No, this is not a breaking change.

    Related Issues

    Closes #1088

    Reviewed by st-pasha at 2022-05-13 06:55
  • 9. feat(ai): Add Pursue behavior from gdx-ai

    Description

    This is the beginning of the work on porting the gdxAI library into dart and integrating it into the Flame engine.

    This PR adds the Pursue behavior, and implements some of the basic interface classes such as Steerable, Limiter, Location, SteeringBehavior, and SteeringAcceleration.

    I have also made some modifications to the original Pursue algorithm, for comparison the timings of the old and the new algorithm are as follows: | test name | original time | current time | |---------------|---------------|--------------| | pursuit exact | 7.0 | 7.0 | | pursuit 1 | 4.34 | 4.28 | | pursuit 2 | 1000 | 14.34 | | pursuit 3 | 1000 | 2.6 | | pursuit 4 | 12.90 | 4.8 | | pursuit 5 | 20.26 | 10.84 | | pursuit 6 | 1.18 | 1.18 | | chase 1 | 305.6 | 302.8 | | chase 2 | 252.6 | 250.4 | | chase 3 | 17.3 | 16.2 |

    https://user-images.githubusercontent.com/4231472/147298375-8a5de9b3-7a18-41e9-bf1d-9707963347fd.mov

    Checklist

    • [x] The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
    • [x] I have read the Contributor Guide and followed the process outlined for submitting PRs.
    • [x] I have updated/added tests for ALL new/updated/fixed functionality.
    • [x] I have updated/added relevant documentation in docs and added dartdoc comments with ///.
    • [x] I have updated/added relevant examples in examples.

    Breaking Change

    • [x] No, this is not a breaking change.

    Related Issues

    WIP for #1164

    Reviewed by st-pasha at 2021-12-23 07:55
  • 10. feat: Added 1d+2d Perlin and Simplex noise functions

    Description

    These functions are used in games for a variety of purposes: terrain generation, visual effects, randomized motion, textures, enemy spawns, etc, etc.

    This implementation is ported from the original code by Stefan Gustavson, and manually verified that it produces the same values as his C code. The original library had more varieties of noise functions, including 3D- and 4D- noise, as well as noise with gradients and periodic noise. If needed, those other functions can be ported as well.

    Checklist

    • [x] The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
    • [x] I have read the Contributor Guide and followed the process outlined for submitting PRs.
    • [x] I have updated/added tests for ALL new/updated/fixed functionality.
    • [x] I have updated/added relevant documentation in docs and added dartdoc comments with ///.
    • (NA) I have updated/added relevant examples in examples.

    Breaking Change

    • [x] No, this is not a breaking change.

    Related Issues

    WIP for #396

    Reviewed by st-pasha at 2021-12-22 03:43
  • 11. DestroyBody error

    I got this error when I try to destroy the body of the box. Using world.destroyBody(this.brick.body); after they collide. Here's the error log:

    'package:box2d_flame/src/dynamics/world.dart': Failed assertion: line 329 pos 12: 'isLocked() == false': is not true.

    Or does anyone uses different way to destroy the body after collision.

    Hope you'll notice this :)

    Reviewed by HumbleCarl at 2019-09-30 12:21
  • 12. Install Flame audio package crash project if you run with linux

    Current bug behaviour

    Installing the flame_audio package from pub.dev causes a crash if you run the project on linux.

    It works again when uninstalling the package.

    Expected behaviour

    install the package normally.

    Steps to reproduce

    1. Create a flutter project
    2. Install flame_audio package
    3. Run project on linux

    Flutter doctor output

    Doctor summary (to see all details, run flutter doctor -v):
    [✓] Flutter (Channel stable, 3.0.5, on Ubuntu 20.04.4 LTS 5.15.0-43-generic, locale es_ES.UTF-8)
    [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc1)
    [✓] Chrome - develop for the web
    [✓] Linux toolchain - develop for Linux desktop
    [✓] Android Studio (version 2021.2)
    [✓] Android Studio
    [✓] IntelliJ IDEA Ultimate Edition (version 2022.2)
    [✓] VS Code (version 1.70.0)
    [✓] Connected device (2 available)
    [✓] HTTP Host Availability
    
    • No issues found!
    
    

    More environment information

    Log information

    CMake Error at flutter/ephemeral/.plugin_symlinks/audioplayers_linux/linux/CMakeLists.txt:5 (include):
      include could not find load file:
    
        FetchContent
    
    
    CMake Error at /snap/flutter/126/usr/share/cmake-3.10/Modules/FindPkgConfig.cmake:419 (message):
      A required package was not found
    Call Stack (most recent call first):
      /snap/flutter/126/usr/share/cmake-3.10/Modules/FindPkgConfig.cmake:597 (_pkg_check_modules_internal)
      flutter/ephemeral/.plugin_symlinks/audioplayers_linux/linux/CMakeLists.txt:25 (pkg_check_modules)
    
    
    Exception: Unable to generate build files
    
    Reviewed by nmarafo at 2022-08-09 18:16
  • 13. Collision detection improvements

    This is a proposal for some changes to the hitbox/collision-detection system, for the purpose of improving efficiency and interoperability with other parts of Flame. This issue is intended as discussion / collaboration with @spydon, before we start the actual work.

    First problem that needs to be addressed is that currently the collision detection system can only "live" at the root FlameGame level, which is not always optimal. In a more complicated game the game world can be several levels deep in the component tree, or there could be several worlds (say, for each level). So, I suggest then to

    • [ ] implement a mixin similar to HasCollisionDetection, but which could be applied to any Component.
      • This could (in theory) be as easy as changing the on part of the current mixin.

    Second problem is that the current implementation of ShapeHitbox is based on ShapeComponents, not on Shapes. Thus, we need to

    • [ ] create Hitboxes based on Shape class and its descendants.
      • The API of both classes is quite similar already.
      • This would allow us to test for intersections more efficiently (the Shape class has support for intersection detection of convex shapes).
        • In order to take advantage of this algorithm, we'd need to change the API of the current intersections() method; or, rather, create a second more efficient method and deprecate the first. The signature of the new method would be Intersection? intersection(T other);, which is to say it returns null if the two shapes do not intersection, or an Intersection object if they do. The Intersection object can then be queried for the intersection points, or some other intersection properties. However, if the user is not interested in the intersection points - then that calculation can be skipped.
          • the Intersection class could also contain references to the hitboxes + components that are colliding.
          • note that currently Hitbox class is defined as implements GenericCollisionsCallbacks<T>, where T is the derived hitbox type. However, the GenericCollisionsCallbacks class says that T has to be the type of the object to which the hitbox is attached. It looks like a bug to me.
        • the possiblyIntersects() method can be deprecated as well, since the intersection() method covers that use-case.

    The biggest source of inefficiency with the current collision detection system is that whenever any two hitboxes need to be checked for intersection, they are projected into the "absolute" coordinates (i.e. the coordinate system of the canvas). This is expensive: not only some objects never move and therefore don't have to be projected each time, if there are N objects, we currently end up doing O(N^2) projections, whereas simply performing a projection once at the start of a tick and then computing the intersections on those would only be O(N).

    • [ ] Cache projections of each hitbox onto the common collision plane.
      • The "collision plane" here is the common ancestor of all hitboxes, which is marked with the new HasCollisionDetection mixin (see item 1 above).
      • Projections are easy for hitboxes based on Shape class, which already implements the project() method.
      • We would need to keep track of which components have moved in the last tick, and re-calculate their projections.

    Current ShapeComponent class (and descendants) contains both the "shape-component" logic, and also the logic for computing intersections between various shapes. This is too jumbled: we should

    • [ ] Implement clean ShapeComponent class to be used in examples etc.
      • Only deals with drawing / moving a shape;
      • Supports multiple paints (so that you can have a rectangle with fill, border and shadow);
      • Has a simple flag to also add a hitbox, but otherwise handles hitboxes in the same way as other components do.
    Reviewed by st-pasha at 2022-08-08 01:38
  • 14. feat: Propagate cursor hover events to child Components

    Description

    This PR adds the HasCursorHandlerComponents mixin on FlameGame, and the CursorHandler mixin on Component. Heavily inspired by HasKeyboardHandlerComponents.

    HasCursorHandlerComponents propagates cursor hover events to child CursorHandler Components, making these events easier to handle.

    Checklist

    • [x] The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
    • [x] I have read the Contributor Guide and followed the process outlined for submitting PRs.
    • [ ] I have updated/added tests for ALL new/updated/fixed functionality.
    • [ ] I have updated/added relevant documentation in docs and added dartdoc comments with ///.
    • [ ] I have updated/added relevant examples in examples.

    Breaking Change

    • [ ] Yes, this is a breaking change.
    • [x] No, this is not a breaking change.

    Related Issues

    Closes #1818

    Reviewed by garysm at 2022-08-05 06:05
  • 15. HasDecorator with PositionComponent

    What could be improved

    Currently, the HasDecorator mixin works by wrapping the component's renderTree() with the decorator's apply() method. This works fine for position-independent decorators (such as those that manipulate the paint), but is problematic for decorators that need to know the component's coordinates.

    Specifically, the PositionComponent in its renderTree method applies the coordinate transformation, which affects the component's render() and its children. However, this coordinate transform does not affect the decorator, which is applied outside. This is problematic for such decorators as Rotate3DDecorator or Shadow3DDecorator when the underlying component moves, since it requires some external logic to keep updating the decorators so that they are in sync with the underlying component.

    How to improve

    I'm currently considering the following approaches:

    • Option 1: Add decorator property directly to the PositionComponent, so that its renderTree can apply the decorator after the coordinate transform.

      Pros:

      • Cleaner code;
      • No need to explicitly add HasDecorator mixin to position components;

      Cons:

      • Extra property decorator inside the PositionComponent class. Though if unused, it will be null, and won't take up much resources.
    • Option 2: Inside the HasDecorator mixin check if the current component is a PositionComponent, and if it is, then perform renderTree which does not invoke super.renderTree but instead applies coordinate transform and renders children manually.

      Pros:

      • There is no decorator property unless explicitly requested by the user;

      Cons:

      • Duplicates code from renderTree methods of PositionComponent and Component;
      • More bug-prone in case the renderTree code is updated in those classes;

    I'm leaning towards Option 1 here, but was wondering what do you guys think or if there's perhaps an Option 3 that I'm missing ?

    Reviewed by st-pasha at 2022-07-31 04:11
  • 16. feat: Added HasGameReference mixin

    Description

    This almost exactly like the current HasGameRef mixin, except that:

    • The property is called game instead of gameRef (the "gameRef" violates Dart naming conventions against using abbreviations in variable names);
    • The template type T supports all Games, not only FlameGames;
    • Better integration with the SingleGameInstance mixin.

    Checklist

    • [x] The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
    • [x] I have read the Contributor Guide and followed the process outlined for submitting PRs.
    • [x] I have updated/added tests for ALL new/updated/fixed functionality.
    • [x] I have updated/added relevant documentation in docs and added dartdoc comments with ///.
    • [-] I have updated/added relevant examples in examples.

    Breaking Change

    • [-] Yes, this is a breaking change.
    • [x] No, this is not a breaking change.

    Related Issues

    Reviewed by st-pasha at 2022-07-30 19:28
  • 17. Sharing SpriteAnimation

    What could be improved

    Would be better to warn users when same SpriteAnimation is shared between multiple SpriteAnimationComponents or SpriteAnimationGroupComponents.

    Why should this be improved

    Right now, if a SpriteAnimation is shared between multiple components, it gets ticked by all the components that are using it, causing the animation to essentially speed up.

    Any risks?

    None that I can think of.

    More information

    Reviewed by ufrshubham at 2022-07-30 14:47

Related

Warrior Runner - Game made with Flutter and Flame game engine
Warrior Runner - Game made with Flutter  and Flame game engine

Warrior Runner - Game made with Flutter Demo and Screenshot Flutter Version Used : 1.22.4 flame: 0.29.3 hive: 1.5.0-pre Learing Resources: Create a Mo

Aug 7, 2022
A simple 2D multiplayer online game built using Flutter and Flame engine
A simple 2D multiplayer online game built using Flutter and Flame engine

Club Penguin Introduction ?? Club Penguin A multiplayer game involving penguins and anonymous chat in a virtual 2D world Before we start, you can take

Jun 2, 2022
A Flutter RPG Game Engine.
A Flutter RPG Game Engine.

DevilF 游戏引擎 A Flutter RPG Game Engine. 一款使用Flutter开发的RPG游戏引擎。 引擎介绍 (Devil Fighter) 自从有了Flutter,轻松实现了三端跨平台,并且不增加包体积,就能拥有一套Native游戏引擎,为APP游戏化提供了更多可能性。 开

Jul 21, 2022
A Widget-based Game Engine For Flutter

illume A Widget-based Game Engine for Flutter Illume is a simple Flutter game engine which uses widgets to create game objects instead of sprites in n

Aug 7, 2022
🦖 🦖 🦖 Flutter 2D runner game using Flame engine.
🦖 🦖 🦖 Flutter 2D runner game using Flame engine.

t_rex_flame T-rex is the 2D game where you play as a cute little t-rex using Flame engine. All you need do it avoid being hit by enemies too many time

Aug 2, 2022
Dungeon Fantasy - A simple RPG game built with Bonfire and Flame engine

dungeon_fantasy A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

Dec 28, 2021
Mason templates for the Flame Engine

Flame Bricks ?? ?? Flame Bricks is a collection of Mason's templates to help people bootstrap classes for the Flame engine. How to use To learn more a

Nov 27, 2021
A graphics engine for creating 2D games. Creating objects based on composition and painting on canvas.
A graphics engine for creating 2D games. Creating objects based on composition and painting on canvas.

A graphics engine for creating 2D games. Creating objects based on composition and painting on canvas.

Mar 11, 2022
uses Firebase's ML Engine to recognize murals in San Diego's Chicano park.

ABOUT Flutter-based app that uses Firebase's ML Engine to recognize murals in San Diego's Chicano park. App can be run on iOS and android and the trai

Jan 3, 2022
An application cum Game-based App built using Flutter that compose a mind-tricked word game, Just for fun.

destini_challenge A new Flutter application. Getting Started This project is a starting point for a Flutter application. A few resources to get you st

Feb 3, 2022
M.U.D. Role-playing text-based game. A multiple-choice multiplayer interactive game developed on Flutter (Android, iOS, Windows, Web)
M.U.D. Role-playing text-based game. A multiple-choice multiplayer interactive game developed on Flutter (Android, iOS, Windows, Web)

Teia M.U.D. Role-playing text-based game. A multiple-choice multiplayer interactive game developed on Flutter (Android, iOS, Windows, Web). The main f

Feb 17, 2022
Snake-Game - A flutter based classic snake game with nothing just and just a feel to have play

snake_game This is a simple snake Game under development made with the help of y

Mar 22, 2022
Game characters ui - A redesign of a game characters app using flutter

Game characters ui - A redesign of a game characters app using flutter

Jul 30, 2022
Flutter Switch Game: Get Fun With Play This Game
Flutter Switch Game: Get Fun With Play This Game

switch_game A new Flutter project. Getting Started Try Swap red circle to green

Jun 17, 2022
A simple dice game built using Flutter, that allows users to engage in a dice game

A simple dice game built using Flutter, that allows users to engage in a dice game. Each player rolls the dice and the highest value number that you can make WINS!

Jun 15, 2022
Chess-game - Some simple lines of coding and made this awesome looking full functional chess board game
Chess-game - Some simple lines of coding and made this awesome looking full functional chess board game

flutter simple chess game It's a flutter chess game application with fast code.

Jun 17, 2022
Wordle-flutter - A Wordle Game Made With Flutter
Wordle-flutter - A Wordle Game Made With Flutter

wordle with flutter A small wordle made with flutter Getting Started Just a 4 ho

Apr 13, 2022
Tic-tac-toe-flutter - Multi player TIC-TAC-TOE game made using flutter
Tic-tac-toe-flutter - Multi player TIC-TAC-TOE game made using flutter

tic_tac_toe Multi player TIC-TAC-TOE game made using flutter State Management li

Feb 22, 2022
How to build a Match-3 game, like Candy Crush, Bejeweled, FishDom… in Flutter.
How to build a Match-3 game, like Candy Crush, Bejeweled, FishDom… in Flutter.

flutter_crush How to build a Math-3 game, like Candy Crush, Bejeweled, FishDom… in Flutter. Source code of the article available on didierboelens.com

Aug 6, 2022