-
Notifications
You must be signed in to change notification settings - Fork 7
NodeGraph
Nak edited this page May 13, 2022
·
5 revisions
Note: Mimics Sources NodeGraph system and load .ain files. Any changes to the NodeGraph won't carry on to the C++ based one. Unless you replace the .ain file.
Functions | Returns | Description |
---|---|---|
NodeGraph, [AIN_ERROR_*] | Returns the nodegraph for the current map and caches it | |
NodeGraph, [AIN_ERROR_*] | Loads the file and returns a nodegraph object. If no files given it will return the current map's nodegraph. |
- AIN_ERROR_VERSIONNUM
- AIN_ERROR_ZONEPATCH ( This just indecates there was zone-errors in the AIN file, and they got patched )
There are 3 valid node types:
* NODE_TYPE_GROUND
* NODE_TYPE_AIR
* NODE_TYPE_CLIMB
Hull and CAP / Move Enums
Hull Enums: ( NN recreates these on the client )
* HULL_HUMAN = 0 -- 30w, 73t // Combine, Stalker, Zombie...
* HULL_SMALL_CENTERED = 1 -- 40w, 40t // Scanner
* HULL_WIDE_HUMAN = 2 -- ? // Vortigaunt
* HULL_TINY = 3 -- 24w, 24t // Headcrab
* HULL_WIDE_SHORT = 4 -- ? // Bullsquid
* HULL_MEDIUM = 5 -- 36w, 65t // Cremator
* HULL_TINY_CENTERED = 6 -- 16w, 8t // Manhack
* HULL_LARGE = 7 -- 80w, 100t // Antlion Guard
* HULL_LARGE_CENTERED = 8 -- ? // Mortar Synth / Strider
* HULL_MEDIUM_TALL = 9 -- 36w, 100t // Hunte
Move Enums ( NN recreates these 4 on the client )
CAP_MOVE_GROUND = 0x01 -- walk/run
CAP_MOVE_JUMP = 0x02 -- jump/leap
CAP_MOVE_FLY = 0x04 -- can fly, move all around
CAP_MOVE_CLIMB = 0x08 -- climb ladders
Note: You can combine these with
bit.bor( CAP_MOVE_GROUND, CAP_MOVEJUMP, CAP_MOVE_CLIMB )
PathFind Functions
PathFinding accepts a table of options on how the path should be gennerated.
options.MaxDistance = 100000
options.BitCapability = CAP_MOVE_GROUND or CAP_MOVE_FLY, depending on NODE_TYPE
options.JumpMultiplier = 1.4
options.ClimbMultiplier = 1.2
You can make your own generator to tell how the pathfind should be made:
generator( ain_node current, ain_node neighbor, CAP_MOVE, BitCapability, Number NormalCost )
PathFind Functions | Returns | Description |
---|---|---|
Boolean | A cheap lookup function. Checks to see if we can reach the position using nearby nodes. | |
LPathFollower or boolean | A* pathfinding using the NodeGraph. Will return false if unable to create a path. | |
A* pathfinding using the NodeGraph. Returns the result in the callback. Calculates 20 paths pr tick. |
NodeGraph Functions
NodeGraph Functions | Returns | Description |
---|---|---|
Number | Returns the AIN version. Should be 37. | |
Number | Returns the AIN map-version. | |
ain_node | Returns the given ain_node at said ID. | |
Table | Returns all nodes on the NodeGraph with the ID as keys. | |
ain_node | Returns the nearestnode with the given parameters. | |
Returns the nearest node with said HintType and parameters. | ||
ain_node | Returns thenearest node with a connection matching the hull. | |
Overrides and generates all the zones in the nodegraph. This can fix zone-errors. | ||
Saves the nodegraph to a file. | ||
ByteBuffer | Returns the nodegraph as a bytebuffer. |
Notes are points placed on the NodeGraph that NPC's can pathfind to.
Node Functions
Note: HintData are stored as a table on the node with the key "hint": ain_node.hint
Node Functions | Returns | Description |
---|---|---|
Boolean | Returns true if the node_type match. | |
Table | A function returning all nodes connected to this one. A bit costly. | |
Table | Returns all the connections from this node. | |
Table | Returns all the connections from this node, with said hull that aren't invalid. | |
Number | Returns the node ID | |
Number | Returns the node info. | |
Number | Returns the move-type to this node. | |
Vector | Returns the node position | |
NODE_TYPE | Returns the node type | |
Number | Returns the node YAW | |
Number | Returns the node zone. It should match any notes connected to this one. | |
Boolean | Returns true if the node is valid. | |
Removes the node from the closed list. |
Link Functions ( Not implimented functions yet. They're stored on `NodeGraph._links` )
Links | Returns | Description |
---|---|---|
[Nuber] | Returns the node IF of the distination node. | |
Number | Returns the link ID | |
Number | Returns the move bitflags | |
Number | Returns the node ID of the source node. | |
Boolean | Checks to see if it has any of said move flag |
A* Functions
A* Node Functions | Returns | Description |
---|---|---|
Boolean | Returns true if the node is within the closed list. | |
Boolean | Returns true if the node is on the open list | |
Boolean | Retursn true if the open list is empty | |
Sets the move-type to this node. | ||
Sets the total cost | ||
Updates the open list | ||
Adds the node to the closed list. | ||
Adds the node to the open list | ||
Number | Returns the cost so far | |
Number | Returns the total cost | |
Sets the cost for pathfinding. | ||
Pops the open list and returns the kiwest total cost node. |
- BitBuffer
- BSP Parser
- DateTime and Date-Functions
- TimeDelta
-
PathFinding (Coming soon)
- LPathFollower (Coming soon)
- NodeGraph (Coming soon)
- NikNav ( NikNaks Navigation ) on ToDo
- Extended functions (Coming soon)