Open General
by Luis Guzman

GAME MAPS

If you want to support
this site, please ...

OpenGeneral can use a background image to show the map or can set up an internal image made of tiles (tiled-map) when loading games.
The map image can be read in any of these formats: PNG, JPG, SHP or S16.

When a map picture is defined (not tiled-map) and is missing, OpenGeneral will try to download from a web repository automatically, and if not possible will set up a tiled-map.

The map size is figured from the map image, but when no image is available, OpenGeneral will try to load a NumMap_sizeCR.txt including the map size. If this _sizeCR file is not found either, OpenGeneral will try to download from the internet. So it is a good idea to download the latest sizeCR.zipfile including all the maps' sizes for available maps, if you are going to play without internet connection. This file is updated each time a new map is released.

Map pictures normally use a number as the filename (.png/jpg) , because that is the way Gilestiel's MapFinder stores them in its database.
Gilestiel MapFinder is a terrific map database, hosting all maps made by map-makers along the years, providing many options to filter maps by country, type, author, etc..
Every time a map-maker releases a new map, MapFinder is updated so designers and players can be sure that there, they can find any of the existing maps.

OpenGeneral allows any filename up to 20 chars, but these maps won't be found in MapFinder

Maps for "New" formats (.xscn and .xsav/.xcsv/.xeml)

For new formats all map data is included in scenario/save game data, thus scenario already knows which image (if any) it should be loaded. Extended Map definition files (.mapx) can be used for designers, including all map data not related with scenario (terrain, roads, ...), but are not used by the game.

Maps for "Old" PG2 compatible formats  (.scn and .sav/.csv) -- .eml files are not supported by OpenGeneral

For PG2 type maps, the map data and the image to load is defined out the scenario in a .map file, which the game should read before, in order to know what map image must load.

How maps are searched...

When game needs to load a .MAP file, it is searched using this sequence:

  1. EFile's SCENARIO subfolder is searched. So any modified map file can override any standard one
  2. If not found, Main game's MAP subfolder is searched.
  3. If not found, and there is a Main game's MAPFILES subfolder then it is searched there.
  4. If still not found  thn it is searched in the Main game SCENARIO subfolder (if it exist).>
  5. Then game will try to download from Internet, although probably not aevery custom made .MAP file will be found.
  6. Then game will prompt you to browse and pick one

To load the map image, game searches using this sequence (if not defined as tiled-map):

  1. EFile's MAP sub-folder is searched, first as PNG and then as JPG
  2. If not found, EFile's SCENARIO sub-folder is searched, first as PNG and then as JPG
  3. If not found, Main game's MAP sub-folder is searched, first as PNG and then as JPG
  4. If yet not found, game tries to download as JPG from OpenGen web repository, into the game MAP folder
  5. And if yet not found, game sets up as a tiled-map

If you want to be sure that you have all maps required for a campaign, there is an option when picking a campaign to check only (will get a list of the missing maps) or to check and download from the web repository all missing maps required.

At any time you cannot access OpenGeneral web repository, you can use the list of missing maps to download them manually, by entering Gilestiel's MapFinder.

Tiled-maps

Maps can also be made dynamically by using "tilesets". There are 2 versions: Tiles 1.0 and Tiles 2.0.

A "tileset" is the set of files defining the pictures to draw the map dynamically. All png files should be made using same 256 colors palette.

For Tiles 1.0 these files are:

  • Hex_tiles.png: has 19 rows (one for each terrain type) and 3 columns (one for each ground condition). each image is 60x50 pixels (width x height)
  • Hex_tiles_sides.png: also 19 rows / 3 columns, but image size 30x25 pixels (width x height). 'Sides' are painted to fill tha gaps between some terrains, breaking somehow the repetitive visual pattern when maps include many same terrain adjacent
  • Hex_layers.png: has 7 rows / 6 columns with images 60x50 pixels (width x height). It is used to paint, rivers, roads, rails, ports and coastal

For Tiles 2.0 these files are:

  • Hex_tiledecors.cfg: a text file including options to configure how the tiled-map should be painted. See Config Tiles 2.0 for details
    This file can define two new concepts:
    • 'Adjacency': when a terrain (say a city) is adjacent to other cities, the image to paint will be selected depending how many similar terrain is adjacent: if none; if 1-3; or if 4-6;
    • 'Random decorations': instead of using same image for all hexes having a terrain, images will be randomly picked among a set defined for that terrain.

  • Hex_tiledecors.png: has 57 rows x 15 columns by default, although can be made with only 12 columns or with more than 15.
    Each terrain will pick the image from 1 of 3 consecutive rows (one for each ground condition) using one column depending settings defined.
    This is the layout of columns in file and a short reference about how they are used:

    • Col#1 (T0) will be used as default tile for every terrain/ground (same than current terrain-tile in current hex_tiles.png).
    • Col#4,5,6 (S01,S02,S03) will be used to paint 'sides' if Col#1 is used to paint terrain. (replace Tiles 1.0 'sides', but using a different tile for each side).
    • If 'adjacency' is defined in .CFG file:
      • Col#1,2,3 (T0,T1,T2) will be used to paint terrain according how many adjacent hexes of same terrain type
      • Col#4,5,6 (S01,S02,S03) will be used to paint 'sides' if Col#1 is used
      • Col#7,8,9 (S11,S12,S13) will be used to paint sides if Col#2
      • Col#10,11,12 (S21,S22,S23) will be used to paint sides if Col#3
    • If 'random decorations' is defined in .CFG file and 'adjacency' is not, then
      Col#7..last (R1..Last) will be used to paint randomly selected image for terrain
    • If both 'random decorations' and 'adjacency' are defined then
      Col#13..last (R7..Last) will be used to paint randomly selected image for terrain

    'Sides' are painted this way :

  • Hex_layers.png: has 7 rows and 6/18 columns, with images 60x50 pixels (width x height), same concept than 1.0 but can include 12 additional columns, to make different layers for different ground condition

Png files can add a number (i.e Hex_tiledecors3.png + Hex_layers3.png for latitude 3 scenarios) to be used only for scenarios using that number latitude (both versions)

OpenGen will use automatically Tiles 2.0 as far as it finds Hex_tiledecors.cfg in the Efile folder OPENGUI and can find also Hex_tiledecors.png either in Efile folder OPENGUI or main OPENGUI folder. So for any efile to use Tiles 2.0 the only requirement would be to have Hex_tiledecors.png in main OPENGUI folder (which is made by installer) and to copy Hex_tiledecors.cfg in the efile folder OPENGUI. To keep using Tiles 1.0 only need assure there is no Hex_tiledecors.cfg in efile's OPENGUI folder.

Version 0.91.0.0 can use additional files and seetings to improve a bit tiled-maps.

  • Tilemap can show the old-style border or a rectangular one wirh no holes on borders
  • New support in Suite/Game to customize river connections, allowing to edit in Suite river connections somehow similar than road connections, to avoid ugly parallel rivers created by automatic connections.
  • New hex_shores.png file, can be used to improve the shores. This file uses a bigger shore tile so can overlap land/water better. Can include up to 3 columns for each ground condition, and 1, 4 or 19 rows instead of rows 6th/7th of hex_layers)
  • New hex_shore_rr.png file, having 2 rows x 18 columns: 66,56 pix/hex, to adjust roads/rails connections when new hex_shores are used.
Also allows these pseudo vars:
  • $draw_after_shores = (list of terrains), making the terrain you list to paint after the shores.
  • $clean_water_shores = (list of terrains), that will erase adjacent water hexes when painting shores.

Tiled-maps are not so beautiful as image based, but they have other advantages:

  • Tiled maps are much faster to design than drawing a map picture, and then defining map data.
  • Tiled maps always show the true terrain. Map images are sometimes ambiguous regarding the terrain they represent
  • Tiled maps shows different aspect according ground condition, and change their look when ground condition changes in game
  • Efile designers can make different "tilesets" for different climate zones.

If you want to know how to design a tiled map check How to create a tiled map written by Csaba Zsadányi-Nagy, who is using tiled-maps for most of his campaigns.

Maps size limits

Maps can be made up to 5400 x 5500 pixels (110 rows by 121 columns), but only maps up to 3150 x 3000 pixels will be available for automatic download and uploaded to MapFinder. Maps bigger than that should be made as tiled-maps or put into EFolder's MAP subdirectory and delivery with the campaign pack.

Be aware that some computers won't be able to load maps bigger than 4096 x 4096 or even bigger than 2048 x 20148 if having video cards not able to be configured with 128 M of VRAM or not able to run DirectX 10, due to requirements of D3D used by SDL2

Actually each hex is 45 wide per 50 height due to offset of even/odd columns.
Thus 100 rows (0..99) require 100*50 pixels, while 100 columns (0..99) require 99*45, because first column (#0) doesn't count regarding size in pixels.

And current limit (110 rows by 121 cols) translate to pixels as:

  • Width: 120 cols * 45 px = 5400 pixels (showing only 45 pixels for last column)
  • Height: 110 rows* 50 px = 5500 pixels

1.- How to figure the map image size according to a wanted-last-row and a wanted-last-column

Use these formulas to set the size of the image map:
  • Map Height = wanted-last-row * 50 pixels
  • Map Width = wanted-last-col * 45 + 15 pixels
Sample:
If you want a last-col = 69 (so the map has 70 columns from 0..69), the map width should be: 69 * 45 + 15 = 3120 pixels, (+15 to show the last's column hex, full painted: 60 = 45+15)

2.- How the engine figures the last-col and last-row available in game from a map image

The engine figures the last-col and last-row using integer division (results 6,1 or 6,9 are taken as 6) with 30 pixels as thresholds, according to these formulas:
  • last-col1 = map-width /45
    .... If (map-width - last-col1) >= 30 , then last-col = last-col1 +1, otherwise last-col= last-col1.
    * map-columns = last-col+1
  •  
  • last-row1 = map-height /50
    .... If (map-height - last-row1) >= 15 , then last-row = last-row1 +1, otherwise last-row= last-row1.
    * map-rows = last-row[/list]
So for a map with 3120 pixels height, the last column is figured this way:
  • last-col = 3120 / 45 = 69.3333 ... which is cut off to 69
  • As 3120 - (69*45) = 15 is less than 30px, last col is not incremented.
Notice that a map image width between 3105 -30 (3090) and 3105+29 (3134) pixels will result in 70 columns (0..69)
while a map width of 3135 pixels will result in 71 columns (0..70) and a map with 3089 pixels will result in 69 columns (0..68).