#point and bridge like movement system

22 messages · Page 1 of 1 (latest)

raven ridge
#

In my game, i want my enemies to have a very specific movement
i want them to have a collection of points that they can move around. and i want these points to work like a mesh, as in they have points but also lines that connect them; IE; you can only go to a point that has a line connecting to you

ive tried normal nav and curve stuff but with that you cant really have any branching or cyclical paths

The end goal is bassically that my enemies can either wander across these points and bridges, or move across them, trying to get to a specific point (most likely either their resting point or the player)

any pointers or explanations are apreciated

mellow ibex
#

Have you looked into Astar / A*?

raven ridge
mellow ibex
#

It's the most common path finding algorithm. You find a lot of information on it online either in general or specifically for godot

#

Godot even has an implementation afaik

raven ridge
#

ill look into it

#

is A* only for grid based movement?

mellow ibex
#

Doesnt need to be grid. See answer below. but you were talking about bridges and branches which reminded me of A*
Maybe you can use parts of A* and combine with navmesh?

rotund burrow
#

Godot's A* is fairly solid, and you can place points anywhere you want and connect them.

#

You don't have to make it a grid.

#

A* is almost always demonstrated in terms of grids, but the algorithm is not inherently grid based.

#

@mellow ibex sry, didn't mean to "well AKSHULLY" you, Ive just used it a fair amount.

#

Godot 4 actually even has a specific simplified AStarGrid2D now, though I found it way too restrictive and never used it.

raven ridge
rotund burrow
#

add_point to place a node with an id at a specified location, then call connect_points on two ids to connect them, either bidrectional or one-way only.

#

It's basically just traversing a graph, so you can make it any shape you want.

#

Then there are two different get_path methods to calculate the shortest path along the graph between two ids you provide (assuming you connected the points such that a path exists).

mellow ibex