Battle Analysis: Map Events


As the mouse moves over the battlefield map

4 map coordinate points are identified for Graphical User Interface.

1. Screen Coordinate: As the mouse moves across the map, its location on the screen is recorded.

  screen coordinate

2. Grid Coordinate: As the mouse moves across the map, its location on the hexagon grid is calculated from the grid's origin. A hexagon grid is overlayed onto the wargame map. This grid has an origin that is 18 pixels to the left of the left map edge and 20 pixels above the top edge of the map.

  grid coordinate

3. Hexagon point: As the mouse move across a hexagon, its location calculated using Analytical Geometry with a Hexagon Map Calculator using the grid origin as a starting point to calculate hexagons. The hexagon is drawn on the map in red. The center of the hexagon is found on the hexagon grid and stored as

  hexagon point  

Note: the hexagon name      is calculated. It is NOT a coordinate.

This coordinate is used for hexagon math calculations.

The hexagon name is used to record the units position.

The hexagon name is ONLY a label. It is NOT a coordinate.

4. Grid point: As the mouse moves across a hexside, its location is recorded by a bounding rectangle using Analytical Geometry. The hexside rectangle is drawn on the map in blue. The center of the hexside is found on the hexagon grid and stored as

   grid point  

If the mouse is not on a hexside, the hexagon center is recorded.

This coordinate is used to store terrain information is a database.

Both hexagon and hexside terrain data is stored together using the grid point

By using the same coordinate system, the Line of Sight can be calculated with the terrain data

Certain terrain types, such as roads, have their location placed on hexsides and the connecting hexagon center between hexsides.

Note: The detection of the hexside usually generates a lot of discussion. Where does the hexside start? Where does the hexside end? The use of a bounding rectangle is a 'good enough' compromise.

Do not use [hexagon name:hexside number] convention to record terrain data.

For example, the road terrain at the bottom of hexagon 0403 could be recorded as 0403:4 road where the number 4 is the numbered hexside counting from the top clockwise. But is could also be recorded as 0404:1 road. If you create a list of going thru all the hexagons and recording the hexsides, you get:

0403:4 road
0404:1 road

Now, if you edit or delete one of the entries, you will end up with errors

So, use a system that has a unique identifier for the data.

It's best to use the grid point because the line of sight is an array of points.

All coordinates are based on the cartesian coordinate system.





























Mark Butler
Copyright © 2009-2019