Flame Engine Documentation

repository·main·Indexed 27 days ago

https://github.com/flame-engine/flame

A complete game engine built on top of Flutter featuring a game loop, component system, collision detection, and input handling. The ecosystem includes specialized packages such as flame_audio for sound management, flame_3d for experimental 3D rendering via Flutter GPU and Impeller, flame_behavior_tree for AI logic, flame_behaviors for entity-behavior separation, and flame_bloc for integrating BLoC/Cubit state management into Flame components.

Tokens
130.5K
Snippets
425
Records
688
Agent score
94%

What's inside Flame

  1. Overview of Flame Engine

    main

    Flame is a Flutter-based game engine designed to provide out-of-the-way solutions for common game development problems. Key features include:

    • A game loop.
    • A component/object system (FCS).
    • Effects and particles.
    • Collision detection.
    • Gesture and input handling.
    • Support for images, animations, sprites, and sprite sheets.
    • General development utilities.
  2. Overview of Flame Input Handling

    main
    Flame provides cross-platform input handling that works on mobile (touch), desktop (mouse and keyboard), and web (pointer events). Input handling is implemented using mixins that you add to your components. This allows each component in the Flame component tree to independently manage the specific input events it needs to respond to, similar to Flutter's GestureDetector but optimized for the Flame component lifecycle.
  3. Overview of the Jenny library

    main

    The jenny library is a toolset for adding complex dialogue into games. It is an unofficial port of the [Yarn Spinner] library for Unity. It allows for branching dialogue, user-controlled interactions, dynamically-generated content, commands, markup, and state management.

    Jenny separates the two main stages of dialogue implementation:

    1. Writing the text: Done in plain text using .yarn files.
    2. Interactively displaying it: Handled by the game engine via the Jenny runtime.
  4. Overview of Flame Rendering capabilities

    main

    Flame's rendering system is built on top of Flutter's Canvas API. It provides specialized game-oriented utilities for drawing sprites, text, particle effects, and custom shapes. Key features include:

    • Images, Sprites, and Animations: Loading sprite sheets and animating frames.
    • Text Rendering: Rendering text using bitmap fonts.
    • Visual Effects: Applying decorators and running post-processing shaders.
    • Organization: Managing visual hierarchy via layers and snapshots.
    • Particles: Implementing particle effect systems.
    • Color Management: Using palettes and color utilities.
  5. Overview of flame_markdown

    main
    The flame_markdown package allows you to create Flame TextNode hierarchies using markdown strings. It integrates with the markdown package to parse strings into an AST, which is then used to generate a DocumentRoot containing the corresponding nodes for Flame's text rendering pipeline. This is useful for applying inline formatting (bold, italics) or creating complex documents with headings and paragraphs without manually constructing a TextNode tree.
  6. Overview of flame_riverpod_example

    main
    The flame_riverpod_example demonstrates how to synchronize state between a FlameGame and Flutter widgets using Riverpod. It showcases a FlameGame containing a custom Component and a comparable Flutter Widget that both react to the same data source. Specifically, both the Flame Component and the Flutter Text widget update in real-time based on a StreamProvider that counts upwards indefinitely.