头图

By Zoey Fan, Product Manager for Flutter, Google

For most developers, Flutter is an application framework. But with the hardware-accelerated graphics support provided by Flutter, the community around casual game development is also growing.

Over the past year, thousands of Flutter games have been released. Take the gaming company Lotum, whose popular word-puzzle game 4 Pics 1 Word was recently completely rewritten in Flutter. Flame is a community-driven open source game engine built on Flutter, and its contributors and users have been steadily growing.

△ Flutter 开发者构建的手机游戏

△ Mobile games built by Flutter developers

To understand how we can better support you, we interviewed several developers who have successfully built and released Flutter mobile games. When we asked them why they liked creating games with Flutter, their responses gave the following reasons:

  • Flutter is easy to learn and can be easily used to build user interfaces and casual games
  • Flutter allows developers to view the framework source code (there is no "black box") and have full control over the canvas
  • Flutter has an open ecosystem where developers can find (and use) many useful packages, plugins and development libraries
  • Flutter is portable, just write the code once, and the game can be compiled to a multi-platform version by default

At the same time, developers who participated in our survey mentioned that the biggest challenges in creating Flutter games are finding resources and learning materials for getting started, and integrating with platform game services. To address these needs, we've released new starter kits to accelerate your game development process.

The Flutter Casual Game Toolkit provides specialized templates (developed by Filip Hracek ) that you can use to build your own games. This starter project comes pre-built with various "parts" you might need, including the main menu, settings page, sound support, and more, and the most fun part is still left to you: building the game!

△ 在移动设备上运行的井字棋游戏

△ Tic Tac Toe game running on mobile devices

video tutorial

If you want to get started developing a game, check out our video tutorial on how to use game templates. It provides you with a step-by-step instruction to create a tic-tac-toe game (you can also download this game from the iOS / Android app store). If you want to know all the details of what Filip went through while developing this game, you are welcome to read his original dev diary .

Pre-integrated services

In addition to common UI and functional elements that you might need in your game, you'll also get pre-integrated modules and sample code for key services required for game development. For example, Apple Game Center and Google Play Games Services are integrated into game templates, so you can easily implement features like leaderboards and achievements.

If you plan to monetize your game, the template also uses the Google Mobile Ads SDK and tells you how to implement ad samples. The template also uses an in -app purchase package that allows you to offer players additional content within your game, such as premium experiences, digital goods, and subscriptions.

Finally, the game template also includes Firebase Crashlytics , allowing you to gain more insight into possible crashes and errors in your game. All source code for this game template can be found in the Flutter samples repo on GitHub.

Flutter Games Discord Channel

One of Flutter's strengths is its warm, helpful community. If you want to chat, ask questions, and share best practices with other Flutter game developers, join the game development-only channel on the r/FlutterDev Discord server! Big thanks to our community member @Miyoyo for helping create this community space to support Flutter game developers! (By the way, if you are already a member of the r/FlutterDev community, you can join directly via the link )

Google Ads and Cloud Sponsorships

If your game requires Cloud or Firebase services, or if you want to use Ads to promote your game to more users, you can get up to $900 in sponsorships (subject to terms) from the Google Ads and Cloud teams!

Starting from the mobile terminal, moving to a broader stage

We know from past research that most Flutter games today are casual mobile games, so we prioritized mobile scenarios when designing the Flutter casual game toolkit.

But that doesn't mean your creativity should be limited to mobile platforms. In fact, the tic- tac-toe game just mentioned runs on the desktop as well as the web !

△ 在 web 端和桌面端运行的井字棋游戏

△ Tic-tac-toe game running on the web and desktop

We've also recently added support for the community-driven game engine Flame on DartPad, so you can explore building games with Flame on DartPad without having to download the SDK. Also, the web-side pinball game written by Very Good Ventures (VGV) and presented at Google I/O is built in Flutter using the Flame engine! If you want to see how the pinball game was created, check out the VGV team 's blog post about the pinball game or read its code directly.

△ Web 端的弹球游戏

△ Pinball game on the web

Game development is a new and exciting scene for Flutter to step into! Going forward, we hope to add more Codelabs and other resources to help you develop your game. This is the first time we've tried to make this easier for you, and we know there's still a lot to improve. We recently started working with community member @wolfenrain to triage issues related to the game. If you'd like the Flutter SDK to provide better product functionality, please file an issue (or vote on an existing issue) on GitHub.

Flutter game development

Check out the dedicated game development page for more details on the above resources, and you'll also find links to documentation , as well as references to codebases, packages, and tools recommended by game development experts in the Flutter community.

Since the release of Flutter 1.0, you've been surprising us with amazing apps, and now we can't wait to see what exciting games you'll build with Flutter!


Flutter
350 声望2.5k 粉丝

Flutter 为应用开发带来了革新: 只要一套代码库,即可构建、测试和发布适用于移动、Web、桌面和嵌入式平台的精美应用。Flutter 中文开发者网站 flutter.cn