Mapping Terrain

map


 

The Hexpart object provides a way to uniquely identify each hexagon center and hexagon hexside.
This hexpart coordinate can be used to store terrain data in a database or an array.

In this example, the Terrain object creates a two dimensional javascript array. Since the array is an integer array, the terrain features can be assigned bit-wise numbers. The number for each terrain feature present is added together, and the total is stored in the javascript array.

1offmap
2clear
4rough
8road
16town
32forest
64river

For storing the terrain data in a database, the primary key would be autonumber and the data would store the x, y coordinates and one of the terrain features
for example:

primary key value48clear
primary key value48road
primary key value610clear
primary key value816rough
primary key value820clear
primary key value820forest
primary key value614clear
primary key value614town