QuakeServer.Extensions.Routes (quake_server v0.1.0)

Copy Markdown View Source

FTE's route_calculate (sv_move.c): a path over the level's waypoints from where an entity stands to a destination, handed to the program's callback at the start of the next frame (run/1) as a list of nodes in allocated memory.

The waypoints are read once a level, the first time a route is asked for, from the first of data/<map>.way, bots/navigation/<map>.nav and maps/<map>.bsp.way that exists, in FTE's text form: a count, then for each waypoint x y z radius links followed by links lines of target cost flags. With none, the level has no waypoints.

The start and end waypoints are those nearest the entity and the destination, a waypoint whose radius holds the point first, and otherwise only one the point can see through the world model. The path is FTE's A* search over the links, leaving out links with any of the deny flags.

The callback is callback(entity, destination, count, nodes), count an integer; nodes points at count records of five words: the place x y z, the flags of the link that reaches it (an integer) and its radius. Record 0 is the destination (flags LF_DESTINATION, radius 32), then the waypoints from the end back to the start, then the entity's place (flags 0, radius 32): the last record is the first place to go. Without a path the records are the destination and the entity's place, radius 0.

Summary

Functions

Run route_calculate.

Hand every route asked for since the last call to its callback, oldest first.

Functions

call(s, binary, argc)

@spec call(map(), String.t(), non_neg_integer()) :: map()

Run route_calculate.

run(server)

Hand every route asked for since the last call to its callback, oldest first.