juzzlin / DustRacing2D

Dust Racing 2D is a traditional top-down car racing game including a level editor.
http://juzzlin.github.io/DustRacing2D/index.html
GNU General Public License v3.0
301 stars 67 forks source link

Human Readable Track Format #92

Open mtekman opened 4 years ago

mtekman commented 4 years ago

(this is a really cool game!)

I had some issues in the editor trying to rotate many tiles and thought I might fare better editing the trk format manually, but it turns out the trk format is in XML, and so doesn't convey the grid of columns and rows very well.

I was thinking that since you have a limited selection of tiles, and a fixed number of rotations, it could be possible for the user to box-drawing ASCII characters to draw tracks.

e.g

19 x 7 grid

 ┌──╮              
 ┆  │╭──┬───┬─▒──┐ 
 │  ╰╯  ╰───╯    │ 
 │     ╭─┄───────┘ 
 └┄────╯           

where the dotted lines indicate where racers should break, and you could use other ascii characters to integrate turf, wheels, and so on. A rotation of a tile will also need a unique ascii symbol.

Parsing this shouldn't be too tricky since it should be a 1:1 map.

Potential Issues:

juzzlin commented 4 years ago

This was my first idea if I remember correctly, but I found it too difficult to input the driving lines for AI and accurately place objects. Easy to create the tile map, but there's a lot more :)

When it comes to the rotation problem, the editor should be improved. I agree it's not optimal now.

juzzlin commented 4 years ago

One option would be to create a Python script that would translate an ASCII map to the XML-based track definition the game already understands.