A* Pathfinding Tutorial
Technical talk from Matt Bauer about A* pathfinding in Nauticus Act III.
Author
Learn how to programmatically generate earth-like terrain using cellular automata.
A cellular automaton consists of a grid of cells, each in one of a finite number of states, such as on and off. The grid can be in any finite number of dimensions. For each cell, a set of cells called its neighborhood is defined relative to the specified cell. An initial state is selected by assigning a state for each cell. A new generation is created, according to some fixed rule that determines the new state of each cell in terms of the current state of the cell and the states of the cells in its neighborhood.
In the classic model of Cellular Automata (CA) Conway's Game of Life, the cells follow four simple rules.
These simple rules ended up evolving complex patterns capable of motion and self-replication.So, if we take the ideas from this and apply them to map generation we should be able to create unique worlds for players to explore.
In Conway's Game of Life the cell is either alive or dead and always stays in one location (Although patterns can give the appearance of motion). For map generation we are going to create agents to move fromtheir current cell to one of the neighboring cells.
Agents work with a given set of rules. The rules of an agent are determined by what you want that agent to accomplish. Maybe you want an agent that can create meandering rivers, lakes, or mountain ranges. Rules can be developed to create all of these things. For this example we are only going to create on set of rules for all of our tile types.
We want our agents to create groupings of tiles that are the same, while still having an element of randomness. To accomplish this we have 2 simple rules.
Initially I fill my map with one tile type, grass. Then I create a random number of Tree Agents, Mountain Agents, and Water Agents and place them randomly on the map.
Each agent is given a number of times they are allowed to move. When they run out of moves or they can't find a new place to move to, they are killed. The maps that are created can be varied by changing the number of agents that are used or by changing the number of times they are allowed to move. I start by filling a percentage of the map with agents and then give them a random number from a range to determine how far they can move.
Here are two example maps that my agents created. The larger map is 200x200 and the smaller map is 50x50.
Cell A cell is a location inside the Map that contains a cell type that is manipulated by an agent.
Cell Type The type of cell it is. Our cells have the following types Grass, Mountain, Water, and Tree.
Map The map is a 2-dimensional plane that is separated into an NxM matrix of cells.
Neighborhood/Neighbors The neighborhood of a cell consists of any cell that is touching or diagonal to the current cell.
We have similar articles. Keep reading!
Technical talk from Matt Bauer about A* pathfinding in Nauticus Act III.
Author
The second video tutorial of a series which takes you through the process of building a tower defense game.
Author
The first video tutorial of a series which takes you through the process of building a tower defense game.
Author