Zum Hauptinhalt springen

[TOC]

GMCP Tilemap

The purpose of this package is to allow MU* servers to control coordinate based maps. It is inspired from the beip.tilemap (link) package, but adds features to work with multiple tilesets per map, layering and options to choose tileset resolutions.

tilemap.tilesets

With this command the server informs the client about all tilesets available and assigns identifiers to reference them in later commands. Tilesets may come in different resolutions - the client is free to pick the one suited best.

tilemap.tilesets {
"terrain": {
url: "http://.../SmallTiles.png",
sizeX: 32,
sizeY: 32,
anim: {
"50": 4,
"54": 4
}
},
"monster": {
url: "https://...",
sizeX: 32,
sizeY: 32,
anim: {
"0": "4",
"4": "4"
}
}
}
}

Each tileset is named and the name is later used to reference it from other commands. Also tilesets may come with different tile sizes: 8, 16 or 32 - refererring to the width and height of a single tile.

  • size - Width x Height

  • url - URL where to download the tileset

  • anim-frames - Those tiles that are animated, are referenced by their number and have the number of animation frames assigned.

    [!IMPORTANT]

    Tiles not listed in anim-frames are considered to consist of only 1 frame, meaning that they are not animated.

    A client not supporting animation can just ignore animation frames.

tilemap.area

This command tells the client to prepare one or more areas that should show tilemaps. Each area can make use of all tilesets that have been uploaded by tilemap.tilesets before. If the tilesets are provided in multiple resolutions, it is up to the client to pick the one used - e.g. because the user chooses a resolution or because of the screen size.

tilemap.area {
"World Map": {
"map-size": "21x21",
"encoding": "Hex_8",
"tilesets": {
"terrain": "0",
"monster": "128"
}
},
"Surrounding": {
"map-size": "11x11",
"encoding": "Hex_16",
"tilesets": {
"terrain": "0",
"objects": "128",
"monster": "256"
}
}
}

For each defined area, there is a map-size, telling the client how many tiles wide and high the area will be - and an encoding to tell the client how many hexadecimal digits each tile number will have. Valid values are Hex_8, Hex_16 and Hex_24 for 8, 16 or 24 bit / resp. 1,2 or 3 digits.

To prepare the interpretation of the tile number, the tilesets element tells the client, from which tileset a tile must be taken. E.g. in the "Surrounding" example above, a tile number of 160 would be the 32. tile in the "objects" tileset.

tilemap.data

This command will be send for each update in the map. The identifier tells which area is updated. For each area there are one or more layers given. Drawing should start with the layer with the lowest number and then processed ascending. For each layer, there are all tile numbers for the whole map expected. E.g. if a map is 11x11 tiles large and have a HEX_24 encoding, each layer must contain 11x11x3 = 363 hexadecimal digits.

tilemap.data {
"Surrounding": {
"0": "<string of layer data, depending on encoding",
"1": "<string of layer data, depending on encoding"
}
}