Port of Recast Navigation into Delphi
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
common
License.txt
README.md
RN_ChunkyTriMesh.pas
RN_CrowdTool.pas
RN_DebugDraw.pas
RN_DetourCommon.pas
RN_DetourCrowd.pas
RN_DetourDebugDraw.pas
RN_DetourDump.pas
RN_DetourLocalBoundary.pas
RN_DetourNavMesh.pas
RN_DetourNavMeshBuilder.pas
RN_DetourNavMeshHelper.pas
RN_DetourNavMeshQuery.pas
RN_DetourNode.pas
RN_DetourObstacleAvoidance.pas
RN_DetourPathCorridor.pas
RN_DetourPathQueue.pas
RN_DetourProximityGrid.pas
RN_DetourStatus.pas
RN_DetourTileCache.pas
RN_Helper.pas
RN_InputGeom.pas
RN_MeshLoaderObj.pas
RN_NavMeshPruneTool.pas
RN_NavMeshTesterTool.pas
RN_NavMeshTileTool.pas
RN_PerfTimer.pas
RN_Recast.pas
RN_RecastAlloc.pas
RN_RecastArea.pas
RN_RecastContour.pas
RN_RecastContourHelper.pas
RN_RecastDebugDraw.pas
RN_RecastDump.pas
RN_RecastFilter.pas
RN_RecastHelper.pas
RN_RecastLayers.pas
RN_RecastMesh.pas
RN_RecastMeshDetail.pas
RN_RecastRasterization.pas
RN_RecastRegion.pas
RN_Sample.pas
RN_SampleInterfaces.pas
RN_SampleSoloMesh.pas
RN_SampleTileMesh.pas
RN_ValueHistory.pas
RecastNavigationDelphi.dpr
RecastNavigationDelphi.dproj
Unit_Form.dfm
Unit_Form.pas
Unit_FrameCrowdTool.dfm
Unit_FrameCrowdTool.pas
Unit_FramePruneTool.dfm
Unit_FramePruneTool.pas
Unit_FrameSampleSoloMesh.dfm
Unit_FrameSampleSoloMesh.pas
Unit_FrameSampleTileMesh.dfm
Unit_FrameSampleTileMesh.pas
Unit_FrameTesterTool.dfm
Unit_FrameTesterTool.pas
Unit_FrameTileTool.dfm
Unit_FrameTileTool.pas
nav_test.obj

README.md

RecastNavigationDelphi

Port of Recast Navigation into Delphi

Source code location: https://github.com/memononen/recastnavigation

Source code version: Around 01 Nov 2014

Porting guidelines:

  • RecastNavigationDelphi is a straight clone of RecastNavigation with as little changes as possible, to allow to keep projects synced in the future.
  • Any changes/improvements to the lib functionality should be first included into C++ master to avoid separation.
  • RND follows RN structure very closely, except for GUI stuff, which is VCL for simplicity instead of imGUI RN solution.
  • All file names are the same, but with an "RN_" prefix.
  • Some units were split to avoid circular dependencies, they are called RN_UnitNameHelper.

Hints about the code:

  • Multi-condition "for" loops and loops where iterator gets changed inside the loop, were converted to while/repeat loops. Loop code needs to be repeated before any "continue".
  • Move method first two arguments (Src, Dst) need to be swapped in Delphi.
  • Delphi needs to wrap overflowing manipulations with a {$O} directive to supress errors.
  • Delphi needs manual disposal of objects created within record , as they dont have built-in destructor support in them.
  • To simplify the pointer trickery, {$POINTERMATH ON} had to be enabled almost in every unit.
  • Typed @ operator setting is great help, but sadly it does not work sometimes.

Common pitfalls during porting:

  • Passing argument @SomePointer instead of SomePointer. Typed @ helps to catch those, but not always.
  • Calling Move/FillChar methods without swapping arguments places.
  • Writing for .. to .. do loop instead of for .. downto .. do in rare cases.

Todos:

  • Fix plethora of memory leaks around the code.
  • TempObstacles demo.
  • Some parts are commented out, waiting to be ported.
  • Sync with current state of the source code.