Port of Recast Navigation into Delphi
Pascal
Latest commit 495420d Dec 16, 2015 @Kromster80 Fix as in original
Permalink
Failed to load latest commit information.
common Common units required Dec 14, 2014
License.txt Renaming to match folder name Dec 14, 2014
README.md Update README.md Feb 21, 2015
RN_ChunkyTriMesh.pas Synced the code with Recast on 28 Jan 2015 Jan 28, 2015
RN_CrowdTool.pas Removed & Feb 21, 2015
RN_DebugDraw.pas duDebugDrawGridXZ Feb 21, 2015
RN_DetourCommon.pas Enabled "typed @ operator" compiler check to catch porting bugs Dec 22, 2014
RN_DetourCrowd.pas My changes Aug 29, 2015
RN_DetourDebugDraw.pas Bugfix. loop with a separate signed loop var Feb 21, 2015
RN_DetourDump.pas Ported code Dec 14, 2014
RN_DetourLocalBoundary.pas Tabs to Spaces Feb 21, 2015
RN_DetourNavMesh.pas Removed unused var May 3, 2015
RN_DetourNavMeshBuilder.pas Fixed bug in segments adding Dec 26, 2014
RN_DetourNavMeshHelper.pas Ported code Dec 14, 2014
RN_DetourNavMeshQuery.pas Tabs to Spaces Feb 21, 2015
RN_DetourNode.pas Ported code Dec 14, 2014
RN_DetourObstacleAvoidance.pas Fix as in original Dec 16, 2015
RN_DetourPathCorridor.pas Tabs to Spaces Feb 21, 2015
RN_DetourPathQueue.pas Tabs to Spaces Feb 21, 2015
RN_DetourProximityGrid.pas Tabs to Spaces Feb 21, 2015
RN_DetourStatus.pas Ported code Dec 14, 2014
RN_DetourTileCache.pas Ported code Dec 14, 2014
RN_Helper.pas Ported code Dec 14, 2014
RN_InputGeom.pas Enabled "typed @ operator" compiler check to catch porting bugs Dec 22, 2014
RN_MeshLoaderObj.pas Fixed string manipulation to support XE2 and below Sep 2, 2015
RN_NavMeshPruneTool.pas Synced the code with Recast on 28 Jan 2015 Jan 28, 2015
RN_NavMeshTesterTool.pas Removed & Feb 21, 2015
RN_NavMeshTileTool.pas GUI updated to include TileMesh sample Feb 21, 2015
RN_PerfTimer.pas Time in msec Dec 20, 2014
RN_Recast.pas Enabled "typed @ operator" compiler check to catch porting bugs Dec 22, 2014
RN_RecastAlloc.pas Ported code Dec 14, 2014
RN_RecastArea.pas Ported code Dec 14, 2014
RN_RecastContour.pas Synced the code with Recast on 28 Jan 2015 Jan 28, 2015
RN_RecastContourHelper.pas Ported code Dec 14, 2014
RN_RecastDebugDraw.pas Enabled "typed @ operator" compiler check to catch porting bugs Dec 22, 2014
RN_RecastDump.pas duReadCompactHeightfield Jan 6, 2015
RN_RecastFilter.pas Ported code Dec 14, 2014
RN_RecastHelper.pas Ported code Dec 14, 2014
RN_RecastLayers.pas Tabs to Spaces Feb 21, 2015
RN_RecastMesh.pas My changes Aug 29, 2015
RN_RecastMeshDetail.pas Synced the code with Recast on 28 Jan 2015 Jan 28, 2015
RN_RecastRasterization.pas Enabled "typed @ operator" compiler check to catch porting bugs Dec 22, 2014
RN_RecastRegion.pas Ported code Dec 14, 2014
RN_Sample.pas GUI updated to include TileMesh sample Feb 21, 2015
RN_SampleInterfaces.pas Need this special IFDEF code for my app, to swap axis Aug 29, 2015
RN_SampleSoloMesh.pas GUI updated to include TileMesh sample Feb 21, 2015
RN_SampleTileMesh.pas saveAll/loadAll Mar 7, 2015
RN_ValueHistory.pas Tabs to Spaces Feb 21, 2015
RecastNavigationDelphi.dpr GUI updated to include TileMesh sample Feb 21, 2015
RecastNavigationDelphi.dproj GUI updated to include TileMesh sample Feb 21, 2015
Unit_Form.dfm Form layout Mar 7, 2015
Unit_Form.pas GUI updated to include TileMesh sample Feb 21, 2015
Unit_FrameCrowdTool.dfm GUI updated to include TileMesh sample Feb 21, 2015
Unit_FrameCrowdTool.pas Fixed bug in segments adding Dec 26, 2014
Unit_FramePruneTool.dfm GUI updated to include TileMesh sample Feb 21, 2015
Unit_FramePruneTool.pas Ported code Dec 14, 2014
Unit_FrameSampleSoloMesh.dfm GUI updated to include TileMesh sample Feb 21, 2015
Unit_FrameSampleSoloMesh.pas GUI updated to include TileMesh sample Feb 21, 2015
Unit_FrameSampleTileMesh.dfm GUI updated to include TileMesh sample Feb 21, 2015
Unit_FrameSampleTileMesh.pas GUI updated to include TileMesh sample Feb 21, 2015
Unit_FrameTesterTool.dfm GUI updated to include TileMesh sample Feb 21, 2015
Unit_FrameTesterTool.pas Ported code Dec 14, 2014
Unit_FrameTileTool.dfm GUI updated to include TileMesh sample Feb 21, 2015
Unit_FrameTileTool.pas GUI updated to include TileMesh sample Feb 21, 2015
nav_test.obj Sample model Dec 14, 2014

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.