flame-engine / flame-engine/flame

Separate onComponentTypeCheck on two functions

Open
#2,591 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Dart
Stars
10.8k
Forks
1k
Avg merge
1d 20h
Merged PRs (30d)
21

Description

# What could be improved
Currently `onComponentTypeCheck` runs per-component and allows to decide if one component could ever to collide with another. The result is also saved per-component, so iw we have 1000 components with same type - there will be cache storage with 1000 results. In other hand, it allows to check some of component's instance parameters but only once.

# Why should this be improved
We could introduce additional function, for example `pureTypeCheck` which will really check just only `Type` of components. Using this instead of `onComponentTypeCheck` might to improve functionality because:
- The check itself is simplier.
- The array of cached results is much smaller: for 1000 components with same type we will have just 1 record in cache.

It also worth to keep original `onComponentTypeCheck` as is, but describe the difference in documentation

# Any risks?
Fine-tuning of collision detection system makes it more and more complicated, but this functions can be ignored if not needed.

# More information
I already have tested implementation and can port it into Flame's core.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.