Original Post
Hi,
I need a pathfinding system in my game but i'm not sure what to choose and how much things should be added to it to make it work without eating my CPU. What i want is a large map, at least 512*512 tiles and have many layers of this size on top of each other. The map can be altered heavily and there will be many (100+) entities that will need pathfinding on this map and between these layers. The pathfinding does not have to be very accurate as in cutting corners. So what path finding system should i be using here, or at least start out with.
I did tinker on an idea but i'm not if this would work at all. Let's say i put Major nodes on each 10th tile in the X and Y axis. Then when finding a path just use these nodes to get as close a possible to the target and put them in a list. Then look for straight lines 2 to 4 straight lines till they pass that node in one axis. Now do the same for the next node. If the path can not be reached it should try a more sophisticated algorithm, but note that a major node can be in a place the entity can never reach so it should probably make a closest reachable tile as it's target. When finally near the last node use something like A* to get the entity to it's destination.
I already can see problems with this used in complicated mazes, and while my maps can be like that they will mostly have large halls and rooms. I can also see the entity walk into some dead end and then needs to traverse back using an expensive algorithm so this is still very flawed but might be improved with some ideas.
I need a pathfinding system in my game but i'm not sure what to choose and how much things should be added to it to make it work without eating my CPU. What i want is a large map, at least 512*512 tiles and have many layers of this size on top of each other. The map can be altered heavily and there will be many (100+) entities that will need pathfinding on this map and between these layers. The pathfinding does not have to be very accurate as in cutting corners. So what path finding system should i be using here, or at least start out with.
I did tinker on an idea but i'm not if this would work at all. Let's say i put Major nodes on each 10th tile in the X and Y axis. Then when finding a path just use these nodes to get as close a possible to the target and put them in a list. Then look for straight lines 2 to 4 straight lines till they pass that node in one axis. Now do the same for the next node. If the path can not be reached it should try a more sophisticated algorithm, but note that a major node can be in a place the entity can never reach so it should probably make a closest reachable tile as it's target. When finally near the last node use something like A* to get the entity to it's destination.
I already can see problems with this used in complicated mazes, and while my maps can be like that they will mostly have large halls and rooms. I can also see the entity walk into some dead end and then needs to traverse back using an expensive algorithm so this is still very flawed but might be improved with some ideas.