A minimalist Flutter game engine

Overview

flame

A minimalistic Flutter game engine.

Test


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


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.

Many examples of different features can be found here and a good starting example can be found here.

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

Help

We have a Flame help channel on Fireslime'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.

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.
Issues
  • null safety

    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
    opened by lig 28
  • Support `shouldRepaint` method

    Support `shouldRepaint` method

    In my game, sometimes there is no pixel change at all, it's kind of waste to repaint if I know Skia should not.

    enhancement 
    opened by truongsinh 22
  • [Box2D] Random deletion of body components in release mode

    [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 🙏

    opened by tommybuonomo 21
  • Game not running on web

    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!
    
    question 
    opened by d-apps 21
  • DestroyBody error

    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 :)

    question 
    opened by HumbleCarl 20
  • Flame 1.0.0-rc9 Tap regions off when moving camera

    Flame 1.0.0-rc9 Tap regions off when moving camera

    First of all, thank you for working on this game framework, it's really awesome!

    I am trying out 1.0.0-rc8 with Flutter 2.0.3 (but I was having the issue with my game right before Flutter 2.0 released, no change in behavior pre-2.0)

    The bug: If the camera is moved, tappable items stay in the same place on the screen even though the camera moves and the object draws relative to where the camera is. Drawing relative fine, tapping relative bad.

    This is a little difficult to explain.

    If foo is in position (100, 100) and the camera is at the origin (0, 0) the tap regions are normal, you can tap on your object and it registers.

    If foo is in position (100, 100) and the camera is at position(200, 200), you can still tap around physical (100, 100) on your phone and trigger the tap, if you tap on the object you see (translated from the camera move), no tap is registered.

    I made an unlisted YouTube video showing this behavior: https://youtu.be/n3L1GG3wmvo

    A similar behavior happens when the anchor point is not in the center. The video shows this as well.

    Source code to play with

    import 'package:flame/components.dart';
    import 'package:flame/game.dart';
    import 'package:flutter/material.dart';
    
    void main() {
      runApp(App());
    }
    
    
    class App extends StatelessWidget {
      final GameManager gameManager = GameManager();
      @override
      Widget build(BuildContext context) {
        return GameWidget(game: gameManager);
      }
    }
    
    
    class GameManager extends BaseGame with HasTapableComponents {
    
      Tile tapMeTile = Tile(Color(0xFF0000FF));
      Tile cameraFollowTile = Tile(Color(0xFF800080));
    
      @override
      Future<void> onLoad() {
        tapMeTile.position = Vector2(200, 200);
        cameraFollowTile.position = Vector2(100, 100);
        add(tapMeTile);
        add(cameraFollowTile);
        // camera.follow = cameraFollowTile;
        // camera.followComponent(cameraFollowTile);
        return super.onLoad();
      }
    }
    
    
    class Tile extends PositionComponent with Tapable {
    
      bool toggle = false;
      Color untappedColor;
    
      Tile(Color untappedColor) {
        size = Vector2(50, 50);
        this.untappedColor = untappedColor;
        // anchor = Anchor.center;
      }
    
      @override
      bool onTapDown(TapDownDetails details) {
        toggle = !toggle;
        return true;
      }
    
      @override
      void render(Canvas canvas) {
        Rect rect = Rect.fromCircle(
          center: position.toOffset(),
          radius: size.x/2,
        );
        canvas.drawRect(rect, paint());
        super.render(canvas);
      }
    
      Paint paint() {
        Color color = toggle ? Color(0xFF00FF00) : untappedColor;
        return Paint()..color = color;
      }
    }
    

    pubspec.yml

    name: flame_test_ontap
    description: A new Flutter project.
    publish_to: 'none'
    version: 1.0.0+1
    
    environment:
      sdk: ">=2.7.0 <3.0.0"
    
    dependencies:
      flutter:
        sdk: flutter
      flame: 1.0.0-rc8
    
    dev_dependencies:
      flutter_test:
        sdk: flutter
    
    flutter:
      uses-material-design: true
    

    Edit: I updated the title to rc9 to reflect that it is broken in rc9

    bug 
    opened by nateonguitar 19
  • Enable `avoid_function_literal_in_foreach_calls` lint and update code

    Enable `avoid_function_literal_in_foreach_calls` lint and update code

    Per the effective dart style guide:

    forEach() functions are widely used in JavaScript because the built in for-in loop doesn’t do what you usually want. In Dart, if you want to iterate over a sequence, the idiomatic way to do that is using a loop.

    It doesn't explicitly say it, but I believe that .forEach() with a function literal has the additional overhead of creating a new closure each time the code is run.

    We could enable the lint avoid_function_literals_in_foreach_calls which would enforce this. However, Flame is fast as it is, so I am not sure that it makes much of a different, and since this is a significant style change for the library, I thought I would open this RFC first. When applying the lint locally, it picks up 43 new issues. If the lint is acceptable, I would be willing to open a PR to enable the lint and fix the current issues.

    Consider this code from base_game.dart:

    // https://github.com/flame-engine/flame/blob/master/lib/game/base_game.dart#L102
      void render(Canvas canvas) {
        canvas.save();
        components.forEach((comp) => renderComponent(canvas, comp)); // <- linter warning
        canvas.restore();
      }
    
    // Could be re-written with a for-loop and no callback
      void render(Canvas canvas) {
        canvas.save();
        for (final comp in components) {
          renderComponent(canvas, comp);
        }
        canvas.restore();
      }
    
    opened by christopherfujino 19
  • ComposedComponent and Resizable are tricky to use together with base classes

    ComposedComponent and Resizable are tricky to use together with base classes

    So bear with me me on this one... I'm not sure if it's really just impossible to simplify due to how inheritance has to work with mixins but I recently spent over an hour trying to figure out why Resizable.resize wasn't being called, only to realize it was due to the order of inheritance with ComposedComponent.

    Essentially, I have a base class called PhysicalComponent which most of the objects in my game inherit from. I made PhysicalComponent mixin ComposedComponent because essentially all of the child classes are composites.

    Then, later on I created my a Player which needs to know the screen size for various logic.

    abstract class PhysicalComponent extends PositionComponent with ComposedComponent {
      ...
    }
    
    class TouchInput extends Component with Resizable { 
      ...
    }
    
    class Player extends PhysicalComponent with Resizable { 
      TouchInput _input = TouchInput(); 
      
      Player() {
        this.add(_input);
      }
    }
    
    class MyGame extends BaseGame {
      BaseGame() {
        final player = Player();
        add(player);
      }
    }
    

    So the problem is, in the above code TouchInput.resize is never called because in Player Resizable.children shadows ComposedComponent.children from the parent class, and then children() always returns an empty list!

    Anyways, maybe I just shouldn't put ComposedComponent on a base class, but maybe there is a way to avoid this problem in the class design of these utility classes?

    question 
    opened by kurtome 19
  • Unable to display a simple SpriteWidget

    Unable to display a simple SpriteWidget

    Hi all - I'm trying a very simple task to see if I can use Flame as a widget for my RPG made with Flutter. I try to display a SpriteWidget showing 1 of the many images from a large sprite sheet.

    I'm using Flame 1.0.0 RC 15.

    Any help you can provide is greatly appreciated. Thanks!

    Current bug behaviour

    The SpriteWidget is drawn in the Widget Tree but the screen is empty - image is not displayed.

    Expected behaviour

    Display the image.

    Steps to reproduce

    // main.dart
    
    import 'package:flame/extensions.dart';
    import 'package:flutter/material.dart';
    import 'package:flutter/services.dart';
    import 'package:flame/src/spritesheet.dart';
    import 'package:flame/src/widgets/sprite_widget.dart';
    import 'package:flame/flame.dart';
    import 'dart:async';
    import 'dart:ui' as images;
    
    void main() {
      runApp(MyApp());
    }
    
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);
        return MaterialApp(
          title: 'Flutter Demo',
          theme: ThemeData(
            primarySwatch: Colors.blue,
          ),
          home: MyHomePage(title: 'Flutter Demo Home Page'),
        );
      }
    }
    
    class MyHomePage extends StatefulWidget {
      MyHomePage({Key? key, required this.title}) : super(key: key);
    
      final String title;
      @override
      _MyHomePageState createState() => _MyHomePageState();
    }
    
    class _MyHomePageState extends State<MyHomePage> {
      SpriteSheet? spriteSheet;
    
      @override
      void dispose() {
        super.dispose();
      }
    
      @override
      void initState() {
        super.initState();
        asyncInitState();
      }
    
      Future<void> asyncInitState() async {
        await Flame.images.load('loot.png');
        setState(() {
          spriteSheet = SpriteSheet.fromColumnsAndRows(image: Flame.images.fromCache('loot.png'), columns: 5, rows: 14);
        });
      }
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
            appBar: null,
            body: Center(
              child: SingleChildScrollView(
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    Padding(
                      padding: const EdgeInsets.symmetric(vertical: 32.0),
                      child: spriteSheet == null
                          ? null
                          : SpriteWidget(sprite: spriteSheet!.getSprite(2, 2)),
                    ),
                  ],
                ),
              ),
            ));
      }
    }
    
    

    Flutter doctor output

    [✓] Flutter (Channel stable, 2.5.2, on macOS 11.1 20C69 darwin-x64, locale en-CA)
        • Flutter version 2.5.2 at /Users/moonshotquest/Developer/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 3595343e20 (6 days ago), 2021-09-30 12:58:18 -0700
        • Engine revision 6ac856380f
        • Dart version 2.14.3
    
    [✗] Android toolchain - develop for Android devices
        ✗ Unable to locate Android SDK.
          Install Android Studio from: https://developer.android.com/studio/index.html
          On first launch it will assist you in installing the Android SDK components.
          (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
          If the Android SDK has been installed to a custom location, please use
          `flutter config --android-sdk` to update to that location.
    
    
    [✓] Xcode - develop for iOS and macOS
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 12.4, Build version 12D4e
        • CocoaPods version 1.10.1
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [!] Android Studio (not installed)
        • Android Studio not found; download from https://developer.android.com/studio/index.html
          (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
    
    [✓] VS Code (version 1.60.2)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.27.0
    
    [✓] Connected device (2 available)
        • iPhone X (mobile) • XXXXXXXXXXXXXXXXXXXXXXXXXXX • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
        • Chrome (web)      • chrome                               • web-javascript • Google Chrome 92.0.4515.107
    

    More environment information

    Log information

    No error displayed.

    bug 
    opened by MoonshotQuest 19
  • Game as Widget - Improvements

    Game as Widget - Improvements

    There are a couple of things that requires doing because of #50. These are important things to fix, so I'm adding here for us not to forget!

    • Fix all examples, docs and guides to use the new, non-deprecated syntax.
    • Fix the following problem: now that Game is itself a stateless widget, if cannot have non final (changing) variables. However, a game instance should be able to add non final references as desired. In fact, base game has many, and its giving the following warning:

    This class (or a class which this class inherits from) is marked as '@immutable', but one or more of its instance fields are not final: BaseGame.components, BaseGame._addLater, BaseGame.size, BaseGame.camera, BaseGame._dts

    Other stuff added by the user will give the same problem. So, we need to find a way to fix this ASAP.

    bug 
    opened by luanpotter 17
  • Fix parallax loading with different loading times

    Fix parallax loading with different loading times

    Description

    Fix parallax loading with different loading times

    Checklist

    Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

    • [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • [x] My PR includes unit or integration tests for all changed/updated/fixed behaviors and are passing (See Contributor Guide).
    • [x] My PR does not decrease the code coverage, or I have a very special case and explained on the PR description why this PR decreases the coverage.
    • [x] I updated/added relevant documentation (doc comments with ///) and updated/added examples in doc/examples.
    • [x] I have formatted my code with flutter format and the flutter analyze does not report any problems.
    • [x] I read and followed the Flame Style Guide.
    • [x] I have added a description of the change under [next] in CHANGELOG.md.
    • [x] I removed the Draft status, by clicking on the Ready for review button in this PR.
    • [x] I am willing to follow-up on review comments in a timely manner.

    Breaking Change

    Does your PR require Flame users to manually update their apps to accommodate your change?

    • [ ] Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md).
    • [x] No, this is not a breaking change.

    Related Issues

    #1154

    opened by spydon 0
  • Parallax Component does not work with more than 3 images

    Parallax Component does not work with more than 3 images

    Hi, I am running flame: ^1.0.0-releasecandidate.17 and implementing parallax component with 3 images with following code, it works fine. Images are running faster from background to front.

    If I uncomment commented lines and add one or 2 images, velocity gets weird and background goes faster than front images!

    Code here:

    class MyParallaxComponent extends ParallaxComponent {
      @override
      Future<void> onLoad() async {
        parallax = await gameRef.loadParallax([
          ParallaxImageData('parallax-background/spring/bgr_spring1.png'),
          ParallaxImageData('parallax-background/spring/bgr_spring2.png'),
          ParallaxImageData('parallax-background/spring/bgr_spring3.png'),
          // ParallaxImageData('parallax-background/spring/bgr_spring4.png'),
          // ParallaxImageData('parallax-background/spring/bgr_spring5.png')
        ],
            baseVelocity: Vector2(10, 0),
            velocityMultiplierDelta: Vector2(1.3, 1.0));
      }
    }
    
    class MyGame extends FlameGame {
      @override
      Future<void> onLoad() async {
        await super.onLoad();
        add(MyParallaxComponent());
      }
    }
    
    bug waiting release 
    opened by tiofabby 7
  • Removed fallback on web for drawAtlas

    Removed fallback on web for drawAtlas

    Description

    Initial testing if the fallback for the drawAtlas method is still needed for the web.

    Checklist

    Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

    • [ ] I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • [ ] My PR includes unit or integration tests for all changed/updated/fixed behaviors and are passing (See Contributor Guide).
    • [ ] My PR does not decrease the code coverage, or I have a very special case and explained on the PR description why this PR decreases the coverage.
    • [ ] I updated/added relevant documentation (doc comments with ///) and updated/added examples in doc/examples.
    • [ ] I have formatted my code with flutter format and the flutter analyze does not report any problems.
    • [ ] I read and followed the Flame Style Guide.
    • [ ] I have added a description of the change under [next] in CHANGELOG.md.
    • [ ] I removed the Draft status, by clicking on the Ready for review button in this PR.
    • [ ] I am willing to follow-up on review comments in a timely manner.

    Breaking Change

    Does your PR require Flame users to manually update their apps to accommodate your change?

    • [ ] Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md).
    • [ ] No, this is not a breaking change.

    Related Issues

    Replace this paragraph with a list of issues related to this PR from the issue database. Indicate, which of these issues are resolved or fixed by this PR.

    opened by wolfenrain 0
  • Flame tiled web rendering vertical lines issue while camera movement

    Flame tiled web rendering vertical lines issue while camera movement

    Current bug behaviour

    Expected behaviour

    Vertical lines issue in web whenever camera moves, in android as APK there is no issue. Those vertical lines exist only for the web.

    https://user-images.githubusercontent.com/52130837/143884831-18c50e76-03c2-4afe-8829-4437223b542d.mp4

    Steps to reproduce

    https://beach-website.web.app/#/ use arrow keys to move the player

    repo: https://github.com/Jcupzz/beach_hack_website_2022

    Flutter doctor output

    Output of: flutter doctor -v
    

    More environment information

    flame: ^1.0.0-releasecandidate.16 flame_tiled: ^1.0.0-releasecandidate.15

    Log information

    Enter log information in this code block
    

    More information

    bug 
    opened by Jcupzz 0
  • Broken test framework

    Broken test framework

    Writing this just to keep track of this issue. All details I have so far are here: https://github.com/flame-engine/flame/pull/1150

    bug 
    opened by luanpotter 0
  • Broken test framework!

    Broken test framework!

    This is not a PR to be merged; rather it's a MWE reproducing a terrible, terrible bug.

    I don't know the reason, but if we have several await's inside a test, the test framework is not awaiting until the end. Runt the test added:

    1. via f test test/timer_test.dart
    2. via f test (run all tests)
    3. via IDE
    4. github actions are green

    In all cases, the test go up to a certain number, never past 8. And therefore the test passes, because the assertions in the end never run.

    Unless I am doing something really stupid, this could be a MASSIVE bug with flame_test (but more likely with flutter_test itself), that compromises our entire test suit and stability.

    I'm using flutter stable btw. I will try to repro this with flutter test directly, bypassing flame_test -- I imagine the issue has to come from below as we don't seem to do anything at the flame_test level that could cause this.

    opened by luanpotter 4
  • Fix render order of components and add tests

    Fix render order of components and add tests

    Description

    I am porting Gravity Runner (aka Gravitational Waves) to the latest Flame. I think it will be very good to have a fully functional, complete big game example before release. Most of it was painless or even deleting stuff that we had incorporated from GR to Flame (like camera, viewport, etc). However, I did come out with a list of things that were easier to do before. So I am putting out a few PRs. And also I found this bug where component rendering order was not respected for isHud components. This fixes that but in order to add a test I am modifying canvas_test to better test save/restore: https://github.com/bluefireteam/canvas_test/pull/3

    Checklist

    Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

    • [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • [x] My PR includes unit or integration tests for all changed/updated/fixed behaviors and are passing (See Contributor Guide).
    • [x] My PR does not decrease the code coverage, or I have a very special case and explained on the PR description why this PR decreases the coverage.
    • [x] I updated/added relevant documentation (doc comments with ///) and updated/added examples in doc/examples.
    • [x] I have formatted my code with flutter format and the flutter analyze does not report any problems.
    • [x] I read and followed the Flame Style Guide.
    • [x] I have added a description of the change under [next] in CHANGELOG.md.
    • [x] I removed the Draft status, by clicking on the Ready for review button in this PR.
    • [x] I am willing to follow-up on review comments in a timely manner.

    Breaking Change

    Does your PR require Flame users to manually update their apps to accommodate your change?

    • [ ] Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md).
    • [x] No, this is not a breaking change.
    opened by luanpotter 3
  • Flame-rive package documentation

    Flame-rive package documentation

    There is no documentation for the flame-river package within the flame-engine site

    bug 
    opened by nmarafo 0
  • `flipHorizontallyAroundCenter` changes component position during position change

    `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

    bug 
    opened by OlegNovosad 16
  • [WIP] Effect controllers restructuring

    [WIP] Effect controllers restructuring

    Description

    Given the new requirement that effect controllers must be able to run backwards in time, and owing to the considerable complexity this entails, this PRs decomposes effect controllers into multiple small building blocks. The main API of EffectController remains mostly unchanged (with few new properties added), but the implementation of various effect controllers changes radically. In particular, there is no more class StandardEffectController. Instead, there are several smaller classes:

    • LinearEffectController,
    • CurvedEffectController,
    • ReverseLinearEffectController,
    • ReverseCurvedEffectController,
    • DelayedEffectController,
    • RepeatedEffectController,
    • InfiniteEffectController,
    • PauseEffectController,
    • SequenceEffectController.

    In addition, function standardController() has exactly the same API as old StandardEffectController, and can be used in its place.

    This new structure gives several advantages:

    • Implementing "backwards in time" functionality is much easier for each small building block. My attempts at implementing the same functionality within the old StandardEffectController were producing an incomprehensible mess.
    • SimpleEffectController is no longer needed, the standardController() function will use as little or as many building blocks as necessary to create the effect controller.
    • The new system allows to build custom effect controllers very easily.

    WIP because still need more tests.

    Checklist

    • [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • [ ] My PR includes unit or integration tests for all changed/updated/fixed behaviors and are passing (See Contributor Guide).
    • [ ] My PR does not decrease the code coverage, or I have a very special case and explained on the PR description why this PR decreases the coverage.
    • [x] I updated/added relevant documentation (doc comments with ///) and updated/added examples in doc/examples.
    • [x] I have formatted my code with flutter format and the flutter analyze does not report any problems.
    • [x] I read and followed the Flame Style Guide.
    • [ ] I have added a description of the change under [next] in CHANGELOG.md.
    • [ ] I removed the Draft status, by clicking on the Ready for review button in this PR.
    • [x] I am willing to follow-up on review comments in a timely manner.

    Breaking Change

    • [x] Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md).
    opened by st-pasha 0
Releases(1.0.0-releasecandidate.14)
  • 1.0.0-releasecandidate.14(Sep 17, 2021)

    CHANGELOG

    [1.0.0-releasecandidate.14]

    • Reset effects after they are done so that they can be repeated
    • Remove integrated joystick buttons
    • Add MarginHudComponent, used when components need to have a margin to the viewport edge
    • Refactor JoystickComponent
    • Add SpriteAnimationWidget.asset
    • Add SpriteWidget.asset
    • Add SpriteButton.asset
    • Add NineTileBox.asset
    • Fix resolution of TextBoxComponent
    • Add BaseGame.remove and BaseGame.removeAll helpers for removing components
    • Add BaseComponent.remove and BaseComponent.removeAll helpers for removing children
    • Rename Camera.cameraSpeed to Camera.speed
    • Rename addShape to addHitbox in Hitbox mixin
    • Fix bug with Events and Draggables
    • Add generics to components with HasGameRef so that they can be extended and have another gameRef
    • Fix parallax fullscreen bug when game is resized
    • Generalize paint usage on components
    • Create OpacityEffect
    • Create ColorEffect
    • Adding ability to pause SpriteAnimationComponent
    • Adding SpriteGroupComponent
    • Fix truncated last frame in non-looping animations
    • Default size of SpriteComponent is srcSize instead of spritesheet size
    • Export test helper methods
    • Rename ScaleEffect to SizeEffect
    • Introduce scale on PositionComponent
    • Add ScaleEffect that works on scale instead of size
    • Add class NotifyingVector2
    • Add class Transform2D
    • Added helper functions testRandom() and testWidgetsRandom()
    • Remove FPSCounter from BaseGame
    • Refactor PositionComponent to work with Transform2D: the component now works more reliably when nested
    • Properties renderFlipX, renderFlipY removed and replaced with methods flipHorizontally() and flipVertically().
    • Method .angleTo removed as it was not working properly.
    • In debug mode PositionComponent now displays an indicator for the anchor position.
    • Update Camera docs to showcase usage with Game class
    • Fixed a bug with worldBounds being set to null in Camera
    • Remove .viewport from BaseGame, use camera.viewport instead
    • MockCanvas is now strongly typed and matches numeric coordinates up to a tolerance
    • Add loadAllImages to Images, which loads all images from the prefixed path
    • Reviewed the keyboard API with new mixins (KeyboardHandler and HasKeyboardHandlerComponents)
    • Added FocusNode on the game widget and improved keyboard handling in the game.
    • Added ability to have custom mouse cursor on the GameWidget region
    • Change sprite component to default to the Sprite size if not provided
    • TextBoxComponent waits for cache to be filled on onLoad
    • TextBoxComponent can have customizable pixelRatio
    • Add ContainsAtLeastMockCanvas to facilitate testing with MockCanvas
    • Support for drawImage for MockCanvas
    • Game is now a Component
    • ComponentEffect is now a Component
    • HasGameRef can now operate independently from Game
    • initialDelay and peakDelay for effects to handle time before and after an effect
    • component.onMount now runs every time a component gets a new parent
    • Add collision detection between child components
    Source code(tar.gz)
    Source code(zip)
  • flame_oxygen-0.1.0-releasecandidate.13(Sep 6, 2021)

  • 1.0.0-releasecandidate.13(Jul 8, 2021)

    [1.0.0-releasecandidate.13]

    • Fix camera not ending up in the correct position on long jumps
    • Make the JoystickPlayer a PositionComponent
    • Extract shared logic when handling components set in BaseComponent and BaseGame to ComponentSet.
    • Rename camera.shake(amount: x) to camera.shake(duration: x)
    • Fix SpriteAnimationComponent docs to use Future.wait
    • Add an empty postRender method that will run after each components render method
    • Rename Tapable to Tappable
    • Fix SpriteAnimationComponent docs to use Future.wait
    • Add an empty postRender method that will run after each components render method
    • Rename HasTapableComponents to HasTappableComponents
    • Rename prepareCanvas to preRender
    • Add intensity to Camera.shake
    • FixedResolutionViewport to use matrix transformations for Canvas
    Source code(tar.gz)
    Source code(zip)
  • 1.0.0-rc10(May 4, 2021)

    [1.0.0-rc10]

    • Updated tutorial documentation to indicate use of new version
    • Fix bounding box check in collision detection
    • Refactor on flame input system to correctly take camera into account
    • Adding SpriteAnimationGroupComponent
    • Allow isometric tile maps with custom heights
    • Add a new renderRect method to Sprite
    • Addresses the TODO to change the camera public APIs to take Anchors for relativePositions
    • Adds methods to support moving the camera relative to its current position
    • Abstracting the text api to allow custom text renderers on the framework
    • Set the same debug mode for children as for the parent when added
    • Fix camera projections when camera is zoomed
    • Fix collision detection system with angle and parentAngle
    • Fix rendering of shapes that aren't HitboxShape
    Source code(tar.gz)
    Source code(zip)
  • 1.0.0-rc7(Feb 25, 2021)

  • 0.11.1(Apr 19, 2019)

    [0.11.1]

    • Fixed lack of paint update when using AnimationAsWidget as pointed in #78 (thanks, @renancarujo)
    • Added travis (thanks, @renancarujo)

    [0.11.0]

    • Implementing low latency api from audioplayers (breaking change)
    • Improved examples by adding some instructions on how to run
    • Add notice on readme about the channel
    • Upgrade path_provider to fix conflicts
    Source code(tar.gz)
    Source code(zip)
  • 0.10.0(Jan 11, 2019)

    • Fixing a few minor bugs, typos, improving docs
    • Adding the Palette concept: easy access to white and black colors/paints, create your palette to keep your game organized.
    • Adding the Anchor concept: specify where thins should anchor, added to PositionComponent and to the new text related features.
    • Added a whole bunch of text related components: TextConfig allows you to easily define your typography information, TextComponent allows for easy rendering of stuff and TextBox can make sized texts and also typing effects.
    • Improved Utils to have better and more concise APIs, removed unused stuff.
    • Adding TiledComponent to integrate with tiled
    Source code(tar.gz)
    Source code(zip)
  • 0.9.0(Jul 11, 2018)

    Updating to the new version of audioplayers, there was a huge refactoring and some functions were delegated to the lib. Also, minor APIs tweaks for flame.

    Source code(tar.gz)
    Source code(zip)
  • 0.8.0(Dec 22, 2017)

    This is major update, even though we are keeping things in alpha (version 0.*)

    Several major upgrades regarding the component system, new component types, Sprites and SpriteSheets, better image caching, several improvements with structure, a BaseGame, a new Game as a widget, that allows you to embed inside apps and a stop method. More minor changes.

    An updated tutorial is on the way!

    Source code(tar.gz)
    Source code(zip)
Owner
Flame Engine
2D game engine built on top of Flutter
Flame Engine
A Flutter RPG Game Engine.

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

zhaoqipeng 19 Nov 7, 2021
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

dev_allauddin 4 Nov 17, 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

Flame Engine 21 Nov 26, 2021
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

Didier Boelens 407 Nov 21, 2021
a tetris game powered by flutter. 使用flutter开发俄罗斯方块。

English introduction Please view README_EN Flutter俄罗斯方块 使用Flutter开发的俄罗斯方块游戏。支持 Android, iOS, Windows, mac, Linux 以及 web. 参考来源于 vue-tetris 。 如何开始 自行编译

Bin Yang 1.3k Nov 24, 2021
Party Charades game created in Flutter.

Party Flutter Mobile party game implemented in Flutter framework. Its been heavily inspired by the Heads Up! game: Get a group of friends (at least 3

Kamil Rykowski 162 Sep 9, 2021
Cyberpunk-inspired puzzle game prototype created with Flutter and Flame #Hack20 #FlutterHackathon

Ghost Rigger Prototype of a cyberpunk-inspired puzzle game set in a dystopian future: In the year 2078, the megacorporation Native Development Initiat

Float like a dash Sting like a dart 157 Nov 17, 2021
A game powered by Flutter and Flame

Flutters About Flutters is a demo game powered by Flutter and Flame. I wrote it to test out its performance and gaming capabilities and decided to ope

Florentin / 珞辰 160 Nov 25, 2021
Game RPG build by Flame Flutter

Darkness Dungeon Game developed for the purpose of testing the use of the Bonfire package! Download APK Used packages: Bonfire - Flame - Used sprites:

Rafael Almeida Barbosa 177 Nov 17, 2021
Watermelon is a game developed using Flutter+Flame+Forge2D. 合成大瓜是使用Flutter+Flame+Forge2D开发的一个开源小游戏(Flutter版合成大西瓜)

合成大瓜 简介 合成大瓜是使用Flutter+Flame+Forge2D开发的一个开源小游戏。 我在微伞小游戏开发的《合成大西瓜》的基础上将其移植到 Flutter 平台,并添加了以下新特性: 支持自定义背景图 支持重力感应操控 支持修改图片素材 支持反向合成小瓜 支持只生成小/大瓜 内置多套游戏主

null 54 Oct 25, 2021
Simple Flappy Bird Game with the most functionalities developed in Flutter

flappy_bird Flutter Game App for Graphics Course Getting Started This project is a starting point for a Flutter application. A few resources to get yo

Ziyad Mansy 8 Nov 10, 2021
Chinese Chess game by Flutter

Chinese Chess 中国象棋界面端. 提供完整的游戏规则处理,windows版带elephanteye引擎的招法提示 功能 游戏规则处理。包括落子点提示,将军、应将提示,输赢检测 棋盘棋子皮肤加载 支持PGN格式加载,FEN格式导入 PGN格式导出, FEN格式局面复制 棋谱自动演播 多语言

shirne 11 Nov 8, 2021
Snaake is a small and very simple clone of the classic snake game from Nokia phones.

Snaake Snaake is a small and very simple clone of the classic snake game from Nokia phones. Description The objective is very simple: eat the colorful

Lucas Nunes 57 Oct 25, 2021
Public repo for flutterflip, a reversi clone built with Flutter.

flutterflip A single-player reversi clone built with Flutter, which compiles for both Android and iOS. The user plays as black, and the CPU will make

Andrew Brogdon 199 Nov 21, 2021
Flutter Gamepad Support

flame_gamepad Gamepad is only supported on Android at the moment. Checking if the gamepad is connected bool isConnected; try { isConnect

Flame Engine 29 Nov 18, 2021
An example Flutter app showing how to easily integrate with Flame games

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

Erick 4 Jun 4, 2021
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

Sanjeev Madhav 44 Nov 27, 2021
A Flutter RPG Game Engine.

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

zhaoqipeng 19 Nov 7, 2021
Minimalist Flutter Todo App, built using BLoC pattern

Deer Minimalist Todo Planner app built around the idea of efficiency and clean aesthetic. Showcase Development Deer uses BLoC (Business Logic Componen

Aleksander Woźniak 292 Nov 14, 2021
A minimalist Flutter framework for rapidly building custom designs.

Show some ❤️ and star the repo. VelocityX is a 100% free Flutter open-source minimalist UI Framework built with Flutter SDK to make Flutter developmen

Pawan Kumar 866 Nov 25, 2021
Flutter Responsive Game of Thrones Flutter App Flutter Responsive Game of Thrones Flutter App

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

Pawan Kumar 15 Nov 25, 2021
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

dev_allauddin 4 Nov 17, 2021
Flutter demo application for Apple TV (tvos) using custom Flutter engine

Flutter for Apple TV A modification of the Flutter engine + test application to demonstrate that Flutter applications run on Apple TV This project (an

LibertyGlobal 115 Nov 11, 2021
Kraken - a high-performance, web standards-compliant rendering engine based on Flutter.

Kraken - a high-performance, web standards-compliant rendering engine based on Flutter.

OpenKraken 4k Nov 30, 2021
A flutter search engine based on MediaWiki with caching.

Table of contents Project Description Working App Architecture BLoC/Cubit Pattern Caching using HiveDB App UI Project Setup To-Do How to get started w

Shashwat Joshi 37 Nov 16, 2021
a wrapper for LabSound(graph-based audio engine)

lab_sound_flutter WIP lab_sound_flutter is the LabSound wrapper for Flutter. Currently only the Android platform is available, other platforms have en

null 4 Nov 26, 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

Flame Engine 21 Nov 26, 2021
Build Tic Tac Toe Game in Flutter

Flutter TicTacToe Game Build legendary Tic Tac Toe game in flutter. Show some ❤️ and star the repo to support the project Screenshots Watch the video

Pawan Kumar 108 Oct 31, 2021
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

Didier Boelens 407 Nov 21, 2021