Title: SVG-to-map converter: Use Inkscape as a map editor Post by: Chris on March 03, 2009, 09:13:08 am By request, here is my dodgy program for converting SVG files (vector graphics files, as edited by e.g. Inkscape (http://inkscape.org/)) to Mayhem Intergalactic map files. It's a command-line program, so you'll need to have some familiarity with cmd to use it.
The basic idea is that you create an SVG file with Inkscape, using circles to represent planets and straight lines to represent rifts. Save it and run it through this utility and you'll get a .ini file corresponding to that map. It'll warn you if you appear to have made separate groups of planets which can't be reached from each other. You can't set production values or starting priorities using this utility, so it's not a complete solution. After generating the basic layout you will usually have to go in and tweak it using Commotion or by hand. The attached zip file contains the command-line Windows executable. Source code is included, under the zlib licence. It should compile under Linux and Mac OS X too. I haven't really tested this much, so it's probably really buggy. That's why it's open-source (so you don't have to wait for me to fix things). ;D (Edit: Removed some unnecessary files from zip.) Title: Re: SVG-to-map converter: Use Inkscape as a map editor Post by: Kumlekar on March 04, 2009, 05:56:30 am I had a fun time looking through the code, but not knowing D, it was a bit confusing. How exactly does this work? Do I run the program from command prompt with the inkscape file as a parameter? Also, what do I use to make planets? I see the elicpse (spelling?) tool, but hitting shift with that just centers the elicpse on the mouse's starting point. You said that it take circles. Do they have to be a true circle?
EDIT: Figured it out (all questions above have been answered). A couple more questions though. Is the coordinate value for the planets determined from the center of the circle or from the edges? What do you use to compile the program? (I'd like to make a couple minor changes so that it works better with commotion) Either way, its nice having a graphical way of doing stuff rather than just numbers numbers and more numburz! Title: Re: SVG-to-map converter: Use Inkscape as a map editor Post by: Chris on March 04, 2009, 10:14:52 am Yes, you run it from the command line and feed it the name of an SVG input file, and an output filename:
svgtomap input.svg output.ini Ellipses work too, not just circles. It places the planet at the centre point of the ellipse/circle in either case. Compilation instructions are in the file: Quote * Written in the D programming language (http://www.digitalmars.com/d/) * Uses the XML library for D written by Miguel Ferreira Simoes. * * To compile, open up a command line and type: * > dmd svgtomap.d xml\XmlNode.d xml\XmlStream.d xml\XmlEntities.d xml\XmlException.d -ofsvgtomap.exe * * (You must first install the official D compiler, dmd.) In more detail, the steps are: 1. Visit http://www.digitalmars.com/d/1.0/dmd-windows.html 2. Download and install the compiler (it's just in a zip file, so extract it anywhere you like) 3. Open a command line, go into the directory containing svgtomap.d, and type: dmd svgtomap.d xml\XmlNode.d xml\XmlStream.d xml\XmlEntities.d xml\XmlException.d -ofsvgtomap.exe (dmd will need to be on your path, or alternatively you can replace "dmd" with the full path to dmd.exe) Be sure to post your changes so that everyone else can benefit. :) Title: Re: SVG-to-map converter: Use Inkscape as a map editor Post by: Kumlekar on March 05, 2009, 06:16:53 am Ok, made a very minor change. Instead of having planets and rifts labeled with "; ID " and then the generated path name, they use the editorname field that commotion uses. I don't know if it matters to anyone, but I just like having a bit of consistency.
|