5 howto build map
Big Bad Waffle edited this page 7 years ago

How to build a map

What you’ll need
  • The Tiled map editor
  • A text editor like Sublime Text, Atom or VS Code. Notepad could work too but let’s not make it harder for ourselves?
Prep
  • Create a new folder in server/config/maps. The folder should’t contain spaces and should ideally be your map name. For instance: plainsOfRuin.
  • Download the map blueprint from here. (Document not actually uploaded yet. For now, you can basically just copy one of the existing maps).
  • Extract the zipped archive into your new map folder. You should now have server/config/maps/{yourMap}/map.json.
The Map File

Open the map.json file in Tiled.

In the map file, there are two different layer types: Object layers and Tile layers. Object layers are for placing objects like: mobs, doors and room boundaries. Tile layers’ purpose should be fairly obvious.

Let’s have a quick rundown of what the different layers are for. First the object layers:

  • notices: Room names (these will pop up when you enter them)
  • clientObjects: Objects that aren’t tracked by the server but still have code behind them. For example: Candles (Have a light source component).
  • objects: Objects that are tracked by the server but aren’t mobs. For example: Portals (That move players between zones).
  • mobs: NPCs or enemies
  • hiddenRooms: Allows you to mark areas to be hidden until you enter them.
  • rooms: Misnamed at the moment. These are actually ‘mapping’ tiles. More on this later.

Now, the tile layers:

  • hiddenWalls: These wall tiles will be rendered over the relevant hiddenRoom. If these weren’t here, the hidden area would just be black, possibly giving players a very good indication that a hidden area is located there.
  • hiddenTiles: Exactly like hiddenWalls, except for tiles.
  • walls: A wall tile is any tile that causes the player to collide. It doesn’t have to be a wall or even a tree. It could be a regular ground tile too. Just remember that placing a tile in this layer would cause the player to not be able to walk there.
  • doodads: This layer does not cause collisions and is rendered brighter than the tile layer.
  • tiles: Regular tiles that don’t collide and are rendered fairly dim. Use this for all ground tiles like carpets, grass, dirt and water.

[I’ll write the rest of this section later]

The Zone File

An empty zone file looks like this:

module.exports = {
	resources: {

	},
	objects: {

	},
	mobs: {
	
	}
};

The different sections are:

  • resources: Used for herbs that should spawn in the zone.
  • mobs: Used for enemy mobs and NPCs.
  • objects: This is used for everything else. For instance: portals (to other zones), doors, light sources, dialogue triggers, or anything that emits particles.
Resources

The resources section is fairly straight-forward. Here’s an example:

resources: {
	Moonbell: {
		type: 'herb',
		max: 5
	}
}

The key (Moonbell) tells the game which type of herb should spawn. Options are:

  • Moonbell
  • Skyblossom
  • Emberleaf

The max variable defines how many nodes can be active at the same time.

Mobs

Besides definitions for specific mobs, any of these values can be defined for mobs in a default key:

mobs: {
	default: {
		level: 1,
		faction: 'gaekatla',
		walkDistance: 1,

		spells: [{
			type: 'melee',
			statMult: 0.1356
		}],

		regular: {
			hpMult: 1,
			dmgMult: 1,

			drops: {
				chance: 35,
				rolls: 1
			}
		},

		rare: {
			count: 1,
			chance: 1,

			hpMult: 1,
			dmgMult: 1,

			drops: {
				chance: 100,
				rolls: 1,
				magicFind: 75
			}
		},

		champion: {
			hpMult: 1,
			dmgMult: 1,

			drops: {
				chance: 100,
				rolls: 2,
				magicFind: 115
			}
		}
	}
}

Over and above that, you can also define a section that’s specific to your mob. As an example, let’s say you’ve got a mob named Brutus. His section could look like this:

mobs: {
	brutus: {
		level: 5,
		walkDistance: 0
	}
}

Note that the name has to be lower case here. If his name was Brutus the Defender you would use 'brutus the defender' as his key. From here you can customize Brutus further by allowing him to be a rare mob 20% of the time and giving him 3 chances to drop an item with each roll being a 50/50:

mobs: {
	brutus: {
		level: 5,
		walkDistance: 0,

		regular: {
			drops: {
				rolls: 3,
				chance: 50
			}
		},

		rare: {
			count: 1,
			chance: 20
		}
	}
}

Remember, drops are defined for regular, rare and champion. Just because we gave Brutus 3 drops, doesn’t mean he’ll drop 3 items if he’s rare, we need to define that separately. Alternatively, we can set it globally for the map too.