Pathfinding

Pathfinding describes how a character gets from one location to another in a game level. Pathfinding involves solving a number of complex problems:

  • Avoiding terrain obstacles: walls and cliffs
  • Avoiding other characters
  • Finding ways around dynamic, destructible and interactive obstacles
  • Satisfying specific constraints on constructed paths: staying out of sight, and staying out of enemy territory

The Kynapse pathfinding framework is designed to be flexible for varying complexities. For typical scenarios, it can operate like a “black box” where a developer sets up the environment and allows the individual agents to find their way. For more advanced scenarios, developers can work with pathfinding classes directly.

In terms of performance, Kynapse has highly optimized pathfinding capabilities and the developer is able to work with the large, complex levels found in massively multiplayer role-playing games. For such large levels, the developer can use Kynapse to stream the PathData, so that Kynapse uses less memory at runtime. The developer can also use the Kynapse “time-slicing” functionality, which caps the amount of CPU usage per frame and defers pathfinding calculations so that Kynapse does not need to recalculate on every frame.

Two other complex pathfinding scenarios are obstacles, and PathObjects.

Obstacles

An obstacle is anything which a character shouldn’t move through, but is not built into the actual level data. Furniture, rubble and vehicles are typical obstacles in games. Kynapse offers an extensive framework for working with obstacles so that characters can find their way around obstacles. In complex circumstances, obstacles can be dynamic and move around. For example, in a destructible environment, one might find rubble that falls and blocks characters. In these circumstances, pathfinding changes for a specific area of the map. This is called Local PathFinding, which Kynapse does support well.

Agents programmed using Kynapse can perform local pathfinding on dynamic environments.

Terrain Type Tagging

Tag different types of terrains and enable characters to use or avoid them. For example, a city might have sidewalks and roads. Characters can be constrained to only walk on sidewalks and use crossings.

Developers can tag different types of terrain and obstacles, and create behaviors based on those. In this example, characters without a mask have to find an alternative path around the leaking gas. The character with a helmet is able to path-find straight through the obstacle

PathObjects

PathObjects are special objects in a level that a character can interact with to get from one location to another: ladders, lifts, teleporters, and doors. Kynapse enables developers to either use off-the-shelf PathObjects, or create their own with the provided framework. Included PathObjects are doors, ladders, teleporters and jumping points.

In this example, we are using an elevator as a PathObject.