From The Mana World
Line 63: Line 63:
[[Media:Automapping_example_rules1.txt]]
[[Media:Automapping_example_rules1.txt]]


==setup the rules.tmx==
==structure the rules.tmx==
Now we need to make the rules with tiled and these rules need to be saved to the path given in the textfile of step 2.
Now we need to make the rules with tiled and these rules need to be saved to the path given in the textfile of step 2.


But first we need to identify these rules:
But first we need to identify these rules:


===structure of rules files===
===defining a rule===
Let us have some theory first:
There must be a TileLayer called '''ruleRegions'''.
In this layer you define regions, where the rules are found.


These Tilelayers are needed in rule-defining maps:
Each coherent region of the same tiles describe one rule.
- "ruleRegions"
 
In this layer you define regions, where the rules are found.
It does not matter which tiles are used for describing where the region is, but these tiles must be all the same.  
One coherent region describes one rule.
(decision is boolean: either there are tiles or not)
It does not matter which tiles are used for describing where the region is, but these tiles must be all the same.  
(decision is boolean: either there are tiles or not)
- "ruleSet"
===defining a precise condition===
A rule should only be applied to certain places in you map, where certain conditions are matched.
 
To define these conditions you can have '''ruleSet''' and '''ruleNotSet''' tile layers.
 
There can be multiple layers with the same name, so multiple layers of '''ruleSet''' and '''ruleNotSet''' are possible.
 
Basically in '''ruleSet''' you can put the tiles which have to be matched, that this rule condition gets matched.
 
In '''ruleNotSet''' you can put the tiles which must not occur, so that the rule condition is true.
 
  Here you put the information, which condition must be matched, that this rule is applied.
  Here you put the information, which condition must be matched, that this rule is applied.


Line 85: Line 94:
  In the "rule_XXX" layer you put the information how the terrain is  
  In the "rule_XXX" layer you put the information how the terrain is  
  in the usual XXX layer.
  in the usual XXX layer.


=examples=
=examples=
[[User:Argul/automapping/examplecave]]
[[User:Argul/automapping/examplecave]]

Revision as of 17:22, 24 October 2010

This feature is for experienced mappers, so if you are a beginner.... Do a map without automapping first, that helps you understanding what problems might occur, and what we are talking about in here.


What is the Automapping feature?

Guess you want to make a map, which looks this:

Automapping example cave 1.png

So you have an idea how the form of the cave is. Now you must create this map. How long does it take? maybe an hour?

With the automapping feature you just draw the outline of the cave which looks like this:

Automapping example cave 2.png

What are the advantages?

- just one layer to edit
- just draw what you mean there should be (cave in the middle with a little sea)
- no need for drawing and combining many tiles for the wall. This is done automatically

So this feature generates from the given draft the cave. How long does it take to make such an one-layer draft? 10 minutes?


Quickstart

- get a version of tiled, which supports automapping feature
- get this data here: User:Argul/automapping/data
- unzip that file.
- open example_cave.tmx in the maps folder.
- edit the set layer with the existing tileset as you want.
- click automap
- have fun

Theory behind the automapping feature

The automapping feature needs to know how the tiles have to be setup, to create such an cave-wall. So we got to create some rules how these walls are generated.

Create a new map

Create a new map. Save this map where ever you want. I suggest the tmwdata/maps folder of the "tmwdata" project from our Git repository.

the rules text file

Within the same folder of your map there needs to be a textfile "rules.txt", which contains pathes to actual rulefiles.

Example: Media:Automapping_example_rules.txt

Each line give a path to rules. This path can (should) be relative to the directory with rules.txt and your map. The rules will be applied in that order as in this file. So at first the rules in the very first line are applied. At last the very last line rules are applied.

You can also put another textfile again, which holds the actial rules Media:Automapping_example_rules1.txt

structure the rules.tmx

Now we need to make the rules with tiled and these rules need to be saved to the path given in the textfile of step 2.

But first we need to identify these rules:

defining a rule

There must be a TileLayer called ruleRegions. In this layer you define regions, where the rules are found.

Each coherent region of the same tiles describe one rule.

It does not matter which tiles are used for describing where the region is, but these tiles must be all the same. (decision is boolean: either there are tiles or not)

defining a precise condition

A rule should only be applied to certain places in you map, where certain conditions are matched.

To define these conditions you can have ruleSet and ruleNotSet tile layers.

There can be multiple layers with the same name, so multiple layers of ruleSet and ruleNotSet are possible.

Basically in ruleSet you can put the tiles which have to be matched, that this rule condition gets matched.

In ruleNotSet you can put the tiles which must not occur, so that the rule condition is true.

Here you put the information, which condition must be matched, that this rule is applied.
- layers describing the terrain in the rule.
These layers have the prefix "rule_"
In the "rule_XXX" layer you put the information how the terrain is 
in the usual XXX layer.

examples

User:Argul/automapping/examplecave