[Include] Dijkstra.inc - Dijkstra pathfinding algorithm
#1

Introduction

This is a basic implementation of the dijkstra algorithm, including a basic example of a GPS system working on nodes, using this include.

Function(s)

We have only one basic function:
pawn Код:
stock Dijkstra(const aeNodes[][], iStart, iEnd, aiPath[], const iSize = sizeof(aeNodes))
Here's how the node array should look like:
pawn Код:
enum e_Nodes {
    Float: e_fNX,
    Float: e_fNY,
    Float: e_fNZ,
    e_iLink1,
    e_iLink2,
    e_iLink3,
    e_iLink4
};
If the link is invalid you have to use -1. See usage in the example filterscript.

Example

In the link below, there's a basic GPS system using this pathfinding include. The nodes included are complete LV nodes and were made by me a while ago. I will do the whole San Andreas world once I have some free time and when I feel like it. I don't recommend using the default San Andreas nodes from NODESX.DAT with this include as there are too much to calculate in a reasonable time.

[ame]http://www.youtube.com/watch?v=rENx33otwE4[/ame]

GPS.pwn

Download

Dijkstra.inc
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)