svg2aamap

Something else for Armagetron? Goody!
User avatar
dlh
Formerly That OS X Guy
Posts: 2035
Joined: Fri Jan 02, 2004 12:05 am
Contact:

svg2aamap

Post by dlh »

= svg<->aamap

== What?

svg<->aamap takes a SVG file and converts it to an Armagetron Advanced map file. This allows you to draw your map in a vector drawing program, such as Adobe Illustrator or Inkscape.

== Usage

=== Zones

To create zones you must put them in their own layer/group. The groups should be named “Win-zones”, “Death-zones”, or “Fortress-zones”. You should use the element “circle”. You may use groups in these layers.

=== Walls

Any shape that is not in a zones group will be converted into a AA Wall element. The supported SVG elements are:

* line
* rect
* polyline
* polygon

== What's Next?

* aamap2svg
* Spawn points? Arrows?
* circles converted to wall
* ellipse http://www.w3.org/TR/2003/REC-SVG11-200 ... pseElement
* path http://www.w3.org/TR/2003/REC-SVG11-20030114/paths.html
* Web version
* Move to SVN?

== Dependencies

* Ruby 1.8

http://generalconsumption.org/armagetro ... ap-0.1.zip
Attachments
blah-1.aamap.xml
An example.
(8.96 KiB) Downloaded 481 times
No spawn points.
No spawn points.
The map in Illustrator.
The map in Illustrator.
Last edited by dlh on Wed Oct 11, 2006 9:40 pm, edited 1 time in total.
User avatar
dlh
Formerly That OS X Guy
Posts: 2035
Joined: Fri Jan 02, 2004 12:05 am
Contact:

Post by dlh »

I've taken a look at SVG created by Inkscape, and it uses the “path” tag for shapes, which I will have to implement for this to be usable outside of Illustrator (not all of it at once, just basic stuff first). It also doesn't set the id attribute for “g” tags, instead opting to extend SVG with its own attribute.

Looking back, SVG would be a better base for our map format, and we could extend it to support new features.
User avatar
philippeqc
Long Poster - Project Developer - Sage
Posts: 1526
Joined: Mon Jul 12, 2004 8:55 am
Location: Stockholm
Contact:

Post by philippeqc »

nemostultae wrote:Looking back, SVG would be a better base for our map format, and we could extend it to support new features.
Talking converting to SVG, what would be the gain(s)? I guess that editing tools would be one, but I'm not that well versed in SVG. Also, what would be the cost beside a new "format" and a new parser?

-ph
Canis meus id comedit.
User avatar
Z-Man
God & Project Admin
Posts: 11585
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

We've been discussing this before; my feeling was that svg, being purely 2d, won't get us the semi-3d stuff we're going to need some time, and assigning spawn points and stuff could be awkward. svg editors may not respect our possible additions and delete them.

What we could do at zero loss and potential big gain is to allow references to svg files for geometry from within the map file. The map could say "Give me a wall; the geometry of the wall is to be taken from this layer of this svg file. Oh, and please transform the brightness of the lines into wall height." Then we wouldn't be restricted by svg's constraints.
User avatar
dlh
Formerly That OS X Guy
Posts: 2035
Joined: Fri Jan 02, 2004 12:05 am
Contact:

Post by dlh »

This version works better with Inkscape (be sure to choose Plain SVG in the save window). It parses <path> elements. There is still a bug with closepaths, so it doesn't work 100% yet.

Edit: Now in SVN @ tools/svg2map
Attachments
svg2aamap-0.2.zip
(12.24 KiB) Downloaded 619 times
User avatar
wrtlprnft
Reverse Outside Corner Grinder
Posts: 1679
Joined: Wed Jan 04, 2006 4:42 am
Location: 0x08048000
Contact:

Post by wrtlprnft »

Committed some fun stuff to SVN :)

It can now convert paths, as long as they only consist of the commands M, m, l, L, C, S and z, don't have m or M commands in the middle and don't use a too crazy syntax (omitting separators where they aren't strictly needed breaks the script).

A quick example featuring my great drawing skills (or not):
Attachments
weird.aamap.xml
the map
(14.32 KiB) Downloaded 427 times
the preview
the preview
There's no place like ::1
User avatar
dlh
Formerly That OS X Guy
Posts: 2035
Joined: Fri Jan 02, 2004 12:05 am
Contact:

Post by dlh »

Nice job wrtlprnft. I'll put up a web version later.

I added the circle and ellipse elements. We just need to add the A and a path commands and we'll have a pretty good range of SVG supported.

Edit: web version @ http://generalconsumption.org/armagetronad/svg2aamap/
User avatar
Z-Man
God & Project Admin
Posts: 11585
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

Looks groovy :)
User avatar
ed
Match Winner
Posts: 613
Joined: Mon Feb 13, 2006 12:34 pm
Location: UK

Post by ed »

It is. Very Groovy.
I'm trying to learn Inkscape now. It seems to give me all the map making features I've always wanted from Armabell. Just very fiddly, whenever I've dabbled with vector programs I've always found them fiddly.
Useful things I've found for map making-
Go to Document properies, Grid, tick them all.
set the x and y spacing to about 25px (or less depending on map intricacy).
on page, set the canvas size to 500x500 this is the same as normal fortress, so will give you a guide to how large your map will be.
With this it's very easy to make any 4/8 axes map.
Thanks.
User avatar
kyle
Reverse Outside Corner Grinder
Posts: 1876
Joined: Thu Jun 08, 2006 3:33 pm
Location: Indiana, USA, Earth, Milky Way Galaxy, Universe, Multiverse
Contact:

Post by kyle »

I like it too; still trying to learn Inkscape.
It will be real easy to make maps now.
a lot better than armabel
i'm still going to try to make a JAVA program later on though.
User avatar
kyle
Reverse Outside Corner Grinder
Posts: 1876
Joined: Thu Jun 08, 2006 3:33 pm
Location: Indiana, USA, Earth, Milky Way Galaxy, Universe, Multiverse
Contact:

Post by kyle »

I tried the Fortress-zones layer and it just made them walls for some reason.

any reason that you know of why this happened

I'm using Inkscape and used circles
I would post my SVG file but i can't here
User avatar
dlh
Formerly That OS X Guy
Posts: 2035
Joined: Fri Jan 02, 2004 12:05 am
Contact:

Post by dlh »

-ct-kyle wrote:I tried the Fortress-zones layer and it just made them walls for some reason.

any reason that you know of why this happened

I'm using Inkscape and used circles
I would post my SVG file but i can't here
Right now the zones layers only look for SVG circle elements. Inkscape outputs circles as SVG path elements. I'll try to get a fix in for that. I think inkscape does something weird with groups, too.
User avatar
kyle
Reverse Outside Corner Grinder
Posts: 1876
Joined: Thu Jun 08, 2006 3:33 pm
Location: Indiana, USA, Earth, Milky Way Galaxy, Universe, Multiverse
Contact:

Post by kyle »

it does a lot of weird stuff.
it does not even draw everything correctly.

it dose not print from the Fortress-zone layer.
also does not have everything centered like i had it
i tried both export methods
Attachments
sawblade2.zip
here are all my files
(8.46 KiB) Downloaded 538 times
User avatar
wrtlprnft
Reverse Outside Corner Grinder
Posts: 1679
Joined: Wed Jan 04, 2006 4:42 am
Location: 0x08048000
Contact:

Post by wrtlprnft »

Note that the SVG implementation is far from complete. You'll especially notice that when you use the select tool (F1) to move, rotate and skew things around. This adds translate commands to the SVG, which aren't implemented. I'm currently reading the specs and hope that i can implement it soon :)

For now, never move things with that tool. Instead, go to the edit path tool and drag those handles around.
There's no place like ::1
User avatar
ed
Match Winner
Posts: 613
Joined: Mon Feb 13, 2006 12:34 pm
Location: UK

Post by ed »

Can I ask why all x values are + and all y values are - ?
It makes it very difficult to add spawn points later.
I can look at the image in Inkscape and see I want to later put a spawn point at x=80, y=160 for example.
But this would be in xml x=x y=(max y val - (max y val * 2))-y
or something. All I know is that it's a pain to add multiple spawn/zones afterwards. It kind of limits me to symmetrical maps where I can just y = -y.
But that messes up angles as the whole thing is flipped.
I guess I could just to a search on "y=\"-" and replace with "y=\"", but then the map must be symmetrical to be any good to me later.
Waffling now.

edit: another option is to build the map, work out the desired spawn cordinates in Inkscape, flip the map horizontically in Inkscape before you save it.
Then convert to xml, remove all the "-"'s.
Then you have your map correct with positive values as it was first built.
edit: this doesn't work properly either. Like Kyle said, it has flaws. Still a good tool, but involves extra work. I'm able to map maps now I could never before.


Anyway, great apps. I appreciate the new tools, but if you could take a look at this, it would be great.
Or some way to represent spawn points with angles would work too.
Last edited by ed on Thu Oct 12, 2006 3:39 pm, edited 1 time in total.
Post Reply