Unwalkable tiles using easystar, walk to nearest tile?

Get help using Construct 2

Post » Sat Dec 31, 2016 4:50 pm

99Instances2Go wrote:They have no free spot on a vert or hor position.

Cross the two 'loopindex("..") = 0' conditions in event 11 to have the diagonals available.
That will also mean that they are taken into account when calculating/choosing the shortest path.

Up to you if you like that or not. The results are very different. I did not like it at all in a example that i made.

Also, it will be slower. In the end, when you dont limit the search tree (and that is ALWAYS true), you end up checking to many possibilitys.
It is not a case of finding the shortest available walkable tile to the click position, that is pretty easy, you can do that on your own.
The case is to find the shortest available walkable tile that can be reached.

So, if you got a clickable tile buried deep down, and you want to check for every walkable tile arround it (dont matter how far away) if it can be reach and if it is the closest reachable, your search tree goes deep and exponential in amount of choices.

But that is up to you eh.

Now it checks just hor and vertical (4 tiles) in a simple loop. Whatever loop you want to choose will work (in exponential longer ticks).

I understand, now doing this allows for something to happen when clicking a buried tile, but the player is now offset by a tile, usually diagonally? Is it possible to have the player arrive at the same tile as clicked whilst also checking buried tiles?
Image
B
41
S
12
G
14
Posts: 1,122
Reputation: 11,282

Post » Sat Dec 31, 2016 7:27 pm

Why dont you just write in events what you think ?

https://www.dropbox.com/s/faxsqtisyypfl4f/ntr.capx?dl=0

Dont give me hell for the search time for completely locked up tiles. You was warned.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Dec 31, 2016 8:35 pm

99Instances2Go wrote:Why dont you just write in events what you think ?

https://www.dropbox.com/s/faxsqtisyypfl4f/ntr.capx?dl=0

Dont give me hell for the search time for completely locked up tiles. You was warned.

Well, that works perfectly as far as I can tell, thank you! Sorry if I've been too fussy, I try to find things out by myself, but I'm really useless at intermediate programming, I spent 2 years reprogramming a webforum system with tons of help from a community, took me 60x as long as any kiddiescript coder, but I did it in the end and learned a lot!

I mean, I'm just trying to find the perfect engine for pathfinding for an adventure game, and all this great stuff is being shared with the community, which to me, is the whole point, for as many people to benefit from an idea as possible, and you've been single-highhandedly invaluable for helping me do this, and I really appreciate it! :D

I tried earlier to find a place to figure out the equivalent of "if player is on the same tile, and therefore no pathfinding is being checked, MoveTo: mouse.x/mouse.y" to allow for pixel precision movement at any tile size, it probably would be nice to be able to go to the exact pixel clicked on within the tile, but I don't think easystar logs that info, just the tile, or am I wrong?
B
41
S
12
G
14
Posts: 1,122
Reputation: 11,282

Post » Mon Jan 02, 2017 12:13 am

99Instances2Go wrote:Why dont you just write in events what you think ?

https://www.dropbox.com/s/faxsqtisyypfl4f/ntr.capx?dl=0

Dont give me hell for the search time for completely locked up tiles. You was warned.


Any idea what this little jiggle is that happens when you use a big sprite upon initilizing the walk? It only happens on this latest version. https://www.dropbox.com/s/yk55s50hevvph ... .capx?dl=0 (thankfully the pathfinder always just uses the hotspot rather than the sprite size!)
B
41
S
12
G
14
Posts: 1,122
Reputation: 11,282

Post » Tue Jan 03, 2017 9:11 am

@99Instances2Go Is it because the larger sprite is going to the starting tile before it begins moving/the starting node isn't at the same place as the hotspot? I can't quite work out what it looks like what is happening, even on debug, the player just seems to go back a bit before moving along the path: Image
B
41
S
12
G
14
Posts: 1,122
Reputation: 11,282

Post » Wed Jan 04, 2017 8:40 am

@99Instances2Go Also, it only happens on the unwalkable tiles, as can see in The gif when I click on the white space.
B
41
S
12
G
14
Posts: 1,122
Reputation: 11,282

Post » Fri Jan 06, 2017 11:41 am

99Instances2Go wrote:Why dont you just write in events what you think ?

https://www.dropbox.com/s/faxsqtisyypfl4f/ntr.capx?dl=0

Dont give me hell for the search time for completely locked up tiles. You was warned.

It's very nearly perfect, just trying to iron this one quirk out! Can you assist? :roll:
B
41
S
12
G
14
Posts: 1,122
Reputation: 11,282

Post » Sat Jan 07, 2017 11:39 am

Zebbi, i have no idea what you are doing, a .gif is not helping.

Besides that, looking at that .gif, i dont understand the use of tilemap based pathfinding with that plugin.
There is no possible path in the tilemap because the moving object (its size, and polygons) does not obey to the tilemap.

I have no idea how to make my code work in totally different environment then it is designed for.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Jan 07, 2017 3:40 pm

99Instances2Go wrote:Zebbi, i have no idea what you are doing, a .gif is not helping.

Besides that, looking at that .gif, i dont understand the use of tilemap based pathfinding with that plugin.
There is no possible path in the tilemap because the moving object (its size, and polygons) does not obey to the tilemap.

I have no idea how to make my code work in totally different environment then it is designed for.

It does work! That's the beauty of it, the tilemap only seems to care about the base pixel or something because has worked perfectly fine! https://www.dropbox.com/s/yk55s50hevvphkd/JIGLGE.capx - the ONLY issue with the last revision is there's a strange little jiggle the player makes before moving if you click an unwalkable tile, this didn't happen in the other versions I used in this enviroment. I suppose technically I could use a tile the size of a tile and stick the player to it, but so far it's actually been working perfectly well this way! Try that capx, if you can, and on debug you can see there's a slight movement before starting along the node path if you click an unwalkable tile.
B
41
S
12
G
14
Posts: 1,122
Reputation: 11,282

Post » Sat Jan 07, 2017 4:31 pm

You made some weird mix with events from both methods.
Event 57 & 58 are left overs from method 1.
You forgot the 'on path not found' situation from method 2.

The 'marker' is just a debug object. You know that eh.

https://www.dropbox.com/s/8wyg0y99z065l ... .capx?dl=0
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 4 guests