Platform Pathfinding AI

Get help using Construct 2

Post » Wed Jan 28, 2015 11:30 pm

Something I have been searching the entire internet is how to efficiently do platform path-finding AI.

I have coded some very messy code comparing the x and y positions of the enemy and the player to find the player using those conditions bundled with the platform behavior, but it just seems very buggy and inefficient, is there possibly a solution to this issue?

When just doing horizontal pathfinding, that is fine, but when you start adding the y-axis in the mix as well as obstacles and walls things get very complex quickly.

I am just stumped :(

Thank you!
B
18
S
6
Posts: 348
Reputation: 2,633

Post » Thu Jan 29, 2015 12:20 pm

could do it like this
You do not have the required permissions to view the files attached to this post.
B
251
S
39
G
15
Posts: 1,964
Reputation: 40,721

Post » Thu Jan 29, 2015 6:52 pm

@Lordshiva1948

Thank you for your input, but I think you miss interpreted what I tried to say, a platformer style game not top down. Here is an illustration of the type of pathfinding I am trying to achieve

Where the red is the enemy, and green is the player.

Sure, I could hard code the AI for this specific scenario, but it wont be. As the player can make up the platforms obstacles, walls etc. It is dynamic, not a static level.
You do not have the required permissions to view the files attached to this post.
B
18
S
6
Posts: 348
Reputation: 2,633

Post » Thu Jan 29, 2015 8:05 pm

I think that could be done with just events, without need of the pathfinding behavior.

The enemy needs to check where the players is, higher or lower, left or right. And then evaluate if there is an obstacle in that direction relative to where it is currently standing on. And then make it choose the path that is unobstructed.
The enemy should consider if the obstacle can be jumped, and if the player is higher than him whether or not it can be reached.
B
43
S
12
G
6
Posts: 446
Reputation: 6,802

Post » Thu Jan 29, 2015 10:08 pm

@Sargas

I used the platform behavior to move the enemy around already. Like I have tried to explain above. It worked to an extent, but it is very buggy.

I had it evaluate if the player is above or below with comparison, and if it was left or right, using comparisons with x and y values.

What you have, I know what direction to take, but it just doesn't seem the right way to go about it. I have looked all over these forums and there is no sort of platformer based pathfinding.
B
18
S
6
Posts: 348
Reputation: 2,633

Post » Fri Jan 30, 2015 1:39 am

im trialing a dungeon keeper game. AI for imps (dwarfs in my case) has given me the same problem.

I set a view sprite in front to check collisions, left and right view sprites to check gap openings. (its not a platformer) he might walk a few circles but he'll get there...sigh, im trialing "angled" view spites atm so it wont hit collision until after passing a wall. (turns too quick and doesnt get a straight angle atm)

if i set a destination for AI via a click he just plows into a wall. sigh, whats the point of a path finder if it sux.

I trialed waypoints on claimed land, to no avail... seems to cut off and restart..

Sargas has fine logic, but no programming explanations. might as well have a flow chart saying (decide if want to go to shops) (if yes) (go to shops)...

my planning is not with jumping however. surely, if all you need is for that sprite to reach its destination, bullet movement to the left, with a everytick position to pin a view sprite. on collision (view sprite, overlap was better) with wall change angle 180' if view sprite overlaps wall(solid) jump (or on "platform jump"ect) . finaly. on destination set bullet speed to zero. or set bullet angle 180' and add the bounce off affect to the bullet, so on returning and jumping against left wall the bullet automatically changes direction during jump.

note! view sprites must be set to angle themselves based on player direction (or just apply the same ' the AI sprite takes everytick

i have questions, but i keep getting new problem solving ideas... sigh.. it usually ends up in a messy layout. when i can post things I will show an example... just don't want people stealing it lol.


ps: i can understand me, if you cant, i can re fraze it and add a screenshot of my example
B
9
S
3
Posts: 102
Reputation: 987

Post » Sun Mar 01, 2015 8:48 pm

I am having this exact same problem with my own project! I was saddened to find that the pathfinding behavior seems to be meant for overhead view games rather than platforming. I can only hope that in a later release pathfinding will be extended to platform games as well.
B
7
Posts: 11
Reputation: 299

Post » Sun Mar 01, 2015 8:54 pm

you mean like so
You do not have the required permissions to view the files attached to this post.
B
251
S
39
G
15
Posts: 1,964
Reputation: 40,721

Post » Sun Mar 01, 2015 11:20 pm

Just a quick note for anyone trying to run this demo using the r195 version of Construct 2 available on the front page. It seems that you need to use the r198 version to run it. I'd post the link to it but I'm not allowed to use URLs in posts yet :oops:
B
7
Posts: 11
Reputation: 299

Post » Mon Mar 02, 2015 12:33 am

I know, you can put up the link just don't use the header
B
7
S
1
Posts: 53
Reputation: 535

Next

Return to How do I....?

Who is online

Users browsing this forum: Artcadev, Uk4dee and 29 guests