From The Mana World
Line 85: Line 85:
==explanation of the file, describing the rules==
==explanation of the file, describing the rules==


In this section we will have a closer look to the rules:
In this section we will have a closer look to the Layers of the file '''Rules_cave_002.tmx''':
[[Image:
[[Image:Rule_cave_002_ruleregions.png‎|left|frame|This is the '''RuleRegions''' Layer. We can see there are 4 rules defined within this file. (There are four coherent Regions). In the other Layers we can see how the rules are setup.]]
 
[[Image:Rule_cave_002_ruleset.png‎|center|frame|This is the '''RuleSet''' Layer. Any Tiles outside the Regions defined by the '''RuleRegions''' Layer will be ignored. This Layer describes which condition must be matched, to apply the specific rule:  
For the most left rule: There must be a black RuleTile north of a Red RuleTile. (The conditions tiles do not fill the whole RuleRegion; that is allowed as well)]]
 
[[Image:Rule_cave_002_ground.png‎|frame|Here we see, where tiles will be placed within the Ground Layer.]]
[[Image:Rule_cave_002_over.png‎|frame|Here we see, where tiles will be placed within the Over Layer.]]
[[Image:Rule_cave_002_collision.png‎|frame|Here we see, where tiles will be placed within the Collision Layer.]]
 


C - F describe layers of a rules file.
C - F describe layers of a rules file.
Line 92: Line 100:
For better understanding here below each other.  
For better understanding here below each other.  


C: Layer "rule_boxes" describes where the rule will be defined.
D:  
 
D: describes which condition must be matched
(so whenever there are these 2 black tiles and then there is a red tile this rule is applied.)
(so whenever there are these 2 black tiles and then there is a red tile this rule is applied.)



Revision as of 14:10, 21 September 2010

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?

how to use it?

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.

setup rules.txt

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

Check if there is such an file. If not put something like this: 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.

setup 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:

structure of rules files

Lets have some theory first:

These rules files need this structure: These Tilelayers are needed:

- "ruleRegions"
In this layer you define regions, where the rules are found.
One coherent region describes one rule.
It does not matter which tiles are used for describing where the region is.
(decision is boolean: either there are tiles or not)
- "ruleSet"
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.


working on your map

have fun with the automapping feature

Example of rules: Rule_cave_002

some pictures

File:Example cave.png‎
This is what you might want to have. The lower border is in the Over-layer of course, The rest of the walls are in Ground-layer. The walls are unwalkable: The collision Layer must be set properly.
File:Example cave set.png‎
This is what you have to draw with automapping feature. All in one Layer, the special "Set" layer. and of course you need the proper rules.
After the very first rules we have the Ground set.
After the next rules we have the standard straight walls. You can see that the position, where the lower wall is, is touched again: There was already a Ground tile in Groundlayer, now there is added a wall tile in the Over Layer.



explanation of the file, describing the rules

In this section we will have a closer look to the Layers of the file Rules_cave_002.tmx:

File:Rule cave 002 ruleregions.png‎
This is the RuleRegions Layer. We can see there are 4 rules defined within this file. (There are four coherent Regions). In the other Layers we can see how the rules are setup.
File:Rule cave 002 ruleset.png‎
This is the RuleSet Layer. Any Tiles outside the Regions defined by the RuleRegions Layer will be ignored. This Layer describes which condition must be matched, to apply the specific rule: For the most left rule: There must be a black RuleTile north of a Red RuleTile. (The conditions tiles do not fill the whole RuleRegion; that is allowed as well)
File:Rule cave 002 ground.png‎
Here we see, where tiles will be placed within the Ground Layer.
File:Rule cave 002 over.png‎
Here we see, where tiles will be placed within the Over Layer.
File:Rule cave 002 collision.png‎
Here we see, where tiles will be placed within the Collision Layer.


C - F describe layers of a rules file. These tiles are directly above each other in the tmx file. For better understanding here below each other.

D: (so whenever there are these 2 black tiles and then there is a red tile this rule is applied.)

E: is the "rule__Ground" layer, which means that such an leftwall-tile will be setup in the Ground-layer, when this rule is applied.

F: is the "rule__collision" layer which makes the wall unwalkable.


It would be enough to use only a 2x1 condition, but this works too of course.