[Behavior]PathFinder

Post your completed addons to share with the community

Post » Thu Jan 19, 2012 12:00 am

I forgot a @Wronghands ^^ (oops, check the previous page/post)
Also, thinking about it, if you want to know the movement cost in the current setting of the pathfinder, you'd need two checks.
If pathlist length = 2 => movement cost = 1
If pathlist length > 2 => movement cost = pathlist length - 2 (removing the source's cell and counting up to the last cell's index)Kyatric2012-01-19 00:01:10
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Thu Jan 19, 2012 2:23 am

This will be extremely helpful to me. Thanks!
B
7
S
1
G
2
Posts: 4
Reputation: 1,186

Post » Mon Jan 23, 2012 8:00 pm

@Kyatric

Sorry about the delayed response. I must thank you again. :) Your suggestion helped and I now have a simple turn based grid prototype running, can even call it a basic game. Only difference being that I had to subtract 1 from pathlist length instead of 2 when the length is over 2 but it's sorted (unless I discover a horribly glaring flaw far too late :D )
B
47
S
3
G
5
Posts: 56
Reputation: 4,630

Post » Mon Jan 23, 2012 8:07 pm

@Wronghands: glad to hear.
Let me know if you find anything that doesn't work as expected or if you have any question/needs more infos.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Thu Jan 26, 2012 3:14 am

omg !

TL;DR on the Comments so maybe this has been said before..

Heroes of Might and Magic 3 remake?
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Thu Feb 09, 2012 7:20 pm

Hello again @Kyatric
It has been a while and I did progress somehow on my own, thanks to your and @Yann's directions of course. Now I'm trying to spawn preview sprites that indicate all the possible movement locations for the starting sprite, limited by obstacles and range. I have a crude working example of that but I'm still having several problems:

I'd like to detect collision between sprites that spawn on top of each other and kill the excess ones or even better, not spawn preview sprites at all if one already exists on target location but I've been unsuccessful to have such collision recognized by the events system. I still have an idea to add "occupied" x and y locations to an array and blacklist them from spawning but I couldn't get it working either. It has been several hours and despite the apparent simplicity of the matter it seems futile to keep trying all by myself.

Another problem is that the preview sprites are sometimes placed over obstacles. A workaround would be to keep them on different layers or z-ordering but this doesn't seem to be an intended behaviour.

The project itself has gotten a bit complicated therefore I removed the unnecessary parts and created this .capx with the bare minimums to explain the problem.

PS: I'm also open to criticisms regarding use of arrays. Thanks! :)
B
47
S
3
G
5
Posts: 56
Reputation: 4,630

Post » Fri Feb 10, 2012 3:10 am

@Wronghands: I'll try to have a look at this during the weekend.
Don't hesitate to bump the thread later if it seems I forgot.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Fri Feb 10, 2012 6:30 pm

Thank You for the 16-01-2012: Update! Pathfinding has key importance in games with enemies.

I was thinking about what my colleagues did for Nintendo NDS. Pathfinding wasn't coded into the car-racing game for (possibly) performance or limited time reasons. Spline paths were laid down along the race-tracks and enemy cars followed those invisible splines. It turned out not so bad.

So here is the idea: how reasonable is to lay down "splines" paths on the level and detect if the target is crossing one spline. Like when a soldier touches a wire-trap in a jungle war-game. Enemies would then change to that spline-track and travel down to the point where the target last touched the "wire".

I'm pondering how realistic would it be. Maybe the enemy heard something and follows the noise, goes to the last known target(player) position.mercy2012-02-10 18:37:15
B
25
S
5
G
5
Posts: 138
Reputation: 5,638

Post » Mon Feb 13, 2012 9:28 pm

@Kyatric
Shameless bump ;)
B
47
S
3
G
5
Posts: 56
Reputation: 4,630

Post » Tue Feb 14, 2012 7:39 pm

I got a question about the Plugin, what if the spot is unreachable? If it is surrounded completely by Solids for instance
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 0 guests