1 (edited by PatrykP 2019-02-06 01:56:07)

Topic: [TOOLS] Automapper rules update tool

Hi
I created simple tool to update automapper .rules files.

from this (Teeworlds 0.6):

[Default]
Index 1

#top
Index 16
Pos 0 -1 EMPTY

#right
Index 21
Pos 1 0 EMPTY

This tool make this (Teeworlds 0.7):

{"tileset": [
    {"grass":
        {
            "basetile": 1,

            "rules": [
            {
                "index": 16,
                "condition": [
                    {"x": 0, "y": -1, "value": "empty"},
                ],
            },
            {
                "index": 21,
                "condition": [
                    {"x": 1, "y": 0, "value": "empty"},
                ],
            }]
        }
    }]
}
Download

Download (require java 8 or newer):
https://github.com/Patrykas1000/Automap … tag/v0.1.1

Source code:
https://github.com/Patrykas1000/Automapper-Rules-Editor

Usage:

linux:
./rules_update_tool.sh file1.rules file2.rules file3.rules

windos:
./rules_update_tool.bat  file1.rules file2.rules file3.rules

alt. linux and windows:
java -jar rules_update_tool.jar file1.rules file2.rules file3.rules

I tested this on very simple tile set (included in source code): ddnet_walls
About functions:
Works:

  • One tileset in file

  • Conditions x, y, value (only "EMPTY" and "FULL")

  • hflip, vflip

  • Comments (line start with "#")

Not tested:

  • Rotation

I need your help

In old .rules files i found this:

Pos -1 0 NOTINDEX -1

How to implement "NOTINDEX" in .json

From ddnet:

[DDNet]
Index 0
Pos 0 0 INDEX 33 OR 33 XFLIP OR 33 YFLIP OR 33 XFLIP YFLIP

NewRun

Index 1

Index 2
Pos 0 -1 EMPTY
Pos 0 1 FULL
Pos 1 0 EMPTY
Pos 1 -1 EMPTY

What is "NewRun" and how to implement it to .json
also what to do with "or"?
Maybe this functions are from ddnet editor. It will be great if anyone explain this ;)

2

Re: [TOOLS] Automapper rules update tool

Oooh, thanks for your contribution! That should help port whatever rulesets were made for the 0.6 automapper (unfortunately I haven't seen too many here).

The rules you haven't been able to port aren't in Teeworlds. It seems like the ddnet guys have implemented a few more features but didn't PR, so it's not in the JSON format.

Not Luck, Just Magic.

3

Re: [TOOLS] Automapper rules update tool

I updated tool (to v0.1.1) now Index in Pos condition (eg. "Pos 0 0 Index 1") is supported and i fix small bug. Also Random parameter works correctly :D
Thanks Dune for help :D

Maybe today or tomorrow i will start writing rules editor ;)