Archived

This topic is now archived and is closed to further replies.

Pathfinding

This topic is 5960 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I have an patfindin Algo for a normal 2D map. But I''ve no idea how to impleme´nt this in my iso programm. I paint my map as follows: First row is normal paintete Tile by Tile. then the second line is painted pre-stepped the half tile wide and so on.. that''s the sytem of the Tutorial written by Transtaffl. But how can I implent a Pathfining Algo in such system. I ope that you can helph me...

Share on other sites
if your pathfinding algo involves tile movement, it should be rather transparent if the map itself is iso or top-down.
the map will likely still be an array of some tile type, like -
CTile TileMap[MAPWIDTH][MAPHEIGHT];
you just need to be able to tilewalk in 8 directions (north, northeast/west, east, west, southeast/west, south).

for example in a diamond iso map, the X axis runs diagonally northwest-southeast, and Y runs northeast-southwest.
so to walk north you need to do
X--;
Y--;
to walk northwest all u need is
X--;
and so on. (this is different for slide or staggered maps..)
so you make a function that takes as parameters a POINT for the current location and a direction (probably an enum..), and returns a POINT, and based on the current map type, will add or subtract from X and Y to get to the correct direction.
TANS uses a function pointer and assigns a specific map type to the tilewalking function using another member function of his tilewalking class when he decides on a map type. it may not be like that in this specific tutorial, but it is in his book.
anyway you can also make a function to take as parameter the map type in addition, or if you have some way of defining the map locations or directions differently for each map type you can overload the function, but...

so if your pathfinding thing is OBSESSED with accessing specific cells of an array which are correct only for the top-down rectangular map -- change it!
if this thing is not tile-based, you''re gonna need to just go over it and see how to translate it into "iso"..
just like there''s a way to translate between a diamond map and a rectangular screen and vice versa, there''s a way to translate this to get it to fit your needs.

if you link to at least an explanation of the mechanism this algo uses, then maybe more help could be available.

meantime best of luck

//Demiurge
Make something idiot proof, and someone will make a better idiot..

Share on other sites
Hi,
I dont know if this may help you. I think you are getting confused with the ISO representation.

An ISO representation is just a point of view. It should not be considered the central part of your game. In other words, an iso tile based game is a simple tilebased game but with a different point of view.

Your tile map, even if it is a 2D map or an ISO map is just a 2D matrix, with obstacles, walls, trees and so. If you see the map as a simple matrix, you can implement your pathfinding algorithm with no problem and your method will work 2D, ISO or even 3D!

So, my suggestion is: just implement your pathfinding method (A* suggested) to work in a simple matrix and then you will see that it is really easy to adapt these methods in your game.

Guimo
P.D. If you can read spanish, my tilebased engine (KEngine) implements a 256*256 matrix map level that have a fast and ready to use A* implementation. You can download the KEngine GDK at www.spritekin.com/kengine/kengine.html
Spanish documentation included only. No english yet.

Share on other sites
I have no problem with implemting a Pathfindin Algo
in a Iso Diamond Map. But I have a staggered map...
And I realy do not know how to implement a normal Pathfinding Algo i a staggered map
Are there any examples of Pathfinding for staggered maps?

Share on other sites
Oh, the Kengine is really great, and it works on my Pentium 133
:-)... How do you paint the map? staggered , diamond....?

Share on other sites
you say you don''t have problems with drawing the staggered map, right? it''s just the pathfinding?
maybe if you said what the specific problem is..i mean how is the staggered map itself causing problems?
are you referring to the part about being able to slide left/right on the edge of the map or something? because that shouldn''t be too hard.

//Demiurge
Make something idiot proof, and someone will make a better idiot..

1. 1
2. 2
frob
15
3. 3
4. 4
5. 5
Rutin
12

• 12
• 12
• 58
• 14
• 15
• Forum Statistics

• Total Topics
632115
• Total Posts
3004197

×