1 (edited by Dune 2018-12-31 02:51:17)

Topic: [MAPPING] How to set up your own rules for automapper [OUTDATED]

Refreshed images. // Dune

Hey lil Teeworlds community,
cuz I got kind of bored I decided to write down a little tutorial about how to get that stuff about the automapper running.
As far as I got to know out of the base rules of the automapper I will try to explain in the best possible way.

First of all you guys will get to know the basic of how think when writing down such rules.

The following picture will discribe how it works in teeworlds, as you may see, the y-axis is kind of different, so keep that always in mind while writing your "rules".


Tutorial image - click here
https://i.imgur.com/r1ib7IF.png


As you may already see, you begin to count the "Index" at 0 0.


At the beginning you have to decide which tile will become the basetile of the whole map.As you already know the basetile from grass_main.png is the "dirt" tile.

Index 1
BaseTile

At first you have to decide which "tiles" or as other people may call it "mapres" you wanna set.
For example we want to get a normal ground tile with the "Index 16" as you may see on the upper picture.

The ground tile with the Index 16 needs some special conditions to get set on the right place.
for this Tile it is kind of easy:

- you need nothing to be above it

This would be the easiest way to set some easy conditions but as of complexity of maps as you may know there will be always errors if you write down way too easy rules.

- you need the basetile to be under the ground tile (16)
As of the easy example given by the devs you can see, that there are no Basetiles defined below the "top" or just ground tiles.

#top
Index 16
Pos 0 -1 EMPTY

This rule defines that there has to be one empty tile above the tile with the Index 16 for it to be placed.
Meaning: If there is no empty tile above, this ground or top tile won't be set by the automapper.

I would prefer a little bit different function for this rule.
as shown here:

#top
Index 16
Pos 0 -1 EMPTY
Pos 0 1 FULL

I adds the requirement 'to have ONE tile under it' to be set by the automapper

You may have noticed, if you read the rule files, that there are most likely before each of this "Index rules"
headers like

#top

I am not shure whether it is there to divide the rules from each other but i think commenting the rules in your fule files wouldn't be bad. So don't be lazy and get your rules a header.


Now I am going to explain will the rules I have found in the base *.rule files made by the devs.

[Grass]
......
[Cave]

Here I am taking the grass_main.rule file as an example.
In one rule file you are able to have more than one block of rules.
Reasons could be:
- you ave got more than only one BaseTile
Here it would be the gras main BaseTile and also the Cave one's BaseTile, which explains why there are two catigories of rules in this file.

#Header of any kind of rule

..already explained


Now i think the following "command" or rather "requirement" for tiles to be set by the automapper is:

Pos

If you want a tile to be set, you need to have a "Position" to have a given kind of properties like:

You want Index "x" only to be set if there are at least four tiles next to it, also one above, one beneath, one left and one right from it, so you define the rule like this:

#Header of your rule
Index "x"
Pos 1 0  <-- one right from it
Pos -1 0 <-- one left from it
Pos 0 1 <-- one beneath
Pos 0 -1 <-- and one above Index "x"

Please do not forget that your defined Index "x" has the Pos(ition) 0 0, so you begin to count from 0 0 to get your needed positions to be filled by any kind of tiles

The next step is to define what tiles have to be on that positions that defines the position of your Index "x" tile.
So you have your Index "x" and you just want to have any kind of tile next to it, so you define it like shown:

#Header of your rule
Index "x"
Pos 1 0 FULL
Pos -1 0 FULL
Pos 0 1 FULL
Pos 0 -1 FULL

The property "FULL" expresses that the given position just hast to have any kind of tile.
Because the whole rules script is case sensitive, you have to write ALL of the commands as shown in the dev's base rule files. And please do not forget to set one space between the y-coordinate and the property of the position.

Next property of the Pos command is:

EMPTY

It is the same as FULL but as you may already know the given position has to be EMPTY for the Index "x" tile to be set.

Index "whatever"

Index "..." can also be a property of the Pos command.
It would be written like this:

Index "x"
Pos 1 0 Index "whatever" <-- Pos: one to the right has to be Index "whatever"
                              for this tile to be set by the automapper.

It's kind of bad for complex maps WITHOUT the following properties of Pos, cuz they do not exist there are some functions missing.

DO NOT COPY CUZ THEY DO NOT EXIST:

Pos 1 1 Index "y" XFLIP
Pos 1 1 Index "y" YFLIP
Pos 1 1 Index "y" XYFLIP

This ideas could be some improvements for the automapper.


As well as the Pos command the Index command has some special properies:

Index "x" XFLIP

With this property the tile "x" is set after one horizontal flip.

There is also the property:

Index "x" YFLIP

With this property the tile "x" is set after one vertical flip.



As far as I read the rule files, the following command should be the last one.
It's called:

Random "***"

As you may know the meaning of the word "random" you can already say what kind of command this is.
As far as I know and as far as I experienced it sets the Index "x" tile after the "***" count of BaseTiles onto a random spot.
For example you want to set the bones randomly on the map:

#random bones
Index 2
Pos 0 1 FULL
Pos 0 -1 FULL
Pos 1 0 FULL
Pos -1 0 FULL
Random 150

I think this would mean, that the Bones (Index 2) are set by the automapper after 150 positions that comply with the given requirements of the rule(Pos x y .....)


One little rule as a highlight of this tutorial smile

#random tee-skeletons
Index 64
Pos 1 0 FULL
Pos 2 0 FULL 
Pos -1 0 FULL
Pos 2 2 FULL
Pos 2 -1 FULL
Pos -1 2 FULL
Random 100
#---------
Index 65
Pos -1 0 INDEX 64
#---------
Index 80
Pos 0 -1 INDEX 64
#---------
Index 81
Pos -1 -1 INDEX 64
#---------


Hope you liked it and understood it quite well.
If there are any questions or complaints about this tutorial, please feel free to post them so I can improve this tutorial.

Teeworlds [ friends ] clan
Some YouTube Stuff about Teeworlds

2

Re: [MAPPING] How to set up your own rules for automapper [OUTDATED]

Thanks a lot for your efforts! --> moved to tutorial section

Antoine de Saint Exupéry: It seems that perfection is reached not when there is nothing left to add, but when there is nothing left to take away.
Besides -  I am the gfx guy!

3

Re: [MAPPING] How to set up your own rules for automapper [OUTDATED]

np dude... i like this game quite much, so I wanna be of any kind of help to this community :3

Teeworlds [ friends ] clan
Some YouTube Stuff about Teeworlds

4

Re: [MAPPING] How to set up your own rules for automapper [OUTDATED]

What a pitty you did it on the old version! It's been completely reworked in the meanwhile, it's now using XML...

Not Luck, Just Magic.

5

Re: [MAPPING] How to set up your own rules for automapper [OUTDATED]

-.- xD fuck....

Teeworlds [ friends ] clan
Some YouTube Stuff about Teeworlds

6

Re: [MAPPING] How to set up your own rules for automapper [OUTDATED]

Dune wrote:

What a pitty you did it on the old version! It's been completely reworked in the meanwhile, it's now using XML...

There is a pull request for that, but Oy has some concerns about the xml style. Uhmmm I do not know any further details...

Antoine de Saint Exupéry: It seems that perfection is reached not when there is nothing left to add, but when there is nothing left to take away.
Besides -  I am the gfx guy!

7

Re: [MAPPING] How to set up your own rules for automapper [OUTDATED]

Landil wrote:
Dune wrote:

What a pitty you did it on the old version! It's been completely reworked in the meanwhile, it's now using XML...

There is a pull request for that, but Oy has some concerns about the xml style. Uhmmm I do not know any further details...

oO

What's wrong with XML?

8 (edited by Dune 2011-12-13 20:19:44)

Re: [MAPPING] How to set up your own rules for automapper [OUTDATED]

XML is so much easier to read & create, and Lord fixed all the issues in the pull request. Would be nice when it wouldn't take months to accept the only pull requests that implement actually big improvements. It's not like Lord would be payed for it...

Not Luck, Just Magic.

9

Re: [MAPPING] How to set up your own rules for automapper [OUTDATED]

i think it may be easier to read and more understandable, but it takes way too much time to create a complex rule file... i think it should be possible do add the improvements into the rule files an not as xml..... my opinion smile

Teeworlds [ friends ] clan
Some YouTube Stuff about Teeworlds

10

Re: [MAPPING] How to set up your own rules for automapper [OUTDATED]

jxsl13 wrote:

i think it may be easier to read and more understandable, but it takes way too much time to create a complex rule file... i think it should be possible do add the improvements into the rule files an not as xml..... my opinion smile

I think autocompletion would fix the time issue.

11 (edited by Dune 2011-12-14 18:39:43)

Re: [MAPPING] How to set up your own rules for automapper [OUTDATED]

These rule files have to be clean, and XML is definitely the text format for that kind of stuff.
Besides, would you rather have "F" instead of FULL and "I" instead of Index just because it's shorter and you have to write these often? Don't just be afraid of change.

Not Luck, Just Magic.

12

Re: [MAPPING] How to set up your own rules for automapper [OUTDATED]

Congrationalites by your topic big_smile

Playing Teeworlds since 2011!
"I will always be topless for you"
                  - Günther Branlutte

13

Re: [MAPPING] How to set up your own rules for automapper [OUTDATED]

heinrich wrote:

I think autocompletion would fix the time issue.

Well maybe,it's only a minimal speed boost.

I'm with Dune on this one. You just need a little time to get used to XML that's all smile

Once in a century...