Inventive Dingo forums Inventive Dingo forums
News:
 
*
Welcome, Guest. Please login or signup. November 21, 2024, 07:25:00 pm


Login with username, password and session length


Pages: [1]
  Print  
Author Topic: SVG-to-map converter: Use Inkscape as a map editor  (Read 26337 times)
Chris
Administrator
*****
Posts: 410


Developer


View Profile WWW
« 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) 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). Grin

(Edit: Removed some unnecessary files from zip.)

* svgtomap.zip (108.96 KB - downloaded 1484 times.)
« Last Edit: March 04, 2009, 02:50:45 am by Chris » Logged
Kumlekar
Eats planets for breakfast
****
Posts: 140



View Profile
« Reply #1 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!
« Last Edit: March 04, 2009, 06:06:43 am by Kumlekar » Logged

What is Six Times Nine
Forty-Two!

Jp may have played mayhem before it was cool, but I play while its cool! *

* "Cool" is defined as the period of time in which Kumlekar plays a game.
Chris
Administrator
*****
Posts: 410


Developer


View Profile WWW
« Reply #2 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. Smiley
Logged
Kumlekar
Eats planets for breakfast
****
Posts: 140



View Profile
« Reply #3 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.

* svgtomap.7z (104.26 KB - downloaded 1488 times.)
Logged

What is Six Times Nine
Forty-Two!

Jp may have played mayhem before it was cool, but I play while its cool! *

* "Cool" is defined as the period of time in which Kumlekar plays a game.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM