How do I add pathfinding collision with clones of an object?

Get help using Construct 2

Post » Sun May 29, 2016 4:42 pm

I am having a problem while trying to spawn new objects which have pathfinding and solid behavior.
They seem to not recognize one another as obstacles.
Can someone help me out?

Here is what happens, the objects overlap one another.
Image
B
24
S
7
G
1
Posts: 200
Reputation: 2,495

Post » Sun May 29, 2016 4:50 pm

1 solution is to give them physics, it just makes them bounce off one another, then continue on their path (lol, game can become like a sonic game where they bounce out of bounds)

the 2nd option, is look at the sample games in your construct 2 (when loading a new project, scroll down) there is a tank family behaviour example.
it has some code for slowing down the sprite as it gets close to another path seeking object
B
9
S
3
Posts: 102
Reputation: 987

Post » Sun May 29, 2016 6:08 pm

99Instances2Go wrote:@xx Is this the logic that you was looking for ?

https://drive.google.com/open?id=0B1SSu ... DQ3MXNMUFE

There are 3 major things you have to deal with.
1/ there is only one obstaclemap for all
2/ find a path & calculate obstacle maps take time
3/ the calculated obstacle map is available in the NEX tick
B
33
S
18
G
28
Posts: 2,464
Reputation: 20,892

Post » Sun May 29, 2016 9:37 pm

I saw your capx and some of the players still overlap one another.
I also saw the events and am really surprised why this simple functionality should be this complicated.
Didn't the Scirra team add it for the sake of making it all better?
Forcing the object itself not to overlap with other spawned objects and all of them should not overlap solids.
B
24
S
7
G
1
Posts: 200
Reputation: 2,495

Post » Sun May 29, 2016 10:26 pm

First of all we talk about html5. En that is still not the most performant and brilliant engine on the world. But, it works in all browsers. If you choose for Construct you choose for html5. I suppose that did not yet dawn to you.

Constuct is no more then a UI to write html5 code. Scirra did not make html5. But they do their best to adress all the inperfections of html5. One of those is performance. This is why you find choices all over Construct. A choice to do it 'that way' to keep it performant.

Only one obstacle map is one of those choices. So if you have 100 solids (if you choose for solids) running arround, rebuilding the obstacle map for one rebuilds the obstacle map for all. Hence, if the one thats supposed to find a path is an obstacle too, it will not find a path. If you had read the manual, you would have known this.

Next. The pathfinding behavior finds paths. Thats all. It avoids obstacles based on the gridsize and the cellsize you gave it. It does not know how big your sprite is. It is just what it is meant to be, an easy help for finding paths.

Not happy with it? No problem. Build your own pathfinding. You can find exellent examples on this forum. Yet none of them will account for the size of the pathfinding sprites.

If you think that pathfinding combined with physcis and ray tracing should be a basic option in a html5 engine, then let me ask you: why is that plugin not made yet ? There are plugins for almost everything.

I gave 1 example. And it is a complete AI. The logic that answers your question is in there in 1 event. I cant show the funtion of a steer when i cant build wheels under it.

I am sorry it did not meet your lazy expectation.
But i did not earn that sneer. No one did.
B
33
S
18
G
28
Posts: 2,464
Reputation: 20,892

Post » Mon Jun 20, 2016 11:33 am

Never mind I found a fix for this and was really easy, it is already implemented into construct 2 but it is more of a trick.
B
24
S
7
G
1
Posts: 200
Reputation: 2,495

Post » Mon Jul 25, 2016 3:31 pm

Hi,

Can you post your easy fix, I have been trying to figure this one out for weeks now without any success.

Thanks.
B
8
S
3
Posts: 16
Reputation: 848

Post » Mon Jul 25, 2016 8:40 pm

Make the objects as platformers and set all values to zero.
Then make them bullets also.
Add pathfinding and it is done.
Platformers will not allow them to intersect.
There are other issues with this method though, for example when player is overlapped, it teleports him.
B
24
S
7
G
1
Posts: 200
Reputation: 2,495

Post » Mon Jul 25, 2016 10:06 pm

Thank you very much I will try this out! Really appreciated!
B
8
S
3
Posts: 16
Reputation: 848

Post » Mon Sep 19, 2016 8:43 pm

hi
i try for it, but objects overlapping !
can you share capx?
B
10
S
3
Posts: 180
Reputation: 1,212

Next

Return to How do I....?

Who is online

Users browsing this forum: ezgaming420, marcinkowski and 4 guests