Blockland Forums > Modification Help
grid based pathfinding help
(1/4) > >>
PhantOS:
i suck at math but i need to design this system. its for a strategy game. its crucial.

the map itself and all its tiles is being generated from the ground up, which means that there will be no manual nodemapping, all this has to be generated automatically with the map based on the data provided (coordinates, tile type, etc)



i'm good at understanding explanations on how code should work in theory. that's mainly what i want here, i just need someone to tell me how this system will work in theory. i don't need psuedocode or anything, just like "you should check the direction and do blah"
phflack:
since A* branches out, you could just put the check there

ie

123
456
789

starting at 5, check if it's a ramp
if it's  N ramp, it checks 2 on curLevel+1 and checks 8 on curLevel
and so on for E/S/W ramps

if it's not a ramp
check 2/4/6/8 on curLevel
if they're ramps facing the wrong way, skip over them


it would help to know how you're laying out the tiles and what data structures you're using
if it's a static grid, it may be easier to just use arrays
if it's not, you could probably still use arrays since torque is weird like that
PhantOS:
alright that makes sense thanks
phflack:
also, instead of just straight out ignoring those paths, you can give them a higher weight
that way if they can scale a wall, they will do it if it's faster than walking around the wall
Dannu:
When I was working on this in relation to a board game-esque thing i was tinkering on, I adapted Slayer's A* implementation. How it works is that you create nodes and create links between them. Then when you ask for a path, it checks links from node to node as valid paths between them and calculates the optimal route.

Since it was quite a task to comprehend that entire system, if you want I can maybe dust off that old project and explain how the different parts work with examples.
Navigation
Message Index
Next page

Go to full version