124 Commits

Author SHA1 Message Date
Adil Hanney
521e56b6d2 feat!: Pause game when backgrounded (#2642)
When the game is backgrounded and then resumed, the update function is called with a very large dt time step.

This might cause the physics engine to hit the maximum translation per timestep, causing moving bodies to slow down to almost-zero velocities.

This PR makes the game pause if the game is backgrounded. If you'd like to change this behaviour, set the pauseWhenBackgrounded flag to true (default) or false.

class MyGame extends FlameGame {
  MyGame() {
    pauseWhenBackgrounded = false;
  }
}

This is currently not working on the web, see flutter/flutter#53107.

You can view previous discussion about this here: flame-engine/forge2d#84.
2023-09-21 16:58:52 +00:00
Luan Nico
7313cd5352 chore: Remove CSpell regex bypasses (part 3) (#2753)
Remove CSpell regex bypasses (part 3) and fix violations accordingly
2023-09-21 06:08:13 +02:00
Luan Nico
a67c625406 chore: Remove CSpell regex bypasses (part 2) (#2738)
Remove CSpell regex bypasses (part 2)
2023-09-14 09:16:53 +02:00
Luan Nico
e051298cba docs: Enable CSpell on tests (#2723)
Enable CSpell on tests, fixing existing violations.
2023-09-12 13:52:56 +00:00
Luan Nico
8726d033e5 chore: Remove CSpell regex bypass for identifiers starting with $ (#2736)
Remove CSpell regex bypass for identifiers starting with $ ("\\$\\w+"), fixing any violations.
2023-09-12 11:15:09 +02:00
Luan Nico
2f973abe8b docs: Improved spellchecking (#2722)
Improve our spellchecker (cspell) configuration and dictionary file
organization.

# Rationale

This is a proposal to establish a few changes:
* better separate our dictionary files into different categories of
types of words we are including
* improve the cspell regexes to be more aggressive
* be less lenient to what kinds of words we are adding to our
dictionaries
* have the dictionary file also serve as an explanation for obscure
references that cannot be easily derived from the word

Essentially my goal is that either when reviewing a PR that adds a new
entry to our dictionary, or when reading the dictionary files
themselves, it is immediately obvious what the entries are and why they
are there. Currently it can be just a dumpster we throw anything into if
spellcheck fails.

# Proposal

This PR-as-a-proposal essentially do the following changes.

## Split Dictionary Files

Proposes a better separation for our dictionary files. Currently we have
3 that are a bit broad and not super clear on what goes where. This
breaks it down a bit more and adds a comment to each file explaining
what kinds of terms should be added to each; that also serves as a
general guidance for what kinds of words should be added to the lexicon
in general, and makes it harder for mistakes to make into it.

* `flame_dictionary`: remains pretty much unchanged; it is dedicated to
Flame-related words, including companies, tools, and libraries (and
their associated concepts) mentioned on our codebase. Basically a
collection of proper-nouns relating to companies and libraries we
mention.
* `dart_dictionary`: new file for Dart and Flutter related terms
* `sphinx_dictionary`: unchanged, for Sphynx related terms
* `people_dictionary`: specific for people names and usernames
referenced on the codebase (in TODOs, mentions, etc)
* `words_dictionary`: actual English-language words (or common
abbreviations) missing from CSpell
* `gamedev_dictionary`: this was our biggest file that contained all
sort of things. it has been mostly broken down and now only contains
general development-adjacent terms and expressions

## Include definitions

Except for the `words` dictionary, which should be self-explanatory (as
it basically covers for "holes" in CSpell standard dictionary, which I
have been finding a bit lacking), every other file will contain terms in
the form:

```
word # definition of the word
```

What exactly the definition is can slightly vary depending on which
dictionary file we are talking about, but the examples should be
self-explanatory.

As an example, for the gamedev file, it should provide some simple
guidance as to what the term means, or if it's an acronym or
abbreviation, what it stands for. The goal is not to teach the entire
concept to someone unfamiliar, but allow them to "google" it for
themselves by giving enough context, so they can confirm their
suspicions. For example, if they see `LTRB` somewhere by itself, they
are not able to "just google that" because it is too vague. The
dictionary file provides enough context for the user to figure out
however much deeper information they want about any particular subject.
It will also disambiguate from any non-Flame related homonyms. For
people on the people file and companies on the flame file, the
description will provide links to clearly disambiguate what they are;
for tools, a brief description of what the tool is for is also included.
And so on.

The goal is not to build a comprehensive, in depth-guide to each word we
use, but rather to give the bare minimum of context on what this term
"is doing" on our codebase.

## Be less lenient with terms

My idea with these two major changes combined, is that we are overall
more tactical about which terms we want to add to the dictionaries.
Adding a word to the dictionary file is essentially giving carte blanche
to anyone in the future to reuse that term anywhere. I think we should
see spellchecker violations as "warnings"; we decide on the set of
warning rules we want to enable for the entire project (hopefully all
the ones that make sense; or have a reason for disabling the ones that
don't). We might need to violate these warnings sporadically, for
example, we ban `print` on the codebase but might need to allow it
specifically in a couple places. But we would not disable the entire
warning to do that, rather we would add a specific comment-bypass on the
smallest possible scope that encompasses all the relevant lines. We
would also add a proper comment explaining why we are bypassing the
general rule in this specific place.

Similarly, we should not have one-off violations on the dictionary file,
even if they make sense in the one place they occur, but we should
encourage more liberal use of scoped bypasses for such cases. These
Ukrainian words are required in this file, but should not be on the
dictionary as it does not make sense to use foreign languages anywhere
else:

```
// used as examples of Ukrainian words on the documentation below
// cSpell:ignore рушниця, рушниці, рушниць
```

It might look inelegant to have to include that, but just like a
warning-bypass comment, accompanied by the explanatory proper-comment,
this actually provides helpful guidance and context for the reader that
might be confused with the usage of incomprehensible terms.

This also encourages people to avoid obscure terms that are not already
in our dictionary (i.e. that we have already "bought in" and paid the
mental load investment cost), making our code (and docs) easier to parse
and read for everyone. I want to be extremely clear that that **does
not** mean we need to "dumb down" anything whatsoever, or do any sort of
gymnastics to avoid the wrath of an incompetent spellchecker.

But, for example [when spelling "cave
ace"](https://github.com/flame-engine/flame/pull/2304) in variable names
in a random example, having it typed as `caveAce` instead of `caveace`
can slightly help with readability, specially for non-native speakers
(like most of us). It is an extremely minor insignificant gain, but
having the dictionary file require a brief description will nudge us to
give a bit more thought into each "bypass" we are adding.

(note: a similar issue that I have not yet addressed is "spine boy", but
I will leave that for followups and just added that one to the
dictionary for now, as I am still over the fence on that one since it is
an actual "known" character with a dedicated page, so it is more like a
proper noun - as a specific decision I think it is out-of-scope of the
broader discussion).
2023-09-11 12:24:11 -04:00
Luan Nico
d460b846c2 feat: Add HoverCallbacks (#2706)
This creates HoverCallbacks (and PointerMoveCallbacks) to replicate the Hoverables behaviour in the new camera and event system.
2023-09-10 14:49:52 -04:00
Lukas Klingsbo
3084e92500 ci: Fatal-infos should be true for analyze step (#2705)
We aren't even using melos analyze in our pipeline, I forgot that.
This makes the infos fatal, so that it fails properly.
2023-09-02 23:08:33 +02:00
Luan Nico
6dbcd0bd40 chore: Fix typo on cicd.yaml (#2702)
I think that #2698 has introduced a confusing typo to the cicd pipeline.
2023-09-02 21:25:16 +02:00
Lukas Klingsbo
0d7c6a09d2 ci: Try running the test pipeline without spec (#2698)
Try if `flutter test` works better in the pipeline. 😥
Maybe spec is using too much resources and gets killed.
2023-08-31 16:50:25 -03:00
Lukas Klingsbo
ad1a126b09 ci: Try to use ubuntu-20.04 for tests (#2697)
The issue with GitHub killing out test pipeline might be due to the running on the latest ubuntu image, this commit tries to use the older one (which I read could be a solution somewhere...)
2023-08-31 12:34:02 +00:00
Luan Nico
27a8fd61cb refactor: Enable DCM linting (#2667)
This is a first step towards enabling DCM for Flame. Though I have tested with all rules, and am working on selecting, assessing, and fixing violations, as a first step, we can merge the infrastructural changes to flame_lint to and GitHub actions.
As a proof of concept, I am enabling two rules for which we have no violations.
I will followup with enabling more rules, adding discussions for controversial changes, and fixing non-controversial violations.
2023-08-24 13:09:26 +02:00
Luan Nico
7409ec5004 docs: Update PR template so "Migration instructions" is after the breaking change checkbox (#2665)
Update PR template so "Migration instructions" is after the breaking
change checkbox.
I believe that was where it was intended to be, but please assess if
this makes sense.
2023-08-20 15:26:57 +02:00
Lukas Klingsbo
9887892493 chore: Update to Flutter 3.13 (#2656)
Updates the pipeline to use Flutter 3.13 and does all the analyze fixes.
2023-08-18 20:13:17 +02:00
Lukas Klingsbo
346bb6c858 docs: Update Nakama link + add Supabase (#2608)
Update Nakama link + add Supabase to the docs.
2023-07-17 14:23:55 +00:00
Lukas Klingsbo
aeef9464f6 fix: Set constraint for test dependency in flame_test (#2558)
Pub is complaining that test doesn't have a constraint.
2023-05-31 09:46:27 -03:00
Lukas Klingsbo
52b35fbf56 fix: Avoid creation of unnecessary objects for RiveComponent (#2553)
Avoid creation of unnecessary objects for RiveComponent and simplifies
the example.
2023-05-25 17:04:42 +00:00
Lukas Klingsbo
2d45d2be39 chore: Remove 1.8.0 deprecations (#2538)
Removes all the deprecated methods before 1.8.0 release.
2023-05-22 19:01:55 +02:00
Lukas Klingsbo
b41622db8f fix: Solve warnings from 3.10.0 analyzer (#2532)
Just solves the warnings that the new Flutter version complains about (which makes us lose 10 points on pub).
2023-05-14 16:25:23 +02:00
Lukas Klingsbo
5d1a6fd167 feat: Spine bridge package (#2530)
This PR introduces a bridge package for Spine.

https://user-images.githubusercontent.com/744771/236058480-75c8212b-98e6-4e3b-834a-c1a9d4de31a8.mp4
2023-05-05 23:17:15 +02:00
Lukas Klingsbo
5736a0345b ci: Update PR title validator (#2481)
Bump to newest version of amannn/action-semantic-pull-request.
2023-04-11 20:51:03 +00:00
Erick
c1ba1a1b62 chore: Small Typo fix in the improvement template issue. (#2444)
Small type that I came around while filling an issue.
2023-03-30 15:32:02 +02:00
Lukas Klingsbo
8294a2a156 docs: Update funding links (#2420)
This just updates the funding links and adds OpenCollective first everywhere and removing BuyMeACoffee.
2023-03-21 07:14:11 +00:00
Erick
61d69656de feat: Add network assets package. (#2314)
# Description

Adds some documentation and a package that can be used to fetch assets
from the network.
2023-03-18 20:12:14 +00:00
Luan Nico
b2fdf06a79 feat: Introduce flame_noise, deprecate NoiseEffectController (#2393)
This:

* Deprecates the NoiseEffectController that is based on the deprecated
vector_math library impl
* Adds a new bridge package `flame_noise` to bridge fast noise

Note: the *goal* of this PR is to allow the immediate deprecation of the
old NoiseEffectController by providing an experimental, suitable
replacement. I believe the package flame_noise will look nothing like
this at all if I am able to land [some improvements to the underlying
fast_noise lib](https://github.com/frankpepermans/fast_noise/pull/5). We
will be able to have for example a generic NoiseEffectController.

However I believe we should merge this as an experimental package for
now to unblock removing the current implementation from Flame which is
negatively affecting our scores on pub. Therefore I would advise we
don't spend any time discussing specifics of how the API/impl provided
for the flame_noise, and just go with _something_ instead of nothing.
2023-03-14 20:59:21 -04:00
Lukas Klingsbo
3125087c2e docs: Add missing dictionary words (#2372)
All of a sudden Cypher started failing in the pipeline.
The other two are for #2367
2023-02-27 17:18:57 +00:00
Pasha Stetsenko
4ec4e34cc6 feat: Initial version of flame_studio package (#2331)
This is the beginning of work on Flame Studio. In this PR we add a simple UI, which shows the game itself, an info panel, and a toolbar with 2 buttons: start/pause. The UI is able to control the embedded game; in particular the toolbar buttons can pause or resume the game engine.
2023-02-13 22:12:16 +01:00
Lukas Klingsbo
18ddc3b57d ci: Bump Melos in gh-pages (#2334) 2023-02-09 19:08:24 +01:00
Lukas Klingsbo
fb3c744e37 ci: Migrate to Melos 3 and Flutter 3.7.1 (#2330)
This PR migrates us to the prerelease version of Melos (3.0.0-dev.0) and our pipelines to Flutter 3.7.1

It's a golden opportunity for us to test the upcoming version of melos and give them any feedback that we might have. :)

The migration instructions can be read here:
https://melos.invertase.dev/guides/migrations
2023-02-08 22:49:05 +01:00
Luan Nico
e0a4c07f2a docs: Update cspell github action and configuration (#2325)
I am on a crusade to improve our spellchecking. I have a big PR that I am now going to break down into very small chunks to for review.

zwaldowski's cspell-action has been deprecated in favor of streetsidesoftware/cspell-action.

This PR:

updates to use the new recommended cspell action
update to use checkout v3, because why not
fixes a few violations the new action caught
Note: I think we should make a distinction between things that should be in a dictionary (e.g. AABB, a standard industry acronym that we expect people to know what it is) and specific edge-cases/ignore rules for specific parts of specific files (e.g. something like fccc which is meaningless outside of the very specific context in which it is used). For the latter, I believe we should use case-by case exceptions.
2023-02-06 11:58:44 +01:00
Luan Nico
cc1957eb86 docs: Update broken fireslime references (#2324)
I am on a crusade to improve our spellchecking. I have a big PR that I am now going to break down into very small chunks to for review.

This is another hopefully not controversial one - broken links referencing the old Fire Slime.
Updating the links means we no longer need that word in our dictionary file.
2023-02-06 08:32:02 +01:00
Luan Nico
e2399f91e3 docs: Rename caveace asset to cave_ace in our examples (#2304)
I am on a crusade to improve our spellchecking. I have a big PR that I am now going to break down into very small chunks to for review.

Here I am renaming an asset to include a word separator, as the combined word "caveace" doesn't exist. This not only allows us to remove one unclear entry in our dictionary, but make our example code easier to read for new users.

Note: in order to easily update the internal name of the atlas (unrelated to file name), that is stored in the binary, I used this pending feature from Fire Atlas.
2023-02-04 23:42:38 +01:00
Luan Nico
343b84529d docs: Fix actual typos that made into our dictionary (#2305) 2023-01-28 16:58:27 -05:00
Pasha Stetsenko
95b1fc0fbc feat: Added HardwareKeyboardDetector (#2257)
This creates a new component HardwareKeyboardDetector, which is a more advanced version of the KeyboardEvents mixin:

    HardwareKeyboardDetector is a component instead of a mixin, which means it can be added/removed by the user at any point;
    multiple such detectors can be attached to a game - for example, in a 2-player game one component may be paying attention to arrow keys, while another to WASD keys;
    the new component uses Flutter's HardwareKeyboard interface, bypassing the need for a Focus widget;
    the component keeps the ordered list of keys that are currently being pressed, which is helpful for games where this order is important;
    there is the ability to temporarily pause the reception of key events using keyEventsPaused property.
2023-01-27 21:57:42 +00:00
Lukas Klingsbo
1566e18b58 ci: Pin flutter version until we have done all fixes (#2290) 2023-01-25 14:19:36 +01:00
Lukas Klingsbo
e373697a93 docs: To -> from zapp link bug issue template (#2255) 2023-01-05 14:11:49 +00:00
Lukas Klingsbo
fe91042323 docs: Add Flame Zapp link to bug issue template (#2253)
Adds a link to https://zapp.run/edit/flame-zh006agh106 in the issue template, since Flame is already set up in there it is incredibly easy to share and run MREs from there.
2023-01-05 13:58:01 +00:00
Pasha Stetsenko
2e646b7fbc fix title validator (#2230) 2022-12-22 00:34:39 +01:00
Pasha Stetsenko
d50585f9c7 ci: Add list of conventional commit prefixes (#2227)
Include the list of allowed Conventional Commit prefixes into the PR template, and into the title validator action; otherwise this information is too hard to hunt down (https://github.com/commitizen/conventional-commit-types/blob/master/index.json)
The title validator now checks that the PR title starts with a capital letter.
Removed checklist item "The title of my PR starts with a Conventional Prefix", since this is now enforced automatically.
2022-12-21 20:53:10 +01:00
Pasha Stetsenko
e302f8e171 docs: Add "teh" as a flag word in spellchecker (#2226)
This prevents the same typo happening again.
Followup for #2225.
2022-12-21 10:59:20 +01:00
Pasha Stetsenko
a99c930381 docs: Description of jenny package (#2102)
Adding preliminary description for the jenny project
2022-12-16 07:57:06 +01:00
Lukas Klingsbo
f3a82d881b ci: Try using other PAT for docs build (#2206) 2022-11-28 21:27:40 +00:00
Lukas Klingsbo
7b806f0597 ci: Try triggering doc action from curl (#2205) 2022-11-28 21:15:08 +00:00
Lukas Klingsbo
c398d61368 ci: Add repository line for docs build dispatch (#2204) 2022-11-28 20:57:46 +00:00
Lukas Klingsbo
8a6cf0b67d ci: Use external action for remote doc build (#2203) 2022-11-28 17:33:01 -03:00
Lukas Klingsbo
d18bdd8e29 ci: Use curl instead of GH to dispatch job request for docs (#2202) 2022-11-28 21:11:01 +01:00
Lukas Klingsbo
e4686c7675 ci: Try to build docs with only GH_TOKEN set to PAT (#2201) 2022-11-28 19:58:47 +00:00
Lukas Klingsbo
f17862e99e ci: Try adding GH_TOKEN too (#2200) 2022-11-28 19:44:02 +00:00
Juan Rodriguez
78fabce028 ci: Build flame-docs-site on push (#2199)
Instead of the curl command, it uses the gh cli tool.
2022-11-28 20:23:16 +01:00
Pasha Stetsenko
9364a0dd32 feat: Add support for user-defined functions in jenny (#2194)
User-defined functions allow the user to extends the functionality of a Yarn script with custom functions.
2022-11-27 22:31:09 +00:00