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
OpenRa trees edition #16698
OpenRa trees edition #16698
Conversation
Should be named |
StaticPathfinderBlock? Imo the problem with using "permanent" is that we
are using it to also mark buildings that are not permement. So static would
suit better.
…On Sat, Jun 15, 2019, 13:10 Zimmermann Gyula ***@***.***> wrote:
Should be named "PermanentPathfinderBlock" or something along that line.
In the current modding environment, a "Static" trait name has no meaning.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#16698?email_source=notifications&email_token=AESI7GHGXOA67KH6ARBETPLP2TEYXA5CNFSM4HYOWNZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXYV35I#issuecomment-502357493>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AESI7GDQKNNDFJ5TUT2UK3DP2TEYXANCNFSM4HYOWNZA>
.
|
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.
👍 to StaticPathfinderBlocker
. I can see the static vs. permanent argument, but agree that permanent makes less sense here.
Updated! |
Wouldn't it make more sense to add this as an interface that |
Then we would had to add the handling for crushing (because of walls) again
and it was a bit messy. Or we would need to have a property on that
interface.
…On Sun, Jun 16, 2019, 01:19 Paul Chote ***@***.***> wrote:
Wouldn't it make more sense to add this as an interface that Building can
implement?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#16698?email_source=notifications&email_token=AESI7GCYVWAKMQXA5HLB37DP2V2GPA5CNFSM4HYOWNZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXZBZ6Y#issuecomment-502406395>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AESI7GCIWIWJBUFXGKS5KF3P2V2GPANCNFSM4HYOWNZA>
.
|
[17:37:54] +pchote having a property doesnt seem too bad |
If I'm following this right, when the A few high-level questions:
|
@RoosterDragon Regarding your last point - you're assuming too much there. For example, in RA, tree husks (charred trees) are separate actors. This means that while the tree itself can be killed, it's cell won't be freed up due to the charred husk. Cases like these require actual use-case insight and the code cannot determinate/would take a lot of edge-case-based assumptions to figure this out on his own. A marker trait poses less burden for maintenance for the developers and more exact setups for the modders. |
We cache both the cell cost and "is blocked". The gain caching the cell cost is arguable.
Mostly because its based on a previous PR that we closed that also cached crushing. And also for the cell cost which is dependent on the locomotor. If we gonna do the crushing type again as suggested by pchote above we need it for each locomotor.
That was my first idea:ish but https://logs.openra.net/?year=2019&month=05&day=25#20:37:57 |
b9ec2e4
to
e1baa4e
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.
Some initial comments. I haven't yet looked at the meat of the cost/blocking cache logic.
Updated! |
Updated with the things discussed. |
63b854c
to
0ebc455
Compare
@@ -84,6 +84,7 @@ sealed class PathGraph : IGraph<CellInfo> | |||
|
|||
readonly CellConditions checkConditions; | |||
readonly LocomotorInfo locomotorInfo; |
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 doubt caching locomotorInfo
separately is worth it now. Can you remove this and use locomotor.Info
directly instead?
@@ -45,13 +45,16 @@ class HarvesterTraitWrapper | |||
public readonly Harvester Harvester; | |||
public readonly Parachutable Parachutable; | |||
public readonly LocomotorInfo LocomotorInfo; |
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.
Same here.
var li = self.Info.TraitInfo<MobileInfo>().LocomotorInfo; | ||
using (var search = PathSearch.FromPoints(self.World, li, self, refs.Values.Select(r => r.Location), self.Location, false) | ||
|
||
var locomotor = mobile.Locomotor; |
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.
The old var
was mostly about reducing line length of the using
, I think we can drop this now and use mobile.Locomotor
directly below.
@@ -64,7 +64,10 @@ public PathFinder(World world) | |||
|
|||
public List<CPos> FindUnitPath(CPos source, CPos target, Actor self, Actor ignoreActor) | |||
{ | |||
var li = self.Info.TraitInfo<MobileInfo>().LocomotorInfo; | |||
var mobile = self.Trait<Mobile>(); | |||
var li = mobile.Info.LocomotorInfo; |
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'd either drop this (likely no real benefit) and use locomotor.Info
directly, or at least move it below locomotor
so you can just populate it by locomotor.Info
.
var li = mi.LocomotorInfo; | ||
var mobile = self.Trait<Mobile>(); | ||
var li = mobile.Info.LocomotorInfo; | ||
var mi = mobile.Info; |
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.
If you switch order of these two, you can populate li
through mi.LocomotorInfo
.
LGTM after those final nits 👍 |
This appears to have caused tick times to increase on the RA shellmap from ~10ms to ~14ms on my machine. Can anybody else reproduce? Profiling suggests |
Confirmed (~6 → 9ms in my case), and derp at the massive blind spot that we had in testing/profiling this. |
Yeah. Last commit seems to be the culprit. |
We can save this by changing At this point its probably going to be better to revert this, and aim an improved version for Next + 1. |
Or go parallel? |
The perf regression was caused by a silly bug rather than any fundamental algorithm issue - fixed in #16846. |
Adding a new trait, "Static" to mark actors that we can cache for the blocking check in the Pathfinder.
Benchmark 1
Map
Results
Benchmark 2
Map
Results
And without log scale