Skip to content

Map Files

Stefan Beller edited this page Apr 12, 2013 · 7 revisions

Maps files are used to produce a meaningful map out of the tileset Tile Set Definitions.

It's best to use map editor Tiled for this task. The map editor can directly export flare maps via an export plugin. So it is easy to generate the maps visually and then export it to flares own ini style format to save maps. This article explains how the map file itself is setup, which will help you creating the map using tiled.

Sections

Flare is interpreting these sections for displaying maps:

  • header Basic information, such as tileset, tile sizes, name
  • layer Information about tile layers, which you can imagine as a 2 dimensional array of tiles to form the landscape.
  • npc This will place npcs on maps.
  • event Events are used to modify the game. This can be the map itself, attributes of the hero or interaction with the player or enemies.
  • enemy Single enemies will be placed using an enemy section. This is mostly used for bosses or certain enemies which should always be there at a certain area.
  • enemygroup The Enemygroup section allows you to add enemies in a more random fashion: You can specify a range of how many enemies should be placed.

All other sections are ignored. When using tiled to create map files there is also a tilesets section, which is used by tiled for importing the map. However the tileset for the flare engine is specificed in the header section, hence the tilesets sections will be ignored.

header

The header section may contain these key/value pairs:

  • width=int of the map counted in tiles. On othogonal maps that is the number of tiles from left to right of the map. At maps using isometric projection the width defines the number of tiles from upper left to lower right.
  • height=int of the map counted in tiles. On orthogonal maps that is the number of tiles from top to bottom. On isometric maps this is the number of tiles from lower left to upper right.
  • tilewidth=int The width of a single tile.
  • tileheight=int The height of a single tile.
  • music=filename A music file, which is looked up in $GAME_DATA/<modname>/music
  • tileset=filename The tileset used for this map. It is looked up at $GAME_DATA/<modname>/tilesetdefs
  • title=string The name of the map, which will be displayed in the game.

layer

The layer section may contain only 2 attributes

  • type This must be one of these values:

  • "background"
    
  • "fringe"
    
  • "object"
    
  • "foreground"
    
  • "collision"
    

    The first 4 layers are just displayed on screen, whereas background and fringe layer will always be lower than the hero, npcs and enemies. The object layer is a layer which is rendered interleaved with the hero, npc and enemies. This will make sure that the hero can be rendered in front of a tree or behind it and hence be covered by the tree. The foreground layer will always be rendered above the hero, npc and enemies. The collision layer is special. It is not visible, so it will not be rendered and displayed. It will be only used to extract information, where the landscape is walk-able, non-walk-able or where flying can be done. Also the collision layer will be used for drawing the mini map.

  • data This is followed by a comma separated list of the size as specified in the header section. There should be as many lines as the height specification in the header. Each of the lines should have as many entries as the width specification in the header section. Each number in that comma separated list specifies a tile.

event

An event can be created in tiled using an object layer called event and then placing rectangular objects. events are executed and can alter the map, the hero or enemies (their position or spawn new or change status, i.e. kill the hero in a trap)

An event should have these key/value pairs:

  • type=string any string. Special handling if the string is one of

  • "on_load"
    
  • "on_clear"
    
  • "run_once"
    
  • "stash"
    
  • location=int,int,int,int Defines the location of this event on the map in tile coordinates. The event will be triggered if the hero enters this area.

  • hotspot="location" or int,int,int,int The hotspot is the area, which can be clicked with the mouse to trigger the event.

  • tooltip=string When hovering the mouse over the hotspot, this text is displayed.

  • cooldown=int with suffix such as sec, ms, min

  • power_path=(int srcx, int srcy, int dstx, int dsty) or (int, int, "hero") If this attribute is present the power emitted by this event will start at the point (srcx, srcy) and end either at the hero or at the specified point (dstx, dsty)

  • power_damage=int, int describing min and max of damage

Clone this wiki locally