How is the border of a set of tiles created?
The set of tiles forming the territory is an attribute of an object, and it’s this object that needs a set of all the border tiles. Initially the territory is created as a block, and then mostly gains tiles one by one. In this case, it is true that the fastest way is just to keep a set of the border and only update it on the tile that is gained.
When do you iterate over a border tile?
Whenever you add an element to the territory, you iterate over adjacent tiles and see if they should be a border tile; in this case, they are a border tile if they are not an element tile.
How many vertices and edges does a hex have?
Each hex has six edges and six vertices. Each edge keeps track of its two adjoining hexes, and each vertex keeps track of its three adjoining hexes (hexes on the edges of the map will be a special case). There are many things that you could do a different way of course.
How to represent a hex grid in memory?
The x marks are hexes. x that are diagonal to each other are neighbors. | connects vertical neighbors. You can also try to ‘flat’ rows of your map. For this example it would be: I would suggest something like the following (I’ll use Delphi-style declarations):
How do you check the boundary of a tile?
However, if you make whatever a tile is boundary or not an attribute of the tile then you do not have to go to another data structure to check. Move your area up one tile, then up-right, then down right, etc.. Afterwards remove the original area.
How many tiles are needed for a territory?
To answer some of the questions below. The territory can range in size, from about 20 to 100 or so. The set of tiles forming the territory is an attribute of an object, and it’s this object that needs a set of all the border tiles. Initially the territory is created as a block, and then mostly gains tiles one by one.