How can I improve enemy pathfinding ai without waypoints?

The Ghostly Labyrinthian I am having problems with the target moving and running into a wall how could I make it so it seeks the player.

1 Like

Scroll down, there is any-angle pathfinding without waypoints made by @thebrickccentric

4 Likes

I have been using this site to make it, Pathfinding (No Waypoints!) I copied the code but, still won’t work.

Then ask for help from @thebrickccentric, they’re the one that made the system.

1 Like

Hey ThirdEyeBlind, just glancing over my code you copied, it looks like you have an extra “Follower Target” bundle in your Player object (You already put a Follower Target bundle in your player’s Movement bundle, so you don’t need another one). Furthermore, you copied the static target version of the bundle; what you really want instead is the Follower Target bundle in my Player object (found in level 2 of my game).
Also, the “Display Spawner” bundle in your Player has a Destroyer block in it, so the Player is destroying itself on the first frame anyway! (You probably should remove the Destroyer block).
Now I don’t see any code inside the Enemy object that would actually display it to the screen, so it’s hard to tell if the pathfinding code is working or not.

1 Like

Sorry, I have not gotten to the part where I finish the enemy display. I just finished the basic sight on it now so you can see the enemy but, he will not move also, the MiniMap in the top corner shows you if he is moving, he is not moving much. I fixed everything you suggested.

1 Like

Cool, ok 2 more things:
You need to parent the 2D walls to the PositionID object (and you don’t need a PositionID object sitting in the level)
After everything you also need to make sure to delete and re-add the Brain (Dojo Master?) object to the level so that it is guaranteed to activate first when the game runs.

The enemy will now move more often but, will sometimes get caught on the walls and will not move, is this how it will just be or, is there a way to fix this?
Drop Box Shown link

1 Like

It turns out that the filter that tells it when to stop If you decrease that to one it will not stop at the wall. Thank you for the advice you both where very helpful, I put you in my credits.

1 Like

Cool. The pathfinding still isn’t working right, though, so I have found 4 more things:
You need to add a Rotation behavior in the 2D Wall object. It seems pointless, but it keeps the walls from collision merging.
Inside the Enemy object, in the AI Follower bundle, and in the Ease Rotate bundle, you can remove one xyID message block (it doesn’t need 2 of the same message)
If you pause the game right at the beginning, it messes up the timers that run the pathfinding, so try to find an alternative to pausing.
The biggest thing though is that you need to add the code from the “Obstacle” object in my game into the 2D Wall object in your game.
I’m sorry there’s so much hassle with this (the game you’re copying happens to be the least-organized of all my pathfinding systems)

just curious, why don’t you want the walls to collision merge?

1 Like

I did the things you said and it still does not work as intended. Is there anything else?

1 Like

Ok I’m on my phone right now, but there is one other thing I can see that may cause issues: the code inside the PositionID object looks like it got mixed up when you pasted it. I would recommend deleting and re-adding that code so that the behaviors are in the right order (behavior position does affect how code activates).
If flowlab is doing the thing where it moves the behaviors after you paste them, try hitting Undo and then Redo, and the behaviors should be pasted into their proper positions. (I also just barely spaced out the behaviors a bit more to make things easier.)
If it still doesn’t work after that, you may have to give me some time to work on this problem separately and find the root cause (and probably improve my game’s code to be more copy-able).

That’s a good question; I guess it’s not strictly necessary in this case, but I think the merging may affect the order in which objects get triggered to run their code during a frame, though I’m not sure on that one yet (so I’m playing it safe still until I find out).

It still is not working. I did what you said.

1 Like

Darn, I guess give me some time and I’ll try and test things out