跳转至正文

休闲游戏工具包

了解在 Flutter 中进行免费开源多平台 2D 游戏开发。

Flutter 休闲游戏工具包整合新旧资源,帮助你在移动平台上加速游戏开发。

本页概述这些可用资源的位置。

为何用 Flutter 做游戏?

#

Flutter 框架可为从桌面、移动设备到 Web 的六个目标平台创建高性能应用。

凭借跨平台开发、性能和开源许可等优势,Flutter 非常适合做游戏。

休闲游戏分为两类:回合制游戏和实时游戏。你可能熟悉这两类游戏,只是未必这样划分。

回合制游戏 面向大众市场,规则与玩法简单,包括棋类、卡牌、益智和策略游戏。它们响应轻触卡牌或输入数字、字母等简单输入,很适合用 Flutter。

实时游戏 需要实时响应一系列操作,包括无尽跑酷、赛车等。你可能想实现碰撞检测、镜头、游戏循环等高级特性,这类游戏可使用基于 Flutter 构建的开源引擎,如 Flame game engine

工具包包含什么

#

休闲游戏工具包提供以下免费资源。

  • A repository that includes three game templates that provide a starting point for building a casual game.

  • 一个仓库,包含三个游戏模板,作为构建休闲游戏的起点。

    1. A base game template that includes the basics for:

    2. base game template(基础游戏模板),包含:

      • Main menu

      • 主菜单

      • Navigation

      • 导航

      • Settings

      • 设置

      • Level selection

      • 关卡选择

      • Player progress

      • 玩家进度

      • Play session management

      • 游戏会话管理

      • Sound

      • 音效

      • Themes

      • 主题

    3. A card game template that includes everything in the base template plus:

    4. card game template(卡牌游戏模板),包含基础模板全部内容,另加:

      • Drag and drop

      • 拖放

      • Game state management

      • 游戏状态管理

      • Multiplayer integration hooks

      • 多人集成钩子

    5. An endless runner template created in partnership with the open source game engine, Flame. It implements:

    6. 与开源引擎 Flame 合作创建的 endless runner template(无尽跑酷模板),实现:

      • A FlameGame base template

      • FlameGame 基础模板

      • Player steering

      • 玩家操控

      • Collision detection

      • 碰撞检测

      • Parallax effects

      • 视差效果

      • Spawning

      • 生成

      • Different visual effects

      • 多种视觉效果

    7. A sample game built on top of the endless runner template, called SuperDash. You can play the game on iOS, Android, or web, view the open source code repo, or read how the game was created in 6 weeks.

    8. 基于无尽跑酷模板的示例游戏 SuperDash。可在 iOS、Android 或 web 上游玩,view the open source code repo(查看开源代码仓库),或 read how the game was created in 6 weeks(阅读如何在 6 周内完成)。

  • Developer guides for integrating needed services.

  • 集成所需服务的开发者指南。

  • A link to a Flame Discord channel. If you have a Discord account, use this direct link.

  • Flame Discord 频道链接。若有 Discord 账号,可使用此 direct link(直接链接)。

包含的游戏模板和 cookbook 食谱为加速开发做了特定选择,使用 providergoogle_mobile_adsin_app_purchaseaudioplayerscrashlyticsgames_services 等包。若你偏好其他包,可修改代码替换。

Flutter 团队理解变现可能是未来考量,已添加广告与应用内购买的 cookbook 食谱。

Games 页所述,将 Cloud, FirebaseAds 等 Google 服务集成到游戏中,最高可利用约 $900 优惠。

入门

#

准备好了吗?按以下步骤开始:

  1. If you haven't done so, install Flutter.

  2. 若尚未安装,请 install Flutter(安装 Flutter)。

  3. Clone the games repo.

  4. Clone the games repo(克隆游戏仓库)。

  5. Review the README file for the first type of game you want to create.

  6. 查看你想创建的第一类游戏对应的 README 文件。

  7. Join the Flame community on Discord (use the direct link if you already have a Discord account).

  8. Join the Flame community on Discord(加入 Flame Discord 社区)(若已有 Discord 账号可使用 direct link)。

  9. Review the codelabs and cookbook recipes.

  10. 查阅 codelab 与 cookbook 食谱。

  11. Set up accounts on AdMob, Firebase, and Cloud, as needed.

  12. 按需设置 AdMob、Firebase 和 Cloud 账号。

  13. Write your game!

  14. 编写你的游戏!

  15. Deploy to both the Google Play and Apple stores.

  16. 部署到 Google Play 和 Apple 商店。

示例游戏

#

在 Google I/O 2022,Flutter 团队与 Very Good Ventures 都发布了新游戏。

其他资源

#

当你准备超越这些游戏模板时,可探索社区推荐的其他资源。

功能 资源
Animation and sprites

book_5 Special effects
handyman Spriter Pro
package_2 rive
package_2 spritewidget

动画与精灵

book_5 Special effects
handyman Spriter Pro
package_2 rive
package_2 spritewidget

App review

package_2 app_review

应用评价

package_2 app_review

Audio

package_2 audioplayers
package_2 flutter_soloud

音频

package_2 audioplayers
package_2 flutter_soloud

Authentication

science User Authentication using Firebase

认证

science User Authentication using Firebase

Cloud services

science Add Firebase to your Flutter game

云服务

science Add Firebase to your Flutter game

Debugging

quick_reference_all Firebase Crashlytics overview
package_2 firebase_crashlytics

调试

quick_reference_all Firebase Crashlytics overview
package_2 firebase_crashlytics

Drivers

package_2 win32_gamepad

驱动

package_2 win32_gamepad

Game assets
and asset tools

photo_album CraftPix
photo_album Game Developer Studio
handyman GIMP

游戏资源
与资源工具

photo_album CraftPix
photo_album Game Developer Studio
handyman GIMP

Game engines

package_2 Flame
package_2 Bonfire
package_2 forge2d

游戏引擎

package_2 Flame
package_2 Bonfire
package_2 forge2d

Game features

book_5 Add achievements and leaderboards to your game
book_5 Add multiplayer support to your game

游戏功能

book_5 Add achievements and leaderboards to your game
book_5 Add multiplayer support to your game

Game services integration

package_2 games_services

游戏服务集成

package_2 games_services

Level editor

handyman Tiled

关卡编辑器

handyman Tiled

Monetization

book_5 Add advertising to your Flutter game
science Add AdMob ads to a Flutter app
science Add in-app purchases to your Flutter app
science Gaming UX and Revenue Optimizations for Apps (PDF)

变现

book_5 Add advertising to your Flutter game
science Add AdMob ads to a Flutter app
science Add in-app purchases to your Flutter app
science Gaming UX and Revenue Optimizations for Apps (PDF)

Persistence

package_2 shared_preferences
package_2 sqflite
package_2 cbl_flutter (Couchbase Lite)

持久化

package_2 shared_preferences
package_2 sqflite
package_2 cbl_flutter (Couchbase Lite)

Special effects

api Paint API
book_5 Special effects

特效

api Paint API
book_5 Special effects

User Experience

quick_reference_all Best practices for optimizing Flutter web loading speed

用户体验

quick_reference_all Best practices for optimizing Flutter web loading speed

其他资源

#

请观看以下视频: