Friday, February 5, 2010
Area Progress pt. 5
Oh noes, this dude cannot swim so he has to walk around the pond!
I'm starting to be happy about the workflow of creating the areas and the ability flags and areas are passes all the way to Detour.
The solution I settled into was to use area type and ability flags per polygon. Area type specifies the cost to travel across the polygon and ability flags specifies if the agent can travel through the area at all. There are 64 area types and 16 abilities. Should be enough for everyone. The cost value will be multiplier to travel distance across the polygon.
Other than that Detour does not imply the meaning of flags or area types at all. The actual abilities and area types are specified by the game. Recast demo has some example types and abilities just to keep the samples consistent.
The building block of marking areas is extruded convex polygon. I will add other types as people need them. You should get pretty far with that type already.
Note that, the resulting area on the navmesh will not be the same as the input polygon. This is because the area generation goes through voxelization, which snaps the area to a grid, and through contour simplification which may cut few more corners. I'm eager to hear how this works in practice.
For the time being, I don't have plans to add area marking cookie cutters which work at geometry level.
The path finding cost is not adjusted yet. It is a bit nasty task to do as I need to refactor few things, such as querying the polygons during path search. I'm also seeing funky pathing cases here and there, which I hope to fix in the process too.
Another thing that still needs to be done is adding API to adjust the polygon ability flags and area types.
The latest iteration is available from the SVN, use with caution :)