-
Notifications
You must be signed in to change notification settings - Fork 188
Map Files
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.
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.
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.
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 theheight
specification in the header. Each of the lines should have as many entries as thewidth
specification in the header section. Each number in that comma separated list specifies a tile.
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" the event will be executed on map load, it is only run once.
-
"on_clear" when all enemies on the map are dead, it is only run once.
-
"run_once" will be removed after it is run once.
-
"stash" will open the stash, which is available for all characters.
-
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=string
Usually just an int to specify the cooldown in frames, but can also have a trailing "s" or "ms" to specify in seconds and milliseconds.
Usual events are triggered if the hero enters the location or the hotspot area is clicked. However you can specifiy additional requirements to be met, to have an event triggered:
-
requires_status=string, ...
at least one status to be required, add more separated by commas. -
requires_not=string, ...
at least one status which must not be set, add more separated by commas. -
requires_item=int, ...
at least one item id, add more items to be required separated by commas. -
requires_level=int
The hero must be at least this level. (This level included) -
requires_not_level=int
The hero must not have this level or above (This level is included)
An event can deal damage to the hero, this is done via:
-
power=int
a valid power to be used. The starting position of the power is the event position, but can be modified by power_path. The destination is also the event position, but can also be changed by power_path. -
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
The following event components will affect the situation of the hero:
-
set_status=string
This adds the specified string to the save file of the hero. -
unset_status=string
This removes the specified string from the save file of the hero. -
intermap=string, int, int
This warps the player to another map defined by the first string. The position on that map is specified by the integers as (x,y) -
intramap=int, int
This warps the player to another position on the same map. Positition is given as (x,y) in tile coordinates. -
remove_item=int, ...
A list of item ids to be removed. Each item id will remove one item of that kind. -
reward_xp=int
Add the amount of experience to the heros experience.
Various event components:
mapmod
loot
npc
shakycam
msg
soundfx
music
spawn
cutscene