Grid based path finding

Discussion and feedback on Construct 2

Post » Fri Feb 03, 2017 10:00 pm

Hey there, I am having trouble coming up with a grid-based pathfinding system.

The game would be seen from top-down and the AI couldn't go in "straight" diagonals (say if they wanted to go up & right they would have to first go up and then right).

I first tried like this: If the ai position is 0, 0 and the destination is 3, 3 , the ai would go 3 squares down and then 3 to the right. But then they would bump into obstacles (that are user-placed) and they would get stuck. I could then say: is obstacle up, go right and so on, but then they would feel less like real people and more like roomba's...

Do you have any ideas on how to do this more realistically or if there are any pluggins for this?
Thanks!
ImageImageImageImage
B
30
S
9
G
7
Posts: 245
Reputation: 5,602

Post » Sun Feb 05, 2017 8:06 pm

search for Dijkstra, A* or easystar in plugin section, there are plenty of plugins for it ;)
B
38
S
11
G
5
Posts: 485
Reputation: 5,340

Post » Mon Feb 06, 2017 12:15 am

B
99
S
35
G
29
Posts: 3,139
Reputation: 28,421

Post » Mon Feb 06, 2017 8:35 am

What is the difference between easystar and astar? The built in pathfinding plugin already uses a* right?
Mistakes were made.
B
52
S
26
G
109
Posts: 1,615
Reputation: 61,651

Post » Mon Feb 06, 2017 2:32 pm

the easystar is also an A* algorithm but it is far better implemented then the built in behaviour, you can implement algorithms naivly or in some clever way, the scirra one is a naively implemented one, you can see by the resources (CPU time) it eats. The easystar plugin uses a fraction of that resources.
B
38
S
11
G
5
Posts: 485
Reputation: 5,340

Post » Thu Feb 09, 2017 12:48 pm

Joannesalfa wrote:https://www.scirra.com/forum/behavior-easystar-js-pathfinding-for-tilemap_t129056

I tried to install the plugin, but C2 doesn't recognize it...
Image
Image

Also, sorry for the late reply =D
ImageImageImageImage
B
30
S
9
G
7
Posts: 245
Reputation: 5,602

Post » Thu Feb 09, 2017 3:34 pm

Make sure it's in the right folder, it's a behaviour not a plugin.
B
43
S
23
G
20
Posts: 735
Reputation: 12,027

Post » Sat Feb 11, 2017 12:52 am

Ethan wrote:Make sure it's in the right folder, it's a behaviour not a plugin.

Oh, thanks =D
ImageImageImageImage
B
30
S
9
G
7
Posts: 245
Reputation: 5,602

Post » Sun Mar 26, 2017 3:25 pm

fldr wrote:the easystar is also an A* algorithm but it is far better implemented then the built in behaviour, you can implement algorithms naivly or in some clever way, the scirra one is a naively implemented one, you can see by the resources (CPU time) it eats. The easystar plugin uses a fraction of that resources.

Is there any particular reason why the built-in algo is worse than easystar?
B
41
S
12
G
14
Posts: 1,120
Reputation: 11,259

Post » Sun Mar 26, 2017 7:59 pm

pretty sure the algorithm is the same (A*), the implementation of it is what is different. Read the wikipedia article about A* and then think about how to implement it, im sure you will come up with more then one way, but not every way thats possible is effective. Btw the two behaviours are too completely different, while the built in behaviour also moves the objects the easystar will only calculate the path. You should try both, far better then me explaining the difference.
B
38
S
11
G
5
Posts: 485
Reputation: 5,340

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 21 guests