New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store ICrushable traits as actor field. #21261
Store ICrushable traits as actor field. #21261
Conversation
related #14920 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have so many traits against actor for pathfinding perf, I think moving Crushable out of Common is acceptable to enable this last one.
We should really create a dumbed down version of actor that actor inherits |
something that tree's for example could be. They for example don't need activities nor order handling
could you list them? |
Lines 164 to 183 in 9a1823d
|
Store
ICrushable
traits as actor field.To avoid using calls to trait dictionary
TraitsImplementing
that will cause the actor to be looked up in a list of all actors - with theICrushable
trait - using a binary search.Relevant as path planning uses it to determine if a cell is blocked.
The down side is that actor needs to be ICrushable aware. This requires the move of ICrushable from Common to OpenRA.Traits.
Alternative could be to only introduce an abstract IActorIsBlockingCheck trait that could be cast to an ICrushable. But that seems less clean. Or to let trait dictionary store certain traits that are looked up mostly by actor as a hash table.