Author Topic: Importing Sketches to the Map Editor  (Read 939 times)

Migg

  • Hydlaa Citizen
  • *
  • Posts: 223
    • View Profile
Importing Sketches to the Map Editor
« on: November 21, 2016, 04:50:31 pm »
We all know that trying to create a map, a poster or a drawing is not an easy task in PlaneShift. The in-game editor lacks some basic features, such as rotation, grouping or alignment. But don't despair, creating content with some outside tool and converting it to a format that the game can import is not impossible!

The process is rather straightforward:
  • Create a drawing using simple elements available for use in the integrated editor: straight lines and two-point bezier curves.
  • Export the drawing to Scalable Vector Format, or SVG.
  • Use a tool to convert the SVG file to XML the PS Editor can parse.
  • Load your new XML file to PS.
  • Edit the drawing to add text or icons, modify line colors etc.
  • Finish editing, and save your masterpiece!
Now you can give your new drawing or map to other characters in-game, post it on message boards, or do anything else your character desires with it!

For the first step, I use an open source diagram editing program, DIA. You can download DIA from here.

After you are done installing, it is time to open the program and create your first drawing. To be able to import your drawing to PlaneShift, you should only use two tools from the tool palette: Line (shortcut: "L") and Bezierline (shortcut: "C"). These two will appear familiar to anyone who has tried creating drawings in the PS map editor. For best results, set the line width to minimum (select the thinner line or enter "0" as the line width in properties.) DIA offers a set of tools such as grid and object snapping, grouping, copy/paste and zooming.

One more thing to note is the blue lines defining page borders in your drawing. For best results, try to start your drawing into the first page, the one with (0,0) as upper-left corner coordinates, and remain within pages with positive coordinates.

Once you are done drawing, it may be a good idea to save the document in the native format, to be able to make modifications later on as needed. So select "File" -> "Save" and save your image with a .dia extension.

Now you need to export your drawing to SVG format. Go to the menu and select "File" -> "Export". In the export dialog make sure you select "Cairo Scalable vector graphics (*.svg)" in the "Determine file type:" drop down within "Export Options".

Step 3 requires the use of a tool to convert the SVG to XML that can be imported by the PlaneShift Map editor. You need to download the tool from here.

To run this tool, you need a BASH shell. Windows 10 is supposed to provide a BASH compatible shell. Older versions of Windows could support a BASH shell through Cygwin. Most Linux distributions also provide BASH by default. On a MAC, MacOS should also provide a BASH compatible shell.

In addition, you need to have SED installed and available in your BASH PATH. With everything but Windows 10 embedded BASH shell, you need to find and install an appropriate package for SED. Note that most Linux distributions will have SED installed by default. If not, you will need to search on the internet for instructions on how to install SED and include it in your path.

Once you have everything set up, you can save the tool in the same directory as your SVG drawing. Open a terminal, and use the command line to change to the directory containing the script and the SVG. Then run a command like the following:

Code: [Select]
./transform_svg.sh diagram.svg > diagram.xml
Copy diagram.xml to the sketches local PlaneShift directory (~/.PlaneShift/sketches under Linux). Then fire up PlaneShift, open a map, edit it and import diagram.xml. You may need to adjust the map size by dragging at the handle on its lower right corner.

As a final note: If the diagram needs to be scaled, open the original document again in DIA, go to File -> Page Setup, and in Scaling select Scale and change the scaling percentage to adjust the size of the output drawing. Increase the scaling to make the drawing larger, decrease to make it smaller. Re-export the drawing to SVG and repeat the process until you are satisfied with the results.

For an alternative method of converting SVG to Map XML, you can also read this thread.

MishkaL1138

  • Veteran
  • *
  • Posts: 1175
  • Meh.
    • View Profile
Re: Importing Sketches to the Map Editor
« Reply #1 on: November 22, 2016, 03:11:01 am »
Well, that's nice and all, but I use Inkscape and derula's ruby script. Much easier and quite quick! I think it's easier to do, honestly... But great job nonetheless!

"It's all fun and games until someone stabs someone else in the eye."

Migg

  • Hydlaa Citizen
  • *
  • Posts: 223
    • View Profile
Re: Importing Sketches to the Map Editor
« Reply #2 on: November 22, 2016, 03:05:03 pm »
Thanks a lot! Actually I found out about the other thread after I had promised (and started) to make this post, so I decided to go on with it. Not into Ruby myself, more of a scripting guy, so I already had my set of scripts that do my conversions for me. I tried Inkscape once but found DIA is easier for what i want to do. Hopefully anyone wanting to use DIA as an editor may find some useful tips here. There are some people who already make some awesome sketches, your (I think) guild poster being one of them. I hope to see more :)

Dilihin

  • Hydlaa Citizen
  • *
  • Posts: 296
  • you can always find me on IRC: JeHugawa @freenode
    • View Profile
Re: Importing Sketches to the Map Editor
« Reply #3 on: November 22, 2016, 04:48:32 pm »
Wouldn't it be more practical that somebody made better map editor in PS so we don't need to effort use all of these converters?
:offtopic:

LigH

  • Forum Legend
  • *
  • Posts: 7096
    • View Profile
Re: Importing Sketches to the Map Editor
« Reply #4 on: November 23, 2016, 03:28:03 am »
If there was just somebody with so much spare time and energy to re-invent all the wheels we want to see turning... After all, PlaneShift is a game, not a vector drawing application; enhancing the map editor will most probably not have a high priority, compared to so many other tasks on the schedule.

Gag Harmond
Knight and Ambassador
The Royal House of Purrty

MishkaL1138

  • Veteran
  • *
  • Posts: 1175
  • Meh.
    • View Profile
Re: Importing Sketches to the Map Editor
« Reply #5 on: November 23, 2016, 08:48:26 am »
Thanks a lot! Actually I found out about the other thread after I had promised (and started) to make this post, so I decided to go on with it. Not into Ruby myself, more of a scripting guy, so I already had my set of scripts that do my conversions for me. I tried Inkscape once but found DIA is easier for what i want to do. Hopefully anyone wanting to use DIA as an editor may find some useful tips here. There are some people who already make some awesome sketches, your (I think) guild poster being one of them. I hope to see more :)

There are many more, just gone missing or not shown around yet. I gotta ask, what's your script's Mac compatibility?

"It's all fun and games until someone stabs someone else in the eye."

Migg

  • Hydlaa Citizen
  • *
  • Posts: 223
    • View Profile
Re: Importing Sketches to the Map Editor
« Reply #6 on: November 23, 2016, 12:41:20 pm »
There are many more, just gone missing or not shown around yet. I gotta ask, what's your script's Mac compatibility?

I haven't tried it on a Mac, but if you have BASH and SED you can run everywhere. So, old macs are probably a no-go, but OS-X and later should be able to run the script in a terminal. I think BASH is the MacOS terminal's default shell nowadays, and it is supposed to ship some version of SED as well. Please let me know if you face any problems.

Dilihin

  • Hydlaa Citizen
  • *
  • Posts: 296
  • you can always find me on IRC: JeHugawa @freenode
    • View Profile
Re: Importing Sketches to the Map Editor
« Reply #7 on: November 25, 2016, 12:06:50 pm »
If there was just somebody with so much spare time and energy to re-invent all the wheels we want to see turning... After all, PlaneShift is a game, not a vector drawing application; enhancing the map editor will most probably not have a high priority, compared to so many other tasks on the schedule.

I know that the team is busy, but basic things like drawing when mouse is kept clicked shouldn't be too advanced. Actually if i can pull of some spare time i could do it


I gotta ask, what's your script's Mac compatibility?

Well you could use windows emulator, virtual machine or compatibility layer such as Wine, i'm not mac expert myself but it should work,can't confirm only heard things from friends thought.

Sirial

  • Hydlaa Resident
  • *
  • Posts: 57
    • View Profile
Re: Importing Sketches to the Map Editor
« Reply #8 on: November 25, 2016, 12:42:53 pm »
I know that the team is busy, but basic things like drawing when mouse is kept clicked shouldn't be too advanced. Actually if i can pull of some spare time i could do it

If you mean something like paint i think the way the files are saved needs simple and limited lines as straight or simple curves, using a cursor drawing would mean save a lot of different lines for a simple "m" shaped drawing, so it would be needed a way to translate the cursor drawing to simplier lines in order to save them. Just my 2 trias though i wait for more experienced players/devs to answer.
Aniroho Aimirrel (Researcher in Knowledge Seekers)
Terelen Honoro (Captain of the Iron Claw)

Migg

  • Hydlaa Citizen
  • *
  • Posts: 223
    • View Profile
Re: Importing Sketches to the Map Editor
« Reply #9 on: November 25, 2016, 02:54:15 pm »
Well you could use windows emulator, virtual machine or compatibility layer such as Wine, i'm not mac expert myself but it should work,can't confirm only heard things from friends thought.

Oh, no, this is a shell script I made to run on Linux. Windows is the hardest platform to get this to run on, but you could do it with Cygwin or the new BASH emulation in Windows 10, though I haven't had any experience with the latter. See my original post for links.

Migg

  • Hydlaa Citizen
  • *
  • Posts: 223
    • View Profile
Re: Importing Sketches to the Map Editor
« Reply #10 on: November 25, 2016, 02:56:35 pm »
If you mean something like paint i think the way the files are saved needs simple and limited lines as straight or simple curves, using a cursor drawing would mean save a lot of different lines for a simple "m" shaped drawing, so it would be needed a way to translate the cursor drawing to simplier lines in order to save them. Just my 2 trias though i wait for more experienced players/devs to answer.

Actually, some simpler things such as the ability to copy-paste or align would be very useful, and a lot easier to implement. A way to enter colors as RGB values would also be a good improvement.

Dilihin

  • Hydlaa Citizen
  • *
  • Posts: 296
  • you can always find me on IRC: JeHugawa @freenode
    • View Profile
Re: Importing Sketches to the Map Editor
« Reply #11 on: November 25, 2016, 05:27:27 pm »
Well you could use windows emulator, virtual machine or compatibility layer such as Wine, i'm not mac expert myself but it should work,can't confirm only heard things from friends thought.

Oh, no, this is a shell script I made to run on Linux. Windows is the hardest platform to get this to run on, but you could do it with Cygwin or the new BASH emulation in Windows 10, though I haven't had any experience with the latter. See my original post for links.

You are right, i was lazy reading forums lately and kinda skipped few lines here and there... :oops: