Map format

From CatchChallenger wiki
Jump to: navigation, search

Base format

Map format: tmx

Editor:

Screenshot-map-editor.png

tmx map editor (see lib tiled): http://www.mapeditor.org/

Support into the server: xml with pre-calculate the collision/water zone

Support into the client: lib tiled for QGraphicView or QML

The spawn point is useless, when map change, your are teleported at the middle. If you are blocked ask to the administrator, command to random teleport to low level village will be implanted too.

Mapper, map developer

  • Prefer tiled map as random placement (square tree better than random planted tree): better compression ratio, less direction change, leave empty the layer zone hidden by other top layer
  • Do the map to the player change direction after 64 tiles, no right line to walk more of 64 tile.
  • Prefer map <64x64 but prefer unique map for same elements: example: if you have a big city into more than 64x64 don't split it, never do more than 255x255

Map content

General properties

Why not all into the xml? To minise the number of file.

  • type: indoor, outdoor, cave, and into the map/music.xml:
<list>
	<!-- can be overwriten into the map.xml, keep empty if nothing -->
	<map type="city">music/city.ogg</map>
	<map type="indoor">music/indoor.ogg</map>
	<map type="outdoor">music/outdoor.ogg</map>
</list>
  • ambiance: the ambiance name (define step sound, background sound, ...)
  • zone: the zone name (found into zone folder with [name].xml)

The 0,0 is at left and top for this protocol.

Xml file

<map type="outdoor" backgroundsound="toto.ogg" zone="test">
       <name lang="en">English name</name>
       <name lang="fr">Nom français</name>
       <grass>
              <monster id="1" minLevel="3" maxLevel="4" luck="20" />
              <monster id="2" level="2" luck="80" />
       </grass>
</map>

the balise grass can be wather, cave.

Layer

  • WalkBehind: do player image behind this layer
  • Collisions: the player have collision with this layer
  • Water: The player have collision with this layer, but can swim it
  • Walkable: Can walk on this layer, this the bottom layer
  • LedgesRight: border to jump, the player will jump left to right
  • LedgesLeft: border to jump, the player will jump right to left
  • LedgesBottom: border to jump, the player will jump up to down
  • LedgesTop: border to jump, the player will jump up to top
  • Grass: grass, where have random chance to find a monster
  • Dirt: dirt where plant can grow

Object

It's on layer Object with name: "Object", Name: what you want

[bot]

  • Type: bot
  • file: Xml script, see: Bot format
  • id: the id into the bot file
  • lookAt: left, right, top, bottom, random, loop, move (optional, need skin)
  • skin: you skin name (optional)
  • fightRange: fight range if the step 1 is fight (optional)

[object]

  • item: item id
  • visible: true or false (default: true)
  • infinite: true or false (default: false)

Teleportation

It's layer Object with name "Moving", only visible on map editor.

  • Warning: For the protocol, it's like you walk over the teleport tile, but if you continue to press the key, not send interruption (keep last direction = before distance + after distance). If you do 3 step down before pass a door, and 2 step down after, the client send 5 step down (the server calculate the tp).
  • Note: If you are tp on a teleporter, this tp do nothing, you need quit and re-go on it to activate it. Usage of if (not while), to improve the performance, and have more flexible game.
  • File name of the map can be without .tmx at the end to gain space

[teleport on push]

  • Type: teleport on push
  • map: [file name]
  • x: coordinates in x
  • y: coordinates in y

[teleport on it]

  • Type: teleport on it (when the player is fully on it)
  • map: [file name]
  • x: coordinates in x
  • y: coordinates in y

[border]

  • Type: border-top, border-bottom, border-left, border-right
  • map: [file name]
  • Need correspond with the other border on the corresponding map

[door]

  • Type: door
  • map: [file name]
  • x: coordinates in x
  • y: coordinates in y

[rescue]

  • Type: set the point to respawn if the monsters at the next heal.

Conditionnal teleportation

This apply on: teleport on push, teleport on it, door

Just add the properties:

  • condition-file: path relative to the map
  • condition-id: id

Condition file:

<conditions>
	<condition id="1" type="quest" quest="1">
		<blockedtext><![CDATA[You have not done the quest <b>The beginner's rod</b>]]></blockedtext>
	</condition>
	<condition id="2" type="item" item="1">
		<blockedtext><![CDATA[You have not an <b>Potion</b> to open the door]]></blockedtext>
	</condition>
	<condition id="3" type="clan"><!--if the clan have captured the area-->
		<blockedtext><![CDATA[Your clan don't own the area]]></blockedtext>
	</condition>
	<condition id="4" type="fightBot" fightBot="1">
		<blockedtext><![CDATA[You have don't win agains the first bot]]></blockedtext>
	</condition>
</conditions>

Animation

  • The animation apply on an tile, to have it define properties with name: animation and value: 500ms;4frames (where 500 and 4 is an exemple).
  • To have offset to don't start the animation at same frame each time: name: animation and value: 500ms;4frames;random-offset

Trigger

start is when start enter on it. leave is when start leave on it. again is loop played when enter it but not firstly, mean the final state after leave it is not the first tile. over mean on the second line you have tile to display over the player.

  • name: trigger and value: start:60ms;3frames;leave:60ms;3frames;again:60ms;2frames
  • name: trigger and value: start:60ms;3frames;leave:60ms;2frames;over

Guide line

http://www.gnu.org/licenses/fdl.html from https://www.themanaworld.org/index.php/Dev:Mapping_Tutorial

Bad mapping style
Good mapping style, better compression, more clear border, more easy to clone and edit to do another map

Todo

  • Multiple walking plan (to support bridge over water, and able to cross over wather o over bridge)
  • Single tile border blocking

Compare

The map element is visual (not defined via ini x,y), only the data which need be organised as tree is into external xml to prevent long unclear line, monster format is cleaner and more flexible, same content for server and client with translation integrated
The maps are ordered into directory, with clear name, and grouped (all floor of big building is into sub folder)

Note: Pokemium/pokenet seam have <100k line of code and CatchChallenger have >400k line of code