Repository navigation
Pathfinding Improvements - #444
Conversation
… different values Added test calculation to allocate different number of blocks based on map size. It causes slowdown though.
… doors, even when closed)
garethyr
left a comment
There was a problem hiding this comment.
Good work!
Various little cleanups and changes to do
| @@ -2891,7 +2905,25 @@ void Scene::ResetPathFinding() | |||
|
|
|||
| void Scene::UpdatePathFinding() | |||
There was a problem hiding this comment.
Assuming it's not too unwieldy, I'd rather have the method comment explain what's going on in a bit more detail, rather than all these inline comments.
I.e. explain that the method updates the shared pathfinder and, if there are changes, updates the individual ones, ensuring that doors for each team are ignored.
There was a problem hiding this comment.
In this case I'd prefer that they're inline. Externally, the only thing that a user of the function needs to know is that this recalculates outdated pathing data - how it does that in this case (using several pathfinders and swapping around door materials and all that crap) are entirely internal implementation details that could change. The function contract is that this recalculates outdated pathing data, the details of how shouldn't matter.
Furthermore, having the comments be next to the actual lines of code means that if or when things do change, it's easier to remember to update them.
There was a problem hiding this comment.
Hmmm, I don't really agree. Inline comments are valuable to explain
- Why a seemingly odd decision was made
- What some piece of unclear, complicated (or math-heavy) code is doing
If you need them for stuff other than that, things need to be renamed and fiddled with to make the code clearer, imo.
For the most part, these comments don't really do either of those 2 things. They're not as useless as some dancomments that would just, for example, say something like:
// Override door material for team
g_MovableMan.OverrideMaterialDoors(true, team);But they're also mostly explaining pretty clear things.
I guess the only part of it that's at all non-obvious is the shared pathfinder being NoTeam, and I'd rather that be more of a note that the shared pathfinder uses NoTeam, instead of basically saying "RecalculateAreaCosts updates the pathfinder". Also, I think the shared pathfinder using NoTeam is explained in other places anyway, right?
There was a problem hiding this comment.
I think that the overriding material doors being used for team-specific pathing is not obvious. I didn't understand it initially, so that's why I'm being explicit.
There was a problem hiding this comment.
That's an easy solve though isn't it - this method exists solely for this purpose, so you can just rename it to be more clear.
Heck, I don't even think the method really belongs in movableman, it's just there cause that's where Data put it. It'd be perfectly reasonable as a private Scene method imo - EraseOrRedrawDoorTerrainLayerForTeamPathfindinging or something like that.
Changing max to std::max in AHuman Tweaking formatting, whitespace, etc. in areas that were touched by existing changes Fixing up a few method comments Killing a few unnecessary inline comments, and tweaking others Other stuff
f198582 to
9d124fe
Compare
# Conflicts: # CHANGELOG.md - no real conflicts, solved manually
…en AI ticks, not necessarily true passed time) but that's an implementation detail.
…/cortex-command-community/Cortex-Command-Community-Project-Source into experimental-pathfinding-changes
Made Scene::GetPathfinder private and moved its definition into header Made AIUpdateInterval lua property readwrite Fiddled with SettingsMan pathfinder grid node size stuff Fixed AIDeltaTime stuff in timerman Fixed region in controller Made magic number 8 a static constexpr in pathfinder, reorganized and made protected methods private
The comment doesn't make sense as a method remark, it's an internal detail, not related to actually using the method. Also tweaked the member variable comment for m_pPathFidners so it has a bit more detail
Uh oh!
There was an error while loading. Please reload this page.