PathEngine home | previous: | next: |
The demo shows how PathEngine preprocessed obstacle set mechanism can be applied to meet a certain, very specific, set of requirements.
Specifically, we assume that it is acceptable for agent behaviour to
lag behind the actual state of placed obstacles.
Given this basic assumption we can then implement fast pathfinding
in situations where large numbers of obstacles may be placed and subject to
arbitrary run-time changes.
There are a number of ways in which the implementation shown can be tweaked to
address different sets of requirements
(see
The demo starts, by default, with a large square environment and some scenery obstacles already placed.
1000 moving agents are also placed (randomly) on demo initialisation, and assigned paths to random positions.
These agents will then advance along their paths as the demo runs,
changing to new targets whenever a current target is reached, or if movement is blocked by newly placed obstacles.
While the demo is running, a basic UI enables the set of scenery obstacles to be changed arbitrarily, either by marking obstacles for deletion, or by placing completely new obstacles.
Newly placed obstacles are initially implemented with PathEngine's standard dynamic obstacles mechanism,
so that these obstacles are included in pathfinding queries, but at an additional cost.
Deleted obstacles are initially just marked for deletion.
The user can then choose to trigger a background thread update.
This removes any obstacles currently marked for deletion,
and integrate newly added obstacles fully with the pathfinding preprocess, for full speed pathfinding around these obstacles.
Obstacles marked for deletion are rendered in red,
obstacles included in the current pathfinding preprocess are rendered in white,
and obstacles being handled completely dynamically are rendered in orange.
There is also a tally of the number of preprocessed and dynamic obstacles displayed at the foot of the screen.
Agents are coloured according to their current 'connected region',
as determined based on the current set of fully preprocessed obstacles.
The starting mesh has just one connected region, so all agents will initially be rendered in the same colour,
but if you block off one of the 'gates', to create a fully enclosed region, and then trigger an update,
the agents inside that enclosed region should then be coloured differently to the agents outside the region.
A gate is blocked, by dynamic obstacles initially.
The obstacles are added to pathfinding preprocess, after an update, and connected regions assigned.
(You will see that pathfinding query times increase as more and more completely dynamic obstacles are placed, with these query times then being reduced after an update has completed and the obstacles are integrated with pathfinding preprocess.)
You can try out different meshes by replacing the file 'SDKRoot/resource/meshes/semiDynamicObstacles.tok'.
Any valid PathEngine ground mesh can be used with this demo.
On initialisation, the set of semi-dynamic obstacles is initialised from the set of named obstacles found on the mesh.
On saving state, these named obstacles will then be replaced by the updated set of obstacles.
If you delete the file 'SDKRoot/resource/meshes/semiDynamicObstacles.tok' then the prototype will start with a blank partitioned square.
Documentation for PathEngine release 6.04 - Copyright © 2002-2024 PathEngine | next: |