Skip to main content
Rearranged the title, did some switching of vocabulary, rehosted the image on our special imgur host, and added the Tower Defense tag. ♪
Source Link

Tower Defense: Pathfinding (randomwith multiple Paths)random paths in a Tower Defense game

I thought about random pathfinding for my TDTower Defense game. A* would not work for my puposes, because I exactlyspecifically need random pathfinding.

Imagine a map with waysroutes, a starting point and a destination. I have multiple waysroutes, which all lead from the starting point or a way to the destination, one way or another way. It could look like this:


http://accord-games.de/Downloads/map2.png

Two branch-path shaped like a square

Color description: red red - starting point; black - destination; grey - way;route; white - free space
(The numbers are used in the text as a reference to some tiles)


I first thought about just calculating randomly the next waypoint randomly, when an entity passes a tile. But that would not work. When an entity passes tile 1 it either can go up or down. When it comes to 2 it can either go down/up (relative to it´s position) or right.
If it goes down/up it would go to tile 1, which means that it took a way backgoes backwards. Bad...

I would really like to make it dynamic, but I can´t figure out, what I can do now. Anyone with ideas or experience in this?

Tower Defense: Pathfinding (random multiple Paths)

I thought about random pathfinding for my TD game. A* would not work for my puposes, because I exactly need random pathfinding.

Imagine a map with ways, a starting point and a destination. I have multiple ways, which all lead from the starting point or a way to the destination or another way. It could look like this:


http://accord-games.de/Downloads/map2.png

Color description: red - starting point; black - destination; grey - way; white - free space
(The numbers are used in the text as a reference to some tiles)


I first thought about just calculating randomly the next waypoint, when an entity passes a tile. But that would not work. When an entity passes tile 1 it either can go up or down. When it comes to 2 it can either go down/up (relative to it´s position) or right.
If it goes down/up it would go to tile 1, which means that it took a way back. Bad...

I would really like to make it dynamic, but can´t figure out, what I can do now. Anyone with ideas or experience?

Pathfinding with multiple random paths in a Tower Defense game

I thought about random pathfinding for my Tower Defense game. A* would not work for my puposes, because I specifically need random pathfinding.

Imagine a map with routes, a starting point and a destination. I have multiple routes, which all lead from the starting point to the destination, one way or another. It could look like this:


Two branch-path shaped like a square

Color description: red - starting point; black - destination; grey - route; white - free space
(The numbers are used in the text as a reference to some tiles)


I first thought about just calculating the next waypoint randomly, when an entity passes a tile. But that would not work. When an entity passes tile 1 it either can go up or down. When it comes to 2 it can either go down/up (relative to it´s position) or right.
If it goes down/up it would go to tile 1, which means that it goes backwards. Bad...

I would really like to make it dynamic, but I can´t figure out what I can do now. Anyone with ideas or experience in this?

Tweeted twitter.com/#!/StackGameDev/status/59045705133731840
Source Link
Marco
  • 1.1k
  • 8
  • 13

Tower Defense: Pathfinding (random multiple Paths)

I thought about random pathfinding for my TD game. A* would not work for my puposes, because I exactly need random pathfinding.

Imagine a map with ways, a starting point and a destination. I have multiple ways, which all lead from the starting point or a way to the destination or another way. It could look like this:


http://accord-games.de/Downloads/map2.png

Color description: red - starting point; black - destination; grey - way; white - free space
(The numbers are used in the text as a reference to some tiles)


I first thought about just calculating randomly the next waypoint, when an entity passes a tile. But that would not work. When an entity passes tile 1 it either can go up or down. When it comes to 2 it can either go down/up (relative to it´s position) or right.
If it goes down/up it would go to tile 1, which means that it took a way back. Bad...

I would really like to make it dynamic, but can´t figure out, what I can do now. Anyone with ideas or experience?