ProtoRPG:Map file

Jump to: navigation, search

A map file describes the world the player is moving in. All map files are text files that must be located in the maps subdirectory.

Contents

Structure

{	name: "mapname.txt",
	title: "Map title",
	wrap: false,
	defaultExit: ['world.txt',10,10],
	defaultTile: 5,
	tileset: 'default.txt',
	mustSave: ['items'],
	population: [ // Population (NPC)
		],
	monsters: [ { name: "rats", density: 0.009, habitat: [3,5] } ],
	items:	[ { name: 'barrel', x: 24, y: 2, content: [ { name: 'whitePotion', qty: 1 } ] },		{ name: 'whitePotion', x: 15, y: 12, qty: 2 }
		],
	bitmap: [ // Bitmap
		]
}

name

This must be the map own file name, as used in all other files and values. If maps are organized in subdirectories, this must include the subdirectory as well (i.e. dungeons/doom.txt).

wrap

If wrap is set to true, the map will wrap arround (as if the player is moving on a ball or planet)

defaultExit

This property is only useful for non-wraping maps, and defines where the player go when he goes beyond the map limits. For this to work, a defaultTile must also be set.

The propery must be an array with the destination map name and X & Y coordinate.

defaultTile

For non-wraping maps, this is the tile to draw when showing "beyond the map". If not present, black (and blocking) tiles will be displayed.

tileset

Name of the tileset file to use.

mustSave

This property can list the elements to preserve in the player savegame. It is an array that can hold one or several of the following string values :

population

This property must be an array containing the description for all NPC on the map (except random monsters).

monsters

This is an array listing the possible random monsters showing up on the map. Each type of monster must be an object listing the monster name (a reference to the monsters file), the density (frequency per tile) and the habitat (tile or tiles where the monster can be spawned).

items

This array list all the items that are on the map. Each item is an object with its name (a reference to the items file), position on the map, quantity (1 by default) and, if it's a container, an optional list of items within.

bitmap

This is the map itself, a 2D array (an array of arrays) describing which tile occupy which position. ProtoRPG allow multiple tiles to be drawned and stacked on top of each other (which is useful combined with partially transparent tiles). In this case instead of being a number, the tile is described as an array of tile (stacked in order of appearance)