-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Blue Fire
committed
Sep 12, 2024
1 parent
6d780ed
commit 32cd808
Showing
666 changed files
with
859,921 additions
and
226,061 deletions.
There are no files selected for viewing
30,993 changes: 15,506 additions & 15,487 deletions
30,993
docs/1.18.0/_static/apps/examples/main.dart.js
Large diffs are not rendered by default.
Oops, something went wrong.
10,809 changes: 5,408 additions & 5,401 deletions
10,809
docs/1.18.0/_static/apps/flame-examples/main.dart.js
Large diffs are not rendered by default.
Oops, something went wrong.
7,605 changes: 3,806 additions & 3,799 deletions
7,605
docs/1.18.0/_static/apps/tutorials-klondike-app/main.dart.js
Large diffs are not rendered by default.
Oops, something went wrong.
8,521 changes: 4,264 additions & 4,257 deletions
8,521
docs/1.18.0/_static/apps/tutorials-platformer-app/main.dart.js
Large diffs are not rendered by default.
Oops, something went wrong.
7,575 changes: 3,791 additions & 3,784 deletions
7,575
docs/1.18.0/_static/apps/tutorials-space_shooter-app/main.dart.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: ce7fb4dff48a72ce57913ea9f5373460 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Getting Started | ||
|
||
|
||
## About Flame | ||
|
||
Flame is a modular Flutter game engine that provides a complete set of out-of-the-way solutions for | ||
games. It takes advantage of the powerful infrastructure provided by Flutter but simplifies the code | ||
you need to build your projects. | ||
|
||
It provides you with a simple yet effective game loop implementation, and the necessary | ||
functionalities that you might need in a game. For instance; input, images, sprites, sprite sheets, | ||
animations, collision detection, and a component system that we call Flame Component System (FCS for | ||
short). | ||
|
||
We also provide stand-alone packages that extend the Flame functionality which can be found in the | ||
[Bridge Packages](bridge_packages/bridge_packages.md) section. | ||
|
||
You can pick and choose whichever parts you want, as they are all independent and modular. | ||
|
||
The engine and its ecosystem are constantly being improved by the community, so please feel free to | ||
reach out, open issues and PRs as well as make suggestions. | ||
|
||
Give us a star if you want to help give the engine exposure and grow the community. :) | ||
|
||
|
||
## Installation | ||
|
||
Add the `flame` package as a dependency in your `pubspec.yaml` by running the following command: | ||
|
||
```console | ||
flutter pub add flame | ||
``` | ||
|
||
The latest version can be found on [pub.dev](https://pub.dev/packages/flame/install). | ||
|
||
then run `flutter pub get` and you are ready to start using it! | ||
|
||
|
||
## Getting started | ||
|
||
There is a set of tutorials that you can follow to get started in the | ||
[tutorials folder](https://github.com/flame-engine/flame/tree/main/doc/tutorials). | ||
|
||
Simple examples for all features can be found in the | ||
[examples folder](https://github.com/flame-engine/flame/tree/main/examples). | ||
|
||
You can also check out the [awesome flame | ||
repository](https://github.com/flame-engine/awesome-flame#user-content-articles--tutorials), | ||
it contains quite a lot of good tutorials and articles written by the community | ||
to get you started with Flame. | ||
|
||
|
||
## Outside of the scope of the engine | ||
|
||
Games sometimes require complex feature sets depending on what the game is all about. Some of these | ||
feature sets are outside of the scope of the Flame Engine ecosystem, in this section you can find | ||
them, and also some recommendations of packages/services that can be used: | ||
|
||
|
||
### Multiplayer (netcode) | ||
|
||
Flame doesn't bundle any network feature, which may be needed to write online multiplayer games. | ||
|
||
If you are building a multiplayer game, here are some recommendations of packages/services: | ||
|
||
- [Nakama](https://github.com/obrunsmann/flutter_nakama/): An open-source server designed | ||
to power modern games and apps. | ||
- [Firebase](https://firebase.google.com/): Provides dozens of services that can be used to write | ||
simpler multiplayer experiences. | ||
- [Supabase](https://supabase.com/): A cheaper alternative to Firebase, based on Postgres. |
102 changes: 102 additions & 0 deletions
102
docs/1.19.0/_sources/bridge_packages/bridge_packages.md.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# Bridge Packages | ||
|
||
:::{package} flame_audio | ||
|
||
Play multiple audio files simultaneously (bridge package for [AudioPlayers]). | ||
::: | ||
|
||
:::{package} flame_bloc | ||
|
||
A predictable state management library (bridge package for [Bloc]). | ||
::: | ||
|
||
:::{package} flame_fire_atlas | ||
|
||
Create texture atlases for games (bridge package for [FireAtlas]). | ||
::: | ||
|
||
:::{package} flame_forge2d | ||
|
||
A Box2D physics engine (bridge package for [Forge2D]). | ||
::: | ||
|
||
:::{package} flame_isolate | ||
|
||
Use isolates to offload heavy computations to another thread. | ||
::: | ||
|
||
:::{package} flame_lottie | ||
|
||
Use Lottie animations in Flame (bridge package for [Lottie]). | ||
::: | ||
|
||
:::{package} flame_network_assets | ||
|
||
Fetch assets over the network. | ||
::: | ||
|
||
:::{package} flame_oxygen | ||
|
||
Replace FCS with the Oxygen Entity Component System. | ||
::: | ||
|
||
:::{package} flame_rive | ||
|
||
Create interactive animations (bridge package for [Rive]). | ||
::: | ||
|
||
:::{package} flame_riverpod | ||
|
||
A reactive caching and data-binding framework (bridge package for [Riverpod]). | ||
::: | ||
|
||
:::{package} flame_spine | ||
|
||
Use Spine skeletal animations (bridge package for [Spine]). | ||
::: | ||
|
||
:::{package} flame_splash_screen | ||
|
||
Add the "Powered by Flame" splash screen. | ||
::: | ||
|
||
:::{package} flame_svg | ||
|
||
Draw SVG files in Flutter (bridge package for [flutter_svg]). | ||
::: | ||
|
||
:::{package} flame_tiled | ||
|
||
2D tilemap level editor (bridge package for [Tiled]). | ||
::: | ||
|
||
[AudioPlayers]: https://github.com/bluefireteam/audioplayers | ||
[Bloc]: https://github.com/felangel/bloc | ||
[FireAtlas]: https://github.com/flame-engine/fire-atlas | ||
[Forge2D]: https://github.com/flame-engine/forge2d | ||
[Lottie]: https://pub.dev/packages/lottie | ||
[Rive]: https://rive.app/ | ||
[Riverpod]: https://github.com/rrousselGit/riverpod | ||
[Spine]: https://pub.dev/packages/spine_flutter | ||
[Tiled]: https://www.mapeditor.org/ | ||
[flutter_svg]: https://github.com/dnfield/flutter_svg | ||
|
||
|
||
```{toctree} | ||
:hidden: | ||
|
||
flame_audio <flame_audio/flame_audio.md> | ||
flame_bloc <flame_bloc/flame_bloc.md> | ||
flame_fire_atlas <flame_fire_atlas/flame_fire_atlas.md> | ||
flame_forge2d <flame_forge2d/flame_forge2d.md> | ||
flame_isolate <flame_isolate/flame_isolate.md> | ||
flame_lottie <flame_lottie/flame_lottie.md> | ||
flame_network_assets <flame_network_assets/flame_network_assets.md> | ||
flame_oxygen <flame_oxygen/flame_oxygen.md> | ||
flame_rive <flame_rive/flame_rive.md> | ||
flame_riverpod <flame_riverpod/flame_riverpod.md> | ||
flame_splash_screen <flame_splash_screen/flame_splash_screen.md> | ||
flame_spine <flame_spine/flame_spine.md> | ||
flame_svg <flame_svg/flame_svg.md> | ||
flame_tiled <flame_tiled/flame_tiled.md> | ||
``` |
111 changes: 111 additions & 0 deletions
111
docs/1.19.0/_sources/bridge_packages/flame_audio/audio.md.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# Audio | ||
|
||
Playing audio is essential for most games, so we made it simple! | ||
|
||
First you have to add [flame_audio](https://github.com/flame-engine/flame_audio) to your dependency | ||
list in your `pubspec.yaml` file: | ||
|
||
```yaml | ||
dependencies: | ||
flame_audio: VERSION | ||
``` | ||
|
||
The latest version can be found on [pub.dev](https://pub.dev/packages/flame_audio/install). | ||
|
||
After installing the `flame_audio` package, you can add audio files in the assets section of your | ||
`pubspec.yaml` file. Make sure that the audio files exists in the paths that you provide. | ||
|
||
The default directory for `FlameAudio` is `assets/audio` (which can be changed by providing your own | ||
instance of `AudioCache`). | ||
|
||
For the examples below, your `pubspec.yaml` file needs to contain something like this: | ||
|
||
```yaml | ||
flutter: | ||
assets: | ||
- assets/audio/explosion.mp3 | ||
- assets/audio/music.mp3 | ||
``` | ||
|
||
Then you have the following methods at your disposal: | ||
|
||
```dart | ||
import 'package:flame_audio/flame_audio.dart'; | ||
|
||
// For shorter reused audio clips, like sound effects | ||
FlameAudio.play('explosion.mp3'); | ||
|
||
// For looping an audio file | ||
FlameAudio.loop('music.mp3'); | ||
|
||
// For playing a longer audio file | ||
FlameAudio.playLongAudio('music.mp3'); | ||
|
||
// For looping a longer audio file | ||
FlameAudio.loopLongAudio('music.mp3'); | ||
|
||
// For background music that should be paused/played when the pausing/resuming | ||
// the game | ||
FlameAudio.bgm.play('music.mp3'); | ||
``` | ||
|
||
The difference between the `play/loop` and `playLongAudio/loopLongAudio` is that `play/loop` makes | ||
use of optimized features that allow sounds to be looped without gaps between their iterations, and | ||
almost no drop on the game frame rate will happen. You should whenever possible, prefer the former | ||
methods. | ||
|
||
`playLongAudio/loopLongAudio` allows for audios of any length to be played, but they do create frame | ||
rate drop, and the looped audio will have a small gap between iterations. | ||
|
||
You can use [the `Bgm` class](bgm.md) (via `FlameAudio.bgm`) to play looping background music | ||
tracks. The `Bgm` class lets Flame automatically manage the pausing and resuming of background music | ||
tracks when the game is sent to background or comes back to the foreground. | ||
|
||
You can use [the `AudioPool` class](audio_pool.md) if you want to fire quick sound effects in a very | ||
efficient manner. `AudioPool` will keep a pool of `AudioPlayer`s preloaded with a given sound, and | ||
allow you to play them very fast in quick succession. | ||
|
||
Some file formats that work across devices and that we recommend are: MP3, OGG and WAV. | ||
|
||
This bridge library (flame_audio) uses [audioplayers](https://github.com/bluefireteam/audioplayers) | ||
in order to allow for playing multiple sounds simultaneously (crucial in a game). You can check the | ||
link for a more in-depth explanation. | ||
|
||
Both on `play` and `loop` you can pass an additional optional double parameter, the `volume` | ||
(defaults to `1.0`). | ||
|
||
Both the `play` and `loop` methods return an instance of an `AudioPlayer` from the | ||
[audioplayers](https://github.com/bluefireteam/audioplayers) lib, that allows you to stop, pause and | ||
configure other parameters. | ||
|
||
In fact you can always use `AudioPlayer`s directly to gain full control over how your audio is played | ||
-- the `FlameAudio` class is just a wrapper for common functionality. | ||
|
||
|
||
## Caching | ||
|
||
You can pre-load your assets. Audios need to be stored in the memory the first time they | ||
are requested; therefore, the first time you play each mp3 you might get a delay. In order to | ||
pre-load your audios, just use: | ||
|
||
```dart | ||
await FlameAudio.audioCache.load('explosion.mp3'); | ||
``` | ||
|
||
You can load all your audios in the beginning in your game's `onLoad` method so that they always | ||
play smoothly. To load multiple audio files, use the `loadAll` method: | ||
|
||
```dart | ||
await FlameAudio.audioCache.loadAll(['explosion.mp3', 'music.mp3']); | ||
``` | ||
|
||
Finally, you can use the `clear` method to remove a file that has been loaded into the cache: | ||
|
||
```dart | ||
FlameAudio.audioCache.clear('explosion.mp3'); | ||
``` | ||
|
||
There is also a `clearCache` method, that clears the whole cache. | ||
|
||
This might be useful if, for instance, your game has multiple levels and each has a different | ||
set of sounds and music. |
15 changes: 15 additions & 0 deletions
15
docs/1.19.0/_sources/bridge_packages/flame_audio/audio_pool.md.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# AudioPool | ||
|
||
An AudioPool is a provider of AudioPlayers that are pre-loaded with | ||
local assets to minimize delays. | ||
|
||
A single AudioPool always plays the same sound, usually a quick sound | ||
effect, like a laser shooting from your ship or a jump sound for your | ||
platformer. | ||
|
||
The advantage of using Audio Pool is that by configuring a minimum | ||
(starting) size, and a maximum size, the pool will create and preload | ||
some players, and allow them to be re-used many times. | ||
|
||
You can use the helper method `FlameAudio.createPool` to create AudioPool | ||
instances using the same global `FlameAudio.audioCache`. |
Oops, something went wrong.