Skip to content
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

IAcceptResource to maintain Occupance count #20288

Closed
anvilvapre opened this issue Sep 12, 2022 · 1 comment · Fixed by #20636
Closed

IAcceptResource to maintain Occupance count #20288

anvilvapre opened this issue Sep 12, 2022 · 1 comment · Fixed by #20636

Comments

@anvilvapre
Copy link
Contributor

ClosestProc in OpenRA.Mods.Common/Traits/Harvester.cs uses quite an expensive query to calculate how much harvesters are already associated with a IAcceptResources trait. It queries all harvesters to see if they are linked to IAcceptResources trait - for each trait.

An optiomization would be to just maintain an Occupancy count per IAcceptResources. Harvesters would have to increment and decrement this value.

The value indicates how many harvesters are associated with the trait. Allowing the spreading of harvesters over traits/refineries.

Relevant whenever a harvester tries to find a new refinery.

@PunkPun
Copy link
Member

PunkPun commented Sep 12, 2022

That's part of the plan with the docking refactor. I'm waiting for a few PR's to be merged before I get to optimising it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants