[Behavior]PathFinder

Post your completed addons to share with the community

Post » Wed Mar 07, 2012 3:31 pm

Hey all,

I have played around with this behaviour a bit and it is indeed really useful, but I do have a problem. I think this has been flagged already, but I am not sure, so I give it a try ;)

My Capx

I managed it, to spawn new mobs that instantly get an own Path, but when. This works well for the first mob on each spawn point, but after the first one, each additional mob does show up at the spawn point and jumps automatically to the coordinated 0,0.

Any idea, how to fix this? If possible at all? :)


Update: Managed it to fix the most of the problems but one. After each generation of a mob, the game hangs for some seconds before it resumes. Any idea?

The main problem was with the Demo I used:

instead of:
Lerp(self.PathFinder.getCtXPathList(floor(self.iteration)-1),self.PathFinder.getCtXPathList(floor(self.iteration)),self.iteration-floor(self.iteration))

I used:
Lerp(self.PathFinder.getCtXPathList(floor(self.iteration)),self.PathFinder.getCtXPathList(floor(self.iteration)+1),self.iteration-floor(self.iteration))

My new capx
Ubivis2012-03-07 15:51:19
B
42
S
9
G
6
Posts: 437
Reputation: 5,626

Post » Mon Mar 12, 2012 7:58 am

@Kyatric
At last I were able to implement your solution to a working example but am now having massive performance hits. :/ There are probably simply too many paths to calculate as disabling the despawn events did not help the performance. Even my i7 desktop is slowing down.

Instructions (sorry about the unintiutive state of things):
SPACE = End Turn / switch active side
Right click on active side units = pick the unit
Left click while an unit is picked = move the unit

I'm not comfortable with uploading a full capx anymore but can do so privately if you'd like. :)
B
47
S
3
G
5
Posts: 56
Reputation: 4,630

Post » Mon Mar 12, 2012 6:05 pm

MovObj_PF_r75.a.capx
MovObj_PF_withPreview_r75.a.capx
Hop! little logic debug. Some of my old decision made the sprite jump directly from the first to the second case. In step mode it wasn't an issue but in smooth mode if you moved by just one cell there wasn't any interpolation.
Last edited by Yann on Sun Sep 14, 2014 9:20 pm, edited 1 time in total.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Wed Mar 14, 2012 12:10 am

@Ubivis, @Wronghands: I guess the current implementation is really not fit for realtime. And/or small Cell Size Side. (bigger cell side sizes over the same layout's size => less computations)

In the current state I'd say it would take another implementation of the PF to perform in real time.
I've been discussing with Yann for some time about such an other plugin/behavior.
For now, I don't really need it, and haven't really time to spend on such side project atm.

As long as you limit and delay the path generations, you may have a use for the PF (especialy in turn based/slow paced games).

Or use a "witness" object that will have the pathfinder and which pathlist the moving instances/objects of the same type (Ubivis, your yellow moving thingies for example) would look/use.
But the path would be actually generated only once on start of layout or any time the obstacles/field is modified. And not for every moving instances.
That would lighten the CPU charge for sure.

@Wronghands: I saw some strange things occuring testing your exported project in firefox.
That would lead me to believe that you're not mastering the behaving of your application/logic.
Without the capx, hard to say.

And I really don't have the will/time/energy to be your personnal debugger at the moment, sorry.
You'd have more answers posting a public capx, the exported project pretty much still looks like a prototype.

If you fear for graphical/sound asset, simply make a stripped version with graphic placeholders/no sounds.
Kyatric2012-03-14 00:11:17
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,999
Reputation: 57,793

Post » Wed Mar 14, 2012 1:20 am

Kyatric,

just an idea for future update,
how about when the path finding doesn't find any solution,
it will pick one solution closest to the target
B
34
S
13
G
8
Posts: 134
Reputation: 8,118

Post » Wed Mar 14, 2012 8:39 am

Just sharing a real time example, on Chrome it works quite nice already as I set it up to only calculate new paths when the enemy hits a wall (you can place walls by left mouse button and delete a wall part by double clicking it)

http://www.ubivis.de/td

So, it can be used for real time in a limited way. I do look forward to see nice updated to it :)
B
42
S
9
G
6
Posts: 437
Reputation: 5,626

Post » Wed Mar 14, 2012 10:55 am

edit: nevermind, I'm convinced it's just the behaviour that can't perform at reasonable speed for my task.Wronghands2012-04-12 09:06:15
B
47
S
3
G
5
Posts: 56
Reputation: 4,630

Post » Tue Mar 27, 2012 10:25 pm

@Kyatric, there is a bug. If you enclose the Sprite into a box of walls and click outside of that box, the Sprite will jump into the top left corner of the layout.

This bug will only happen on the first click of the mouse but if you click inside where it's movement for the Sprite, the bug won't happen if you click outside of the enclosed box.

Are you working on this bug or knows of it's existence?
B
6
Posts: 14
Reputation: 478

Post » Tue Mar 27, 2012 11:11 pm

@yuramod3: I'm not working at all on the PF for now and have no knowledge about this bug.
Could you provide a capx with repro steps please ?
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,999
Reputation: 57,793

Post » Tue Mar 27, 2012 11:36 pm

@Kyatric actually, I found a fix for it. When the user first clicks anywhere where the Sprite is surrounded by obstacles, it bugged out and sent it to position 0, 0. Just disabled the added coding I put in there and see for yourself. I'm using Chrome as my browser.

To fix it, I added IF statements if the PathFinder couldn't generate a correct path, I set the destination to the Sprite's x&y and set moving to False.

http://dl.dropbox.com/u/69588589/MovObj_PF_r7523523.capxyumarod32012-03-28 00:43:50
B
6
Posts: 14
Reputation: 478

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 4 guests