04-24-2015, 10:35 PM
(This post was last modified: 04-25-2015, 02:49 AM by LogicParrot.)
xoft Wrote:I think the interface is designed rather poorly. The cPathFinder should have a cPath object in it that should wrap the path being calculated, it should return a const reference to that internal object in GetPath() (and GetPath should not modify it)
This is only good for the specific case of a mob interested in having 1 path at a time, e.g. a zombie chasing a player. But suppose some NPC would like to pre-calculate 10 paths only once.
Besides, this is exactly the "dumb, path spitting device" you requested.
xoft Wrote:Calling StartPathfinding (former findPath) should clear the path and start calculating, calling Step (former isCalculationFinished) will calculate a few steps of the path and return true if the calculation is finished. Calling Step after the calculation finishes is not an error; calling StartPathfinding before a path is found resets the current path and starts another search.Valid points.
Error handling currently sucks, (And some of it is currently missing, like when the path is not reachable), it will be redesigned.
xoft Wrote:It may get through the CheckBasicStyle.lua script, but only because the script cannot check the style in all cases. We use spaces around ALL operators, we use CamelCase for function names, and exactly 5 empty lines between function bodies in cpp files. Preprocessor instructions should get regular indent. #includes should go first in the file, then everything else. And the preprocessor macro you use for sharing the source with another app is named just really terribly.Ok, All valid criticism. will fix.
Except one point: __PATHFIND_DEBUG__ is precisely what the other app is, a Pathfinding debugger. Got a better name?
xoft Wrote:Speaking of naming, names like "m_F", "m_G" etc. are useless.F,G,H is a standard A* naming scheme for the 3 values each cell has, where F = G + H, where H is the heuristics. any person with pathfinding experience knows what H,F,G are and I think it makes sense to name it that way.
http://theory.stanford.edu/~amitp/GamePr...rison.html
http://www.policyalmanac.org/games/aStarTutorial.htm