Flame Engine 2D Game Development
Complete Guide to Flame Engine Game Development, including core fundamentals, 14 game systems, and 3 game genre templates.
Sub-Skills Index
| Skill |
Description |
Reference Count |
| flame-core |
Engine Core Fundamentals |
10 references |
| flame-systems |
14 Game Systems |
14 references |
| flame-templates |
Game Genre Templates |
3 references |
Quick Navigation
flame-core (Core Fundamentals)
components.md - 組件生命週期、類型
input.md - 觸控、鍵盤、搖桿
collision.md - 碰撞檢測、Hitbox
camera.md - 相機、HUD、視口
animation.md - 精靈動畫、Effects
scenes.md - RouterComponent、Overlays、UI
audio.md - 音效、背景音樂
particles.md - 粒子系統、特效
performance.md - 效能優化、最佳實踐
debug.md - 除錯模式、日誌
flame-systems (Game Systems)
quest.md - 任務系統 achievement.md - 成就系統
dialogue.md - 對話系統 shop.md - 商店系統
localization.md - 多語言系統 crafting.md - 製作系統
inventory.md - 背包系統 procedural.md - 程序生成
paperdoll.md - 紙娃娃系統 multiplayer.md - 多人連線
combat.md - 戰鬥系統 leveleditor.md - 關卡編輯器
skills.md - 技能系統
saveload.md - 存檔系統
flame-templates (Game Templates)
rpg.md - 回合制/動作 RPG
platformer.md - 橫向卷軸平台遊戲
roguelike.md - 程序生成地下城
AI Usage Guide
# 基礎問題
需要了解 Flame? → 先讀 flame-core/SKILL.md
需要特定功能? → 根據 flame-core 索引讀取對應 reference
# 系統實作
需要任務/對話系統? → 讀 flame-systems/references/quest.md 或 dialogue.md
需要戰鬥系統? → 讀 flame-systems/references/combat.md + skills.md
需要存檔功能? → 讀 flame-systems/references/saveload.md
需要多人連線? → 讀 flame-systems/references/multiplayer.md
# 完整遊戲
要做 RPG? → 讀 flame-templates/references/rpg.md
要做平台遊戲? → 讀 flame-templates/references/platformer.md
要做 Roguelike? → 讀 flame-templates/references/roguelike.md
# 部署發布
要發布遊戲? → 參考下方「部署平台」章節
Use Cases
Based on Filip Hráček's Benchmark test, Flame compared with other engines:
Flame Advantages
| Item |
Flame |
Unity/Godot |
| Startup Time |
Fastest |
Slower |
| Package Size |
Smaller |
Larger |
| Learning Curve |
Flutter developer friendly |
Need to learn new tools |
| Cross-platform |
One codebase for 6 platforms |
Requires platform adaptation |
| Hot Reload |
Supported |
Partially supported |
Flame Limitations
| Item |
Flame |
Unity/Godot |
| Maximum Entity Count |
~Hundreds |
Thousands |
| 3D Support |
None |
Full |
| Physics Engine |
Basic (Forge2D) |
Full |
| Editor |
No visual editor |
Full IDE |
Recommended to use Flame
- ✅ Casual Games: Card, puzzle, brain teaser, quiz
- ✅ Hyper-casual: Simple mechanics, quick play
- ✅ Story-driven: Visual novels, interactive stories
- ✅ 2D Platformers: Side-scrollers, Metroidvania
- ✅ Turn-based Games: Tactical RPG, RPG, board games
- ✅ Embedded games in Flutter Apps: Mini-games, interactive elements
Not recommended to use Flame
- ❌ Massive Entities: Bullet hell, RTS, large-scale battles
- ❌ 3D Games: Any game requiring 3D rendering
- ❌ Physics-intensive: Complex physics simulation, racing
- ❌ AAA Games: High-fidelity graphics, complex effects
Quick Start
flutter create my_game && cd my_game
flutter pub add flame
flutter pub add flame_audio # 選用
flutter pub add flame_tiled # 選用
import 'package:flame/game.dart';
import 'package:flutter/material.dart';
void main() => runApp(GameWidget(game: MyGame()));
class MyGame extends FlameGame with HasCollisionDetection {
@override
Future<void> onLoad() async {
camera.viewfinder.anchor = Anchor.topLeft;
// 開始建構你的遊戲!
}
}
Deployment Platforms
Flame is based on Flutter and supports multi-platform deployment:
| Platform |
Publishing Channel |
Command |
| iOS |
App Store |
flutter build ios --release |
| Android |
Google Play |
flutter build apk --release |
| Web |
itch.io / GitHub Pages |
flutter build web --release |
| macOS |
App Store / Standalone |
flutter build macos --release |
| Windows |
Steam / Standalone |
flutter build windows --release |
| Linux |
Steam / Standalone |
flutter build linux --release |
Publish to itch.io (Web)
# 1. 建置 Web 版本
flutter build web --release --web-renderer canvaskit
# 2. 上傳 build/web 資料夾到 itch.io
# 3. itch.io 設置
# - Kind of project: HTML
# - Embed options: Click to launch in fullscreen
Publish to Google Play (Android)
# 1. 建立 keystore
keytool -genkey -v -keystore ~/my-game.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-game
# 2. 設定 android/key.properties
storePassword=<password>
keyPassword=<password>
keyAlias=my-game
storeFile=/Users/you/my-game.jks
# 3. 建置 App Bundle
flutter build appbundle --release
# 4. 上傳 build/app/outputs/bundle/release/app-release.aab
Publish to Steam (Desktop)
# 1. 建置 Desktop 版本
flutter build windows --release # 或 macos / linux
# 2. 使用 Steamworks SDK 打包
# - 設定 app_build.vdf
# - 上傳到 Steam Partner
# 3. 建議加入 Steam 成就整合
# flutter pub add steamworks
Dependency Graph
flame/ (本索引)
│
├── flame-core (核心基礎)
│ └── 10 reference files
│
├── flame-systems (遊戲系統)
│ └── 14 reference files
│
└── flame-templates (遊戲模板)
└── 3 reference files
Best Practices
- On-demand loading - Only read the references you need, saving tokens
- Core first - Get familiar with flame-core first, then extend systems
- Template reference - Use templates as a starting point, add systems as needed
- Modular - Each system is independent and can be used in combination
Version History
- v2.2.0 - Added applicable scenarios, Benchmark data
- v2.1.0 - Added Audio, Particles, Performance, deployment guide
- v2.0.0 - Refactored into a modular architecture
- v1.0.0 - Initial version