Add support to share the polygons of a Path among PathComponent and PathHitbox
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 15/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Ambito
- game-dev, performance
Direzione di ricerca
PR #4216 already contains the proposed implementation, tests, and documentation for PathComponent and PathHitbox. Review that pull request and its tests to understand the change; the issue is complete when the PR is merged or its implementation is otherwise incorporated.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem to solve
PathComponent and PathHitbox sample their Path into polygons in their constructor, with
toPolygons, and that sampling is most of what creating one costs. When a game creates many of
them for the same path, like the hitboxes of e.g. enemies spawned over and over, it samples the
same path again for each one: there is no way to reuse polygons already computed, since the
constructor always samples.
Proposal
Add an optional polygons argument to the PathComponent constructor, passed on by PathHitbox.
When it is given, the path is not sampled:
- The polygons are in the coordinates of the given
path, aspath.toPolygons()returns them, or
they are thepolygonsof another component, given along with itspath. - They are copied and moved along with the path, so they can be shared safely.
sampling,toleranceandfilterare not used; they go totoPolygonsinstead.
final polygons = outline.toPolygons(sampling: 2);
final hitboxes = [
for (var i = 0; i < 10; i++) PathHitbox(path: outline, polygons: polygons),
];
A named constructor is not an option, since Dart doesn't allow a non-redirecting generative
constructor next to a primary one (non_redirecting_generative_constructor_with_primary).
More information
I have opened PR #4216 with the proposed implementation, along with tests and the documentation of
PathComponent and PathHitbox.
Other
- Are you interested in working on a PR for this?
- Lingua principale
- Dart
- Stelle
- 10.8k
- Fork
- 1.1k
- Merge medio
- 2g 6m
- PR unite (30g)
- 56
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di flame-engine/flame
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 91/100
flame-engine/flame#4219 ·
I maintainer di solito rispondono entro 1 giorno
-
`UniformsSetter.setColor` sends every color to the shader as blackForse già presa @ufrshubham l’ha presa 5 giorni fa. Apertabug
flame-engine/flame#4211 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
`Viewfinder.visibleGameSize` is not reapplied when the viewport changes sizeForse già presa @ufrshubham l’ha presa 8 giorni fa. Apertabug
flame-engine/flame#4204 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
`Viewfinder.visibleGameSize` zooms in too far with a `FixedResolutionViewport`Forse già presa @ufrshubham l’ha presa 8 giorni fa. Apertabug
flame-engine/flame#4203 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Camera bounds with `considerViewport: true` are not updated when the viewport is resizedForse già presa @ufrshubham l’ha presa 8 giorni fa. Apertabug
flame-engine/flame#4202 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di flame-engine/flame
Issue simili
-
SchedulerBinding.requestPerformanceMode(mode) does not forward the requested mode to the engine.Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
carp demo apps enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
carp-dk/carp.sensing-flutter#670 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
ToUnicode CMap writes code points above U+FFFF as plain hex (5-6 digits), not UTF-16BEForse già presa @Rupali59 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 4 giorni