The author of this article is CodeFarmer
The author has done a small year of Flutter development before and after the company, from the beginning to the back of the business side changes, to temporarily abandon Flutter. For the Flutter controversy aside, we have to admit that Flutter is a very good cross-end solution, to the previous time Flutter 3.0 proposed, 3.0 made a very friendly support for the game, the author began to use the game as an entry point to get started with Flutter. So let’s explore the strength of Flutter 3.0’s support for games, can we write a mini-game of our own at a low cost?
Download the following installation package to get the latest stable version of the Flutter SDK:
Unzip the SDK
Add environment variables: (About Mac environment variables do not recount: reference)
Problem 1: The CocoaPods environment relies on installing cocoapods
Question 2: Some Android licenses not accepted. To resolve this, run: flutter doctor –android-licenses
The complete environment is as follows: non-essential, missing parts of the environment do not affect the development
This Flutter sample game repo comes pre-integrated with modules for in-app purchases, mobile advertising SDKs, and many other successful games;
Getting started games in Flutter with all the basic integrations to release for mobile (iOS and Android) games, including the following features:
Start the project
Through the above template, we found that the key introduction information is as follows
Ad id switching: ios/Runner/Info.plist android/app/src/main/Android Manifest.xml
Have users sign in to Game Center (iOS) or Google Play Game Services (Android). You should sign in before doing anything, such as sending scores or unlocking achievements.
Check whether the current user is logged in to the game service (ios game center or Google play game service)
Have the user sign out of the iOS Game Center/Goole Play service. Once called, no action can be taken on the user’s account.
Submit scores to the leaderboard
Steps to increase Android achievements
The above introduces Flutter 3.0 and 3.0 game-friendly support, which can easily open up the mobile terminal, convenient access to advertising and other services, so that developers can focus more on the development of the game itself, rather than advertising, audio control, user rankings, application payment, etc., below we introduce the core of Flutter games, commonly used game engines and use.
The Flame engine is designed to provide a complete set of solutions to common problems encountered in games developed with Flutter, and Flame leverages the power of Flutter and provides a lightweight way to develop 2-D games for all platforms.
Flame currently offers the following features:
In addition to the above features, you can use some packages that bridge Flame to enhance the functionality of the engine itself. With these bridged packages, you can access Flame’s components, helpers, or bind to other packages for smooth integration. We currently have the following bridging packages (the Flame engine is modular, allowing users to choose the API they want to use):
Flame – The core package that provides game loops, basic collision detection, sprite, and components.
flame_audio Bridge AudioPlayers: Multiple audio can be played at the same time.
flame_bloc Bridging Bloc: BloC State Management.
flame_fire_atlas Bridging FireAtlas: Create a texture atlas for your game.
flame_forge2d Bridging Forge2D: Box2D-based physics engine with advanced collision detection, ported from Box2D to use with Flame
flame_lint – Code formatting rules for the engine (analysis_options.yaml).
flame_oxygen Bridging Oxygen : Lightweight Entity-Component-System (ECS).
Oxygen is a lightweight entity component system framework written in Dart that focuses on performance and ease of use. Oxygen is not known by design, and any game engine you want to use can be used with Oxy.
Oxygen is inspired by ECSY, so it has the same design principles. The main goal of Oxygen is to be lightweight, high-performance, and easy to use. Use APIs to experiment and help you get the most out of your ECS design patterns without limiting your build logic.
flame_rive Bridging Rive: Create interactive animations. https://rive.app/get-started/
flame_svg Bridging flutter_svg: Draw the SVG in Flutter.
flame_tiled Bridging Tiled: A map editor for a 2D plane.
flame_audio – A module that adds audio capabilities to a Flame game.
game->player-> update direction
60hz = 16 ms refresh
If the game view has a diameter of 2500×2500 pixels, your player starts in the middle of the coordinates x:1250, y:1250. Calling moveDown adds approximately 300 pixels to the player’s Y position, causing the sprite to move the game viewport down when the user holds the handle downwards.
Add a moving sprite player
That’s where our introduction to a game made with Flame is over
Of course, game development is complex, imagination is the most important!
Bonfire Engine: (RPG class) An engine that can create Flutter.2D games, based on Flame
Game Resource 1: https://itch.io/game-assets
Game Resource 2: https://itch.io/
– END –
Strange Dance Troupe is the largest front-end team of the 360 Group, representing the group in the work of W3C and ECMA members (TC39). Qi Dance Troupe attaches great importance to talent training, there are engineers, lecturers, translators, business interface personnel, team leaders and other development directions for employees to choose, and supplemented by providing corresponding technical, professional, general, leadership and other training courses. With an open and seeking mindset, the Odd Dance Company welcomes all kinds of outstanding talents to pay attention to and join the Strange Dance Troupe.