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
HitShape, query trait via actor cached targetable positions. #20165
Conversation
8f88126
to
00517ff
Compare
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.
I think the // PERF
comment should be added everywhere we cast to HitShape, not just the few instances
00517ff
to
b481dca
Compare
Done. |
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.
Untested, but code LGTM
Reading around your changes, I noticed some minor housekeeping is in order. I feel it would be best done before the changes in this PR, but since it's small enough that could also be done by you cherry-picking my commit and rebasing yours on top of it. P.S.: Sorry, I see in the mean time you updated the PR to be closer to what I have, but I still think mine is even cleaner, so my request stands. |
The reason to cache an |
Never mind my comment then. This does call for some explanatory comments though, but that's not related to this PR. |
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.
Hitshapes still function in-game.
b481dca
to
48d425e
Compare
HitShape is the most looked up trait per per actor using
TraitsImplementing
.Using this method will search the global
TraitDictionary
for all actors with the trait and after search for the actor on which the method was called.Changes:
TraitsImplementing
use the already availableenabledTargetablePositions
to findHitShape
traits.Actor.GetEnabledTargetablePositions
.Optional suggestions:
Actor.GetTargetablePositions
toActor.GetEnabledTargetableWorldPositions
TraitInterfaces
. AddITargertablePositionsInterface.TargetableShapes()
to return an enumeration of HitShapes.Assumptions:
ITargetablePositions
toHitShape
is faster than each time searching for an actor in the trait container.Advantage:
Statistics on traits being most often queried for an actor using
TraitDictionary.WithInterface
. Shelllmap + a short bot game,.