1

**Offtopic / Re: XCOM Inspired Fantasy Game**

« **on:**December 14, 2019, 08:09:59 pm »

So one may be curious how random pathfinding could ever work? After all, it is random. As all random generation algorithms, it has constraints. In my case it uses the same fractal algorithm I used to generate the island on the screenshot, or the usual "battlescape" maps. First you generate several rough paths, made only of a few line segments, select the best one of them, and then refine each of its segment by applying the algorithm recursively, so the final path will closely match roads or other unit movement abilities. In fact, such space subdivision is the base for AI algorithms, including ANNs and Markov Chains related algorithms, and it has a name - interpolation. In basic case interpolation can create smooth shapes (by displacing uniformly along the normal), and, under constraints, shapes that match some other shapes - real or imaginary. When the subdivision is applied in geometric context, potentially infinite number of times, it is called "fractal", from the word "fraction", because the process is the same as how you obtain fractional parts of Pi or other irrational numbers, just applied to shapes.

But, yes, it is impossible to use the algorithm my current from for navigating mazes. Although one can modify the algorithm to make it work with mazes. In fact, maze navigation doesn't require diffusion based algorithms at all. There is a very simple algorithm employed by robots to get out of mazes, which doesn't even have a state, while diffusion requires memory size equivalent to the search space. Other way is precalculating a navigation table which for some rough samples for two world cells would give movement direction. In fact such navigation table can be calculated iteratively, while game is running, since the diffusion algorithm us iterative. Table based navigation is every fast even for millions of agents. It can also include anti-table for say escaping entities, which would help them getting the best escape routes, say avoiding spreading flame.

Still I find it funny how one can take the algorithm for generating Pi, and, replacing a few parts, get the algorithm to generate a video game world, or to generate a path in that world. Or how random numbers guiding the algorithm could be coming from any chaotic process, including the decisions player makes in the game (i.e. what buildings he/she builds and what sites visits).

But, yes, it is impossible to use the algorithm my current from for navigating mazes. Although one can modify the algorithm to make it work with mazes. In fact, maze navigation doesn't require diffusion based algorithms at all. There is a very simple algorithm employed by robots to get out of mazes, which doesn't even have a state, while diffusion requires memory size equivalent to the search space. Other way is precalculating a navigation table which for some rough samples for two world cells would give movement direction. In fact such navigation table can be calculated iteratively, while game is running, since the diffusion algorithm us iterative. Table based navigation is every fast even for millions of agents. It can also include anti-table for say escaping entities, which would help them getting the best escape routes, say avoiding spreading flame.

Still I find it funny how one can take the algorithm for generating Pi, and, replacing a few parts, get the algorithm to generate a video game world, or to generate a path in that world. Or how random numbers guiding the algorithm could be coming from any chaotic process, including the decisions player makes in the game (i.e. what buildings he/she builds and what sites visits).