YOU ARE DOWNLOADING DOCUMENT

Please tick the box to continue:

Transcript
Page 1: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Polygon Soup for Polygon Soup for the the

Programmer’s Programmer’s Soul: 3D Soul: 3D

PathfindingPathfindingPatrick Smith ([email protected])

Greg Hjelstrom ([email protected])

Page 2: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

IntroductionIntroduction

AI is an important contributor to the AI is an important contributor to the realism of games.realism of games. Pathfinding is a major component of Pathfinding is a major component of

convincing AI.convincing AI.

Page 3: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Problem DomainProblem Domain

Pathfinding requires connectivity.Pathfinding requires connectivity. A streetmap is a real-life example.A streetmap is a real-life example. Given this connectivity graph, paths can Given this connectivity graph, paths can

be found using well known algorithms be found using well known algorithms such as A*.such as A*.

How do we get this connectivity How do we get this connectivity data?data?

Page 4: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Connectivity SolutionsConnectivity Solutions

In grid-based games the grid inherently In grid-based games the grid inherently provided the connectivity data.provided the connectivity data. RTS games.RTS games.

Many 3D games use manual Many 3D games use manual connectivity.connectivity. Manually placed points and connections Manually placed points and connections

between points.between points. Automatic connectivity.Automatic connectivity.

How?How?

Page 5: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Floodfilling to the Floodfilling to the Rescue!Rescue!

We’ll reuse old 2D paint program We’ll reuse old 2D paint program technology – the recursive floodfill.technology – the recursive floodfill.

For our purposes the floodfill is For our purposes the floodfill is really a recursive physics simulation really a recursive physics simulation of an AI moving between points.of an AI moving between points.

The goal: given a seed point, detect The goal: given a seed point, detect all traversable locations in a level.all traversable locations in a level.

Page 6: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

The Floodfill AlgorithmThe Floodfill Algorithm

Simulate the AI moving in each of Simulate the AI moving in each of the 4 cardinal directions.the 4 cardinal directions.

Add each successful “position” to a Add each successful “position” to a list.list. Mark this “position” as traversable.Mark this “position” as traversable. Store the connection between positions.Store the connection between positions.

Pop the head of the list and recurse Pop the head of the list and recurse into it.into it.

Page 7: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Movement SimulationMovement Simulation

The character is represented by an The character is represented by an axis aligned collision box.axis aligned collision box.

Our collision code uses swept boxes.Our collision code uses swept boxes. The floodfill algorithm performs tens The floodfill algorithm performs tens

of millions of swept box queries so of millions of swept box queries so we need to make them fast.we need to make them fast.

Page 8: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Colliding with the WorldColliding with the World

We use a hierarchical bounding volume We use a hierarchical bounding volume tree to quickly determine what meshes tree to quickly determine what meshes in the world need to be checked for in the world need to be checked for collision.collision.

Each mesh contains an internal Each mesh contains an internal bounding volume tree to quickly bounding volume tree to quickly determine which of its triangles need to determine which of its triangles need to be checked for collision.be checked for collision.

For speed and space, we use axis aligned For speed and space, we use axis aligned bounding boxes.bounding boxes.

Page 9: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Swept Box CollisionSwept Box Collision

Separating axis theoremSeparating axis theorem Given two convex polyhedra, if they are not Given two convex polyhedra, if they are not

intersecting at least one separating plane will intersecting at least one separating plane will exist.exist.

The plane normal will be defined by either:The plane normal will be defined by either: One of the faces of either objectOne of the faces of either object The cross product of two edges, one from each objectThe cross product of two edges, one from each object

Early rejection.Early rejection. Once you find a separating plane, you can reject the Once you find a separating plane, you can reject the

triangle.triangle. This algorithm can be extended to support “swept” This algorithm can be extended to support “swept”

convex primitives, providing “time of collision”.convex primitives, providing “time of collision”.

Page 10: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Making a MoveMaking a Move

During the floodfill, to move one “unit” in During the floodfill, to move one “unit” in any given direction, we must successfully any given direction, we must successfully complete the following steps:complete the following steps: Move up the maximum height the AI can step Move up the maximum height the AI can step

over.over. Sweep the collision box one “unit” in the Sweep the collision box one “unit” in the

movement direction at an angle equal to the movement direction at an angle equal to the steepest slope the AI can climb.steepest slope the AI can climb.

Finally, sweep the collision box back down to Finally, sweep the collision box back down to the ground to see if we have a place to stand.the ground to see if we have a place to stand.

Page 11: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Of Units and PositionsOf Units and Positions

Our pathfinding system will make Our pathfinding system will make good use of the AI’s collision box.good use of the AI’s collision box.

Unit of Distance:Unit of Distance: A unit is ¼ of the AI’s collision box.A unit is ¼ of the AI’s collision box.

Position:Position: A position is the volume defined by A position is the volume defined by

splitting the collision box into four splitting the collision box into four equal pieces.equal pieces.

Page 12: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Visualizing the DataVisualizing the Data

Each “position” is a box.Each “position” is a box. Each unit moves one box length Each unit moves one box length

away.away. This forms a sort of grid.This forms a sort of grid. However, since the floodfill can However, since the floodfill can

travel over and under overpasses travel over and under overpasses there can be more then one “cell” there can be more then one “cell” for every x,y position on the grid.for every x,y position on the grid.

Page 13: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

What the Data Gives UsWhat the Data Gives Us

Each cell “knows” which directions Each cell “knows” which directions it can travel (up, down, left, right).it can travel (up, down, left, right).

This linkage forms a connectivity This linkage forms a connectivity graph of all possible traversable graph of all possible traversable locations in the level.locations in the level.

Given this connectivity graph we can Given this connectivity graph we can now use our favorite shortest path now use our favorite shortest path algorithm to pathfind between any algorithm to pathfind between any two points in the level. two points in the level.

Page 14: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Too Much Data!Too Much Data!

A “typical” level might require in A “typical” level might require in excess of 2 million cells.excess of 2 million cells.

This can require upwards of 128 MB This can require upwards of 128 MB of RAM just to store the graph.of RAM just to store the graph.

This is way too much data for a real This is way too much data for a real time game.time game.

Page 15: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

CompressionCompression

The goal is to combine cells into The goal is to combine cells into largest possible rectangular regions.largest possible rectangular regions.

Page 16: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

SectorsSectors

Compressed “cells” become sectors.Compressed “cells” become sectors. Sectors are 3D axis-aligned boxes Sectors are 3D axis-aligned boxes

that the pathfind system can use to that the pathfind system can use to determine where an AI is in the determine where an AI is in the connectivity graph.connectivity graph.

Sectors need connection data to Sectors need connection data to other sectors.other sectors.

Page 17: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

PortalsPortals

Portals are connections between sectors.Portals are connections between sectors. Portals can be one-way or two-way.Portals can be one-way or two-way. Portals have a physical location in the Portals have a physical location in the

world.world. Because of this, an AI simple needs to “walk” to Because of this, an AI simple needs to “walk” to

the portal, at which point they are at the the portal, at which point they are at the destination sector.destination sector.

This allows us to easily integrate “teleporters” This allows us to easily integrate “teleporters” such as doors, ladders, elevators, or even star-such as doors, ladders, elevators, or even star-trek like teleporters.trek like teleporters.

How do we generate these portals?How do we generate these portals?

Page 18: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Portal GenerationPortal Generation

During the compression stage, we During the compression stage, we store a list of edge cells with each store a list of edge cells with each sector.sector.

Each edge cell also stores which Each edge cell also stores which sector it belongs to.sector it belongs to.

Page 19: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Portal GenerationPortal Generation

Once all sectors have been Once all sectors have been generated, the edge cells can then generated, the edge cells can then be converted into portals.be converted into portals. These portals know what sector they These portals know what sector they

are coming from and which sector they are coming from and which sector they are going to.are going to.

Page 20: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Data SummaryData Summary

Floodfill the world by simulating the Floodfill the world by simulating the AI walking in a recursive pattern.AI walking in a recursive pattern.

Compress the millions of floodfill Compress the millions of floodfill cells into sectors.cells into sectors.

Use the edge cells of a sector to Use the edge cells of a sector to generate portals between sectors. generate portals between sectors.

Page 21: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Floodfill DemoFloodfill Demo

Page 22: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Extending the PathsolveExtending the Pathsolve

Lets consider a few pieces of Lets consider a few pieces of information we can “bake” into our information we can “bake” into our pathfind data that will allow us to pathfind data that will allow us to easily path solve across “teleporters” easily path solve across “teleporters” such as doors, elevators, and ladders.such as doors, elevators, and ladders.

A teleporter is a “feature” of the level A teleporter is a “feature” of the level that, when activated, will transport a that, when activated, will transport a game object from one part of the game object from one part of the world to the other.world to the other.

Page 23: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Floodfilling across Floodfilling across TeleportersTeleporters

Consider a building with roof access Consider a building with roof access via elevator only.via elevator only. Currently, the pathsolve will never Currently, the pathsolve will never

reach the roof.reach the roof. To solve this:To solve this:

During floodfill, check each cell to see if its During floodfill, check each cell to see if its inside an “entrance zone”.inside an “entrance zone”.

Create a cell inside the “exit zone” for the Create a cell inside the “exit zone” for the elevator and continue floodfilling from this elevator and continue floodfilling from this cell. cell.

Page 24: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Pathsolving Across Pathsolving Across TeleportersTeleporters

Incorporate teleporters post floodfill. Incorporate teleporters post floodfill. Each teleporter has an entrance and exit “zone”. Each teleporter has an entrance and exit “zone”. For each teleporter in the level, check to see if For each teleporter in the level, check to see if

both the entrance and exit zones intersect a both the entrance and exit zones intersect a pathfind sector.pathfind sector.

Create a “teleporter” portal and add it to the Create a “teleporter” portal and add it to the portal list for the entrance sector.portal list for the entrance sector.

Create a portal and add it to the portal list for Create a portal and add it to the portal list for the exit sector.the exit sector.

Link the entrance portal to the exit portal as a Link the entrance portal to the exit portal as a one-way transition.one-way transition.

Page 25: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Teleport Portal DataTeleport Portal Data

Embed as much information about Embed as much information about the teleporter as necessary into the the teleporter as necessary into the entrance portal.entrance portal. Flag specifying teleporter type.Flag specifying teleporter type.

Door, elevator, ladder, etc.Door, elevator, ladder, etc. Teleporter mechanism ID.Teleporter mechanism ID. Keys needed to operate mechanism.Keys needed to operate mechanism.

Page 26: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Solving the PathSolving the Path

Given our connectivity graph, solving Given our connectivity graph, solving the path is now straightforward.the path is now straightforward. Given an AI’s current position and a Given an AI’s current position and a

destination position we can lookup the destination position we can lookup the pathfind sectors that contain these points. pathfind sectors that contain these points.

Path is unsolvable if either sector cannot be Path is unsolvable if either sector cannot be found.found.

We now have a start position and end We now have a start position and end position within our connectivity graph.position within our connectivity graph.

Page 27: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

The Pathsolve AlgorithmThe Pathsolve Algorithm

Most traditional shortest path Most traditional shortest path algorithms can be used.algorithms can be used.

A modified A* worked pretty good for A modified A* worked pretty good for Renegade.Renegade. First, loop over all the portals for the First, loop over all the portals for the

starting sector.starting sector. Each portal has a destination sector.Each portal has a destination sector. Each of these destination sectors has a list Each of these destination sectors has a list

of portals.of portals. Continue traversing sectors until you’ve Continue traversing sectors until you’ve

reached the destination sector.reached the destination sector.

Page 28: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Path DemoPath Demo

Page 29: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Time to SolveTime to Solve

Short paths can solve quickly.Short paths can solve quickly. Long paths take a bit longer.Long paths take a bit longer. 20 AI’s solving long paths at the 20 AI’s solving long paths at the

same time can tax even the most same time can tax even the most efficient pathsolver.efficient pathsolver.

Page 30: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Distributing the SolveDistributing the Solve

If an AI takes 15 frames to solve a If an AI takes 15 frames to solve a path in a 30 FPS game, they will path in a 30 FPS game, they will only pause for ½ a second.only pause for ½ a second.

In most cases, this short pause is not In most cases, this short pause is not noticeable.noticeable.

This means we can devote a set This means we can devote a set amount of time each frame to amount of time each frame to pathfinding and simply solve as pathfinding and simply solve as much of each path as possible.much of each path as possible.

Page 31: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

The Distributed The Distributed AlgorithmAlgorithm

The pseudo-algorithm:The pseudo-algorithm:

while (Time_Left () && PathSolver != NULL) {

if (PathSolver->Process (Time_Left_This_Frame)) {

RELEASE (PathSolver);

PathSolver = Get_Next_Path_Solver (); }

}

Page 32: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

The Distributed The Distributed AlgorithmAlgorithm

The pseudo-algorithm:The pseudo-algorithm:

while (Time_Has_Not_Elapsed) {

CPathfindSector * sector = Get_Least_Cost_Sector (); 

if (sector == NULL) {

Handle_No_Path ();

} else if (sector == DestinationSector) {

Hande_Path_Found ();

} else {

CPathfindPortal *portal = NULL;

while (portal = sector->Get_Next_Portal (portal)) {

Process_Portal (portal);

}

}

}

Page 33: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Robotic PathsRobotic Paths

The results of this path solve will The results of this path solve will often look robotic.often look robotic. Straight lines connecting points in the Straight lines connecting points in the

portals along the path.portals along the path. This path can be made more organic This path can be made more organic

by creating a spline which goes by creating a spline which goes through its points.through its points.

Page 34: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Smoothing the PathSmoothing the Path

We chose to use a natural spline whose We chose to use a natural spline whose control points are points along the path. control points are points along the path.

Unfortunately this can cause the path to stray Unfortunately this can cause the path to stray outside of valid pathfind sectors; causing outside of valid pathfind sectors; causing characters to get stuck against walls for characters to get stuck against walls for example.example.

To solve this problem, we convert the spline To solve this problem, we convert the spline into a series of Bezier curves and constrain into a series of Bezier curves and constrain the control points to our pathfind sectors.the control points to our pathfind sectors. A Bezier curve is guaranteed to be contained by A Bezier curve is guaranteed to be contained by

the convex shape defined by its control points.the convex shape defined by its control points.

Page 35: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Visualizing the SplineVisualizing the Spline

Page 36: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Innate WaypathsInnate Waypaths

Waypaths are hand-placed paths Waypaths are hand-placed paths consisting of a series of points.consisting of a series of points. Waypaths can be linear or splined, one-Waypaths can be linear or splined, one-

way, two-way, and looping.way, two-way, and looping. Each point on the waypath can encode Each point on the waypath can encode

specific information such as speed up, specific information such as speed up, slow down, jump, crouch, slide, crawl, slow down, jump, crouch, slide, crawl, etc.etc.

The path solver can bias towards these The path solver can bias towards these waypaths to achieve complex results.waypaths to achieve complex results.

Page 37: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Using Innate WaypathsUsing Innate Waypaths Create a pathfind sector without position or size.Create a pathfind sector without position or size. Intersect each point on the waypath with sectors Intersect each point on the waypath with sectors

that already exist in the world.that already exist in the world. Create portals at each intersection point that exit Create portals at each intersection point that exit

from the real-world sectors onto the “imaginary” from the real-world sectors onto the “imaginary” innate waypath sector.innate waypath sector.

Intersect each segment of the waypath with Intersect each segment of the waypath with sector boundaries that already exist in the sector boundaries that already exist in the world.world. Create portals at these intersections as well.Create portals at these intersections as well.

Flag these portals so the shortest path heuristic Flag these portals so the shortest path heuristic can make them “cheaper” to follow.can make them “cheaper” to follow.

Page 38: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Waypath DemoWaypath Demo

Page 39: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Learning From the Learning From the PlayerPlayer

Players can conceive of more Players can conceive of more complicated actions than AI.complicated actions than AI.

By allowing the AI to “copy” some of By allowing the AI to “copy” some of the player’s moves, they appear the player’s moves, they appear more intelligent.more intelligent.

Page 40: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Implementing LearningImplementing Learning

Everytime the player jumps and lands:Everytime the player jumps and lands: Lookup the pathfind sector the player Lookup the pathfind sector the player

jumped from and landed in.jumped from and landed in. Record the player’s orientation and Record the player’s orientation and

velocity at jump time.velocity at jump time. Add a temporary “jump” portal from the Add a temporary “jump” portal from the

start sector to the land sector.start sector to the land sector. The AI will now seamlessly incorporate The AI will now seamlessly incorporate

this move into its pathsolve.this move into its pathsolve.

Page 41: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Learning DemoLearning Demo

Page 42: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Vehicle PathfindingVehicle Pathfinding

Vehicles are intrinsically more Vehicles are intrinsically more difficult.difficult. Vehicles are bigger than characters.Vehicles are bigger than characters. Vehicles have turn radius.Vehicles have turn radius. Vehicles do not stop on a dime.Vehicles do not stop on a dime. Vehicles can roll over.Vehicles can roll over. Vehicles behave differently in forwards Vehicles behave differently in forwards

and reverse.and reverse.

Page 43: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Re-using DataRe-using Data

Vehicles can reuse bipedal data.Vehicles can reuse bipedal data. Take into consideration the vehicle’s Take into consideration the vehicle’s

turn radius when evaluating portals.turn radius when evaluating portals. If a vehicle cannot make a turn, coming If a vehicle cannot make a turn, coming

from its current portal to the from its current portal to the destination portal, then skip the destination portal, then skip the destination portal. destination portal.

Page 44: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Vehicle CurvesVehicle Curves

Vehicles need to “turn out” to make sharp Vehicles need to “turn out” to make sharp corners.corners.

By creating a vehicle curve that is based By creating a vehicle curve that is based on the turn radius of the vehicle, the on the turn radius of the vehicle, the vehicle will seamlessly follow its path.vehicle will seamlessly follow its path.

Vehicle curve is composed of three parts:Vehicle curve is composed of three parts: The exit curve from the previous point.The exit curve from the previous point. A straight line from the exit curve to the A straight line from the exit curve to the

entrance curve of the next point.entrance curve of the next point. The entrance curve to the next point.The entrance curve to the next point.

Page 45: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Vehicle Curve AnatomyVehicle Curve Anatomy

Here you can see the 3 distinct parts Here you can see the 3 distinct parts of the vehicle curve.of the vehicle curve.

Page 46: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Vehicle Curve ResultsVehicle Curve Results

Here is a comparison of a linear Here is a comparison of a linear (unsplined) vehicle path and the (unsplined) vehicle path and the post-processed vehicle curve.post-processed vehicle curve.

Page 47: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Vehicle DemoVehicle Demo

Page 48: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

ConclusionConclusion Floodfill solves “static” pathfinding.Floodfill solves “static” pathfinding.

““Kinks” in the path arise due to the non-Kinks” in the path arise due to the non-uniform nature of the sectors.uniform nature of the sectors.

Does not address dynamic objects.Does not address dynamic objects. Innate waypaths and jump portals Innate waypaths and jump portals

increase intelligence.increase intelligence. Arbitrary vehicle pathfinding is difficult.Arbitrary vehicle pathfinding is difficult.

Reusing data is possible, but not optimal.Reusing data is possible, but not optimal. Vehicle curves simplify the path following Vehicle curves simplify the path following

logic.logic.

Page 49: Polygon Soup for the Programmer’s Soul: 3D Pathfinding Patrick Smith (psmith@westwood.com) Greg Hjelstrom (greg@westwood.com)

Q & AQ & A


Related Documents