Flutter - Game Development
Flutter has many advantages for the rapid development of simple apps, but can the framework also be used to develop games?
As you have already noticed in the last Flutter articles, the Framework Flutter strongly supports the developer with its own tools and ensures fast implementation times with simple and structured code. But how far is the framework for developing games good?
In short, it's easy to create your first games with Flutter. To do this, you should first decide on the technology you want to use for the development and what the end product should look like.
If you want to build a simple game out of graphics and some controls, then the simple controls, assets and some animations from Flutter will probably be enough for you. You do not need any other plugins and packages for this.
Do you want to work with sprites, animations and constantly updated interfaces that also offer a certain graphic? Then the first look at a small 2D engine is worthwhile.
Created by flame-engine.org
Flame is a 2D engine for simple games in Flutter. The basic principle of the engine is the game loop, which consists of render and update. This cycle ensures that the objects that are brought to the screen via canvas are displayed and updated. Drawing the UI with canvas is also Flutter's strength, which makes the engine with 60 FPS just as fast as a normal Flutter app.
You also get the standard functions such as: audio, sprites, animation, inputs (tap, drag'n drop, keyboard), particle effects and physics. Basically what you need for the first small game projects.
In the following we have put together a few links that will bring you closer to the documentation and show some examples:
- Flame Webseite - INformations, documentations and API
- Youtube - Presentation from Flutter Europe
- Tutorial to create a first game
When it comes to complex 3D programming, you won't be able to avoid Unity. This is a plugin that represents the Unity render environment in a widget. So you need another programming language and knowledge in a different environment, which could make the project more difficult for you as a pure flutter developer.
When it comes to money, the developers don't want to be left empty-handed. Here there are three different concepts: selling the app, advertising or an in-game shop.
Photo by Kat Yukawa on Unsplash
Selling the app should be the easiest way, since you already set the price when uploading and have no further development effort. If you want to include advertising in your app, you can have a look at the official Firebase package or an easily integrated package from a developer on pub.
The last way would be to work through an in-game shop, there are the options to carry out the implementation via an official package. The package is still in beta status, but should already cover the most common functions of both platforms (Android, iOS).
When it comes to game development, Flutter is in no way inferior to other frameworks, and its structure also offers some advantages in performance and handling. If you are interested in the development, it would certainly be worth taking a look in this direction.