PathEngine home previous: 'MemoryBenchmark'next: 'ThreadPool'
Contents, Programmers Guide, Example Projects, Other Examples, 'BackgroundLoading'

'BackgroundLoading'

Description

A modified version of 'PathStress', with mesh loading, random base obstacle placement and preprocess generation performed in a background thread whilst pathfinding queries are running in a foreground worker thread.

In this example, a background thread iterates over a fixed size queue, loading meshes, generating preprocess and then pushing the meshes onto the queue once preprocess generation is complete.
A foreground thread pops meshes from the queue and runs a set of operations involving setting up random collision contexts and then running random pathfinding queries.

Tallies are displayed for the number of meshes queued and the number dispatched.

Note that the loading actually finishes quite quickly, and in this kind of pathfinding situation case background loading would probably not actually be required.
(When this example was added, the same loading process took quite a lot longer, but has been optimised quite significantly since then.)
It should be straightforward to switch in another mesh, however, and to adjust things like the number of obstacles placed, to increase the time taken for for the loading thread to process each mesh!


Documentation for PathEngine release 6.04 - Copyright © 2002-2024 PathEnginenext: 'ThreadPool'