We need to update passability only for modified terrain plus edges.
Details
- Appy the patch and compile the game
- Run atlas and enable passability visualization (building-land)
- Make sure that terrain elevation worked faster and passability map is modified immediately
Diff Detail
- Repository
- rP 0 A.D. Public Repository
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
Successful build - Chance fights ever on the side of the prudent.
Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/997/display/redirect
Successful build - Chance fights ever on the side of the prudent.
Link to build: https://jenkins.wildfiregames.com/job/macos-differential/93/display/redirect
Successful build - Chance fights ever on the side of the prudent.
Linter detected issues: Executing section Source... source/simulation2/components/CCmpPathfinder_Common.h | 34| #include·"graphics/Overlay.h" | | [MAJOR] CPPCheckBear (syntaxError): | | Code 'template<...' is invalid C code. Use --std or --language to configure the language. Executing section JS... Executing section cli...
Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1515/display/redirect
Hey, this looks great! I didn't realize the message had that terrain information when I wrote the code!
Everything works fine for me and the code looks good, I just have a question about boundaries...
An extra test (which I didn't run but would be needed) is a serialization test on a map where the terrain changes during the game: typically Extinct Volcano.
source/simulation2/components/CCmpPathfinder.cpp | ||
---|---|---|
623 ↗ | (On Diff #10956) | why isn't itile1 + 1 needed? it's not clear to me when reading the comment. |
I think it's not enough, because it has only water level changes. That means the whole grid will be updated (no partial update).
source/simulation2/components/CCmpPathfinder.cpp | ||
---|---|---|
623 ↗ | (On Diff #10956) | You're right, there should be +1. |
That's true. I don't think we have other occurrences of in-game terrain changes though (especially since, before this patch, they would be quite expensive).
source/simulation2/components/CCmpPathfinder.cpp | ||
---|---|---|
575 ↗ | (On Diff #10956) | Why is the default param commented here? Shouldn't you comment the others as well? Wouldn't it be better if it matched the signature 1:1 ? |
source/simulation2/components/CCmpPathfinder.cpp | ||
---|---|---|
575 ↗ | (On Diff #10956) | I think /* = true */ isn't needed here, since it doesn't give us a useful piece of information. |
source/simulation2/components/CCmpPathfinder.cpp | ||
---|---|---|
575 ↗ | (On Diff #10956) | I like to put the default param like this in the implementation, because else you have to open the header to see what are the default values, if any. But with the new parameters it looks out of place. You can remove it if you want. Maybe expandPassability shouldn't be optional, I don't remember how many calls of the function there are. |
source/simulation2/components/CCmpPathfinder.cpp | ||
---|---|---|
575 ↗ | (On Diff #10956) | I understand that it might be useful. But in which cases you need to know information about a default value inside a function? Usually it's needed for callers. |
source/simulation2/components/CCmpPathfinder.cpp | ||
---|---|---|
575 ↗ | (On Diff #10956) | True. However for helper functions like this one usually all the callers are in the same .cpp file. |
source/simulation2/components/CCmpPathfinder.cpp | ||
---|---|---|
575 ↗ | (On Diff #10956) | I was thinking about that too. Usually callers aren't aggregated in a place near to a function. A file is growing and there are lot of lines between a caller and the function. So it's easier to open a header in that case. |
Successful build - Chance fights ever on the side of the prudent.
Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/1001/display/redirect
Successful build - Chance fights ever on the side of the prudent.
Link to build: https://jenkins.wildfiregames.com/job/macos-differential/97/display/redirect
Successful build - Chance fights ever on the side of the prudent.
Linter detected issues: Executing section Source... source/simulation2/components/CCmpPathfinder_Common.h | 34| #include·"graphics/Overlay.h" | | [MAJOR] CPPCheckBear (syntaxError): | | Code 'template<...' is invalid C code. Use --std or --language to configure the language. Executing section JS... Executing section cli...
Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1519/display/redirect
Excluding the in-game terrain updates, which are not actually implemented, everything works fine for me and the code looks good.
when I wrote the code
(A commit reference would be useful to ease commit traversal while reviewing, auditing or revisioning)
in-game terrain updates, which are not actually implemented
(I remember that extinct volcano map with rising water that sent simulation terrain updates, also aren't atlas changes ingame terrain updates? I.e. suppose that map wouldnt benefit from performance improvments since water is everywhere, so it's never a partial update? And script components / trigger script partial terrain changes are the thing which is not implemented (rather than this patch not implementing the improvement there? I suppose I could read the code)
It was rP16824. And that is funny: looking at the commit, I had written a TODO, so I knew! I then removed the TODO in rP16827, just three revisions later, when I thought the improvements I made were enough.
also aren't atlas changes ingame terrain updates?
Well, by in-game, I meant literally in game, when playing. Indeed, from the point of view of the code, the simulation is running the same in Atlas and in-game, but that's not what I meant.
I remember that extinct volcano map with rising water that sent simulation terrain updates, I.e. suppose that map wouldnt benefit from performance improvments since water is everywhere, so it's never a partial update? And script components / trigger script partial terrain changes are the thing which is not implemented (rather than this patch not implementing the improvement there? I suppose I could read the code)
Yes to all of the questions here, and you can read the code if you want ?