User Tools

Site Tools


Sidebar

Content

Mapcraft - Fantasy map designer

WorldGen - SciFi universe generator

Mapcraft Web - Web based fantasy map designer

All code for the project is released under the GPL, and is copyright Samuel Penn.

The text on this wiki is dual licensed CC-BY-SA and GPL.

You can contact the author at sam@glendale.org.uk

mapcraft:database

Database

Initially, all maps were stored in XML files. This is nice and open, and makes copying filse around easy, but runs into performance issues with large maps since it is difficult to break the maps up into chunks.

The higher level map functions have already been abstracted so that the storage mechanism used shouldn't make any difference to the front end. All we need to do now is to design and implement a database storage mechanism for tile sets.

Tile Sets

A tile set is represented as an ITileSet, which represents the tiles, rivers, roads, places etc on a map. A single map may consist of multiple tilesets, for example a building complex which has multiple levels, or a village which has an outdoor map plus internal maps for each building.

CREATE TABLE tileset (id INT autoindex NOT NULL,
                      name VARCHAR(24) NOT NULL,
                      parent_id INT DEFAULT 0,
                      INT height NOT NULL,
                      INT width NOT NULL);
 
CREATE TABLE terrain (id INT autoindex NOT NULL,
                      name VARCHAR(32));
 
CREATE TABLE area (id INT autoindex NOT NULL,
                   name VARCHAR(240) NOT NULL);
 
CREATE TABLE tile (id BIGINT autoindex NOT NULL, 
                   tileset_id INT NOT NULL,
                   x INT NOT NULL, y INT NOT NULL, 
                   altitude INT DEFAULT 0,
                   terrain INT NOT NULL,
                   area INT);
mapcraft/database.txt · Last modified: 2015/02/04 22:39 (external edit)