![]()
9.) Lets assume that this is the shortest/ best path (I know that it actually is not but just assume!)
10.) That path would still not be optimized so we need to check if the path can be optimized wich means if the distance of the path can be decreased. One way to do this is to try to skip the 2nd node of the path if this is possible.
![]()
11.) the same goes for the 2nd last node (no. 6 in this case) try to skip this one aswell if it is possible
12.) the final path has been found
ok thats only the concept,- however I think that this might explain people more as just lots of code.
Also this is just the rough idea,- I added some abilities where you can determine weither a node connects with the other one backwards or not. Also it should be possible to add weights on each node so that the player avoids those nodes more as others.
Here is an example how I tricked with it in the elevator level:
(green are the directions of the nodes to each other)
- Node 7 for example only connects with Node 3,4,5 and 6 - but you cant go back from the nodes 3,4,5,6 to node 7
- another nice trick is to use a boundary between 2 nodes (see node 9 and 10 for example) this forces the player to first go to node 9 and then to node 10 if you want to leave the elevator







Reply With Quote