Isometric Pathfinding Optimization

Discussion of tools and resources for game developers

Post » Fri Mar 06, 2015 10:24 am

@rexrainbow
Seems to work well, although I can't tell much without obstacles in the way to trip it up.
However, I am seeing some aesthetically odd results.

For example:
weirdlookingresult.jpg


Nine steps, yes, it's technically an acceptable path, and one of the shortest paths, but visually it's not the shortest path (just one of the shortest options given the tiles).
Maybe you can add in a distance check, such that it will choose the shortest path that also *looks like* the shortest path, in that it's also the shortest linear distance?
Just an idea.
You do not have the required permissions to view the files attached to this post.
B
9
S
2
G
1
Posts: 48
Reputation: 710

Post » Fri Mar 06, 2015 12:03 pm

rexrainbow wrote:Here is a demo about finding path on a hex board.
- click any purple tile.


Nice example. Takes me back and makes me wanna do a UFO: Enemy Unknown type game.
Follow my progress on Twitter
or in this thread Archer Devlog
B
41
S
18
G
19
Posts: 1,045
Reputation: 13,977

Post » Sat Mar 07, 2015 12:28 am

Better, how can i sync topdown pathfinding with isometric projection. Problems: Sprite rotation in topdown (get variables to sync with iso frames) and can't reduce rotate speed (one second).
Playable games:
http://jamesxxxyz.newgrounds.com/
Newest: Blue and red arrows
Latest update: Blue and red arrows

What you want in C3?
viewtopic.php?f=146&t=122050

Youtube: https://www.youtube.com/channel/UCLE7Ml ... /playlists
B
11
S
4
Posts: 281
Reputation: 1,543

Post » Sat Mar 07, 2015 12:37 am

@JamesXXXYZ
Sorry, I don't understand your problem. Can you rephrase, or explain more?

If your topview sprite is pointed North, that would mean your Iso sprite is pointed at the angle that corresponds to North in the top view grid (such as up and right, or up and left, depending on how you translate it).
Rotate speed?
B
9
S
2
G
1
Posts: 48
Reputation: 710

Post » Sat Mar 07, 2015 1:41 am

@MVG
Isometric.png


When topdownsprite direction is right then isometric frame is 0.
Problem is when i wanna use topdownpathfinding then i don't get a variable, so i can't sync with my isometric frames (40 frames for 360°).
Pathfinding rotation speed update every second, but i need every 0.05 seconds.
You do not have the required permissions to view the files attached to this post.
Playable games:
http://jamesxxxyz.newgrounds.com/
Newest: Blue and red arrows
Latest update: Blue and red arrows

What you want in C3?
viewtopic.php?f=146&t=122050

Youtube: https://www.youtube.com/channel/UCLE7Ml ... /playlists
B
11
S
4
Posts: 281
Reputation: 1,543

Post » Sat Mar 07, 2015 9:15 am

@JamesXXXYZ
I don't understand the way you're trying to do it. There shouldn't be any key presses to change direction if it's following a path.
In order to get the appropriate directional facing frame for a sprite, the movement of which is being controlled programmatically like this (path finding), you need to poll its vector.
You can do that by comparing its position last frame and this frame, if you're not using physics. If you don't have walk/run or anything like that, you can throw out the magnitude and just keep the angle, which you can convert into the frame you want.
B
9
S
2
G
1
Posts: 48
Reputation: 710

Post » Sat Mar 07, 2015 2:43 pm

Pathfinding topdown and sync it with picture below.

sync.png

@MVG
This is how i can control something in topdown and project it in isometric view (with this picture above). It was only an example.
You do not have the required permissions to view the files attached to this post.
Playable games:
http://jamesxxxyz.newgrounds.com/
Newest: Blue and red arrows
Latest update: Blue and red arrows

What you want in C3?
viewtopic.php?f=146&t=122050

Youtube: https://www.youtube.com/channel/UCLE7Ml ... /playlists
B
11
S
4
Posts: 281
Reputation: 1,543

Post » Sun Mar 08, 2015 6:40 am

@JamesXXXYZ
I see. So, you should be able to also store the prior X and Y, compare it to the new one, and get the angle of movement, right?
Or maybe there's another problem I'm not seeing.
B
9
S
2
G
1
Posts: 48
Reputation: 710

Post » Sun Mar 08, 2015 2:55 pm

@MVG
For me it is really complicated but if it is for you easier you can check this out, please?

Capx (with some needless events):
download/file.php?id=9218
From:
viewtopic.php?f=146&t=120594
Playable games:
http://jamesxxxyz.newgrounds.com/
Newest: Blue and red arrows
Latest update: Blue and red arrows

What you want in C3?
viewtopic.php?f=146&t=122050

Youtube: https://www.youtube.com/channel/UCLE7Ml ... /playlists
B
11
S
4
Posts: 281
Reputation: 1,543

Post » Mon Mar 09, 2015 8:10 am

@JamesXXXYZ
Sorry, I don't have C2 installed on this computer (on laptop), so I can't check it right now.

But basically:

Set Xold to X
Set X to Playertopdown.X
Set Yold to Y
Set Y to Playertopdown.Y

Now you just need to compare the coordinates, (Xold,Yold) and (X,Y) to get the angle.
B
9
S
2
G
1
Posts: 48
Reputation: 710

PreviousNext

Return to Tools and Resources

Who is online

Users browsing this forum: No registered users and 1 guest