Skip to content
This repository has been archived by the owner on May 10, 2021. It is now read-only.

Map Creation

Christopher L Bruce edited this page Jan 27, 2019 · 1 revision

Tileset

The first step to creating a new map is to define a Tileset for it. A Tileset is a dictionary of Tiles and their properties in the following format:

BIOMES = {
    'village':{'movement':1, 'color':'red', 'alpha':'V', 'symbol':'±',
            'description':'YOU ARE IN A PEACEFUL VILLAGE',
            'resources':None,
            'font':{'fgcolor':'BLACK','bgcolor':'WHITE','style':'NORMAL'},
            'discovered':True
            },
        ...

source: WordRPG\map\tiles.py (Full descriptions of these properties can be found in the Tile class docstring.)

  • Each Tile must have a unique 'color' value in order for the Map.load_map() function to work correctly.
  • 'color' names and hex/rgb values correspond to HTML color names
  • The Map.load_map() has a special-case handler for any Tile named 'path' in that it will automatically replace the Tile's 'symbol' and an appropriate ASCII character to build a connected path between all neighboring 'path' Tiles.

There are no hard limits about the number of Tiles that can/must be defined or which pixel colors represent them. But as a general rule of thumb, Tilesets should always include:

  • Barrier tiles such as 'ocean', 'mountains', 'walls', etc. Something that can be used to constrain where the player can go in any given map
  • A Tile that can represent out-of-range Tiles when the map frame is positioned in a way that the player can see past the extends of the defined map area. These Tiles should be unreachable, completely blocked off by barrier Tiles inside of the defined map area.

For more fun, we can use multiple Tilesets with a shared source image. So we could do things like define a winter or nightime Tileset for the world map and change the way it appears on screen.


Map Source Image

Current test map for the world

Once a Tileset has been defined, you can create a new image that will be the source for all of the Tiles in a Map.

  • The size of this image can be any value and determines the final dimensions of the Table array that holds a unique instance of the appropriate Tile in each cell.
  • Because of the 8x16 pixel characters in the terminal window, map images should be twice as wide as they are tall in order to appear square on a screen
  • Each pixel color in an image must correspond to a unique Tile 'color' in a Tileset.
  • new map images should be saved as a .png in WordRPG\map\images

Example:

Our current test map for the world, which uses the BIOME Tileset:

  • Map image - WordRPG\map\images\test_island2.png
  • Tileset colorkey - WordRPG\map\images\color_key_biomes.png
  • "BIOMES" Tileset - WordRPG\map\tiles.py
Clone this wiki locally