| View previous topic :: View next topic |
| Author |
Message |
cyanshade Lux Newbie

Joined: 03 Aug 2004 Posts: 106 Location: Finland
|
Posted: Tue Aug 03, 2004 8:48 am Post subject: Getting my feet wet |
|
|
Greetings fellow luxers,
I've recently registered my copy of Lux and some of you may remember me from the few dozen games I've played. *waves*
Browsing through this section of the forum, it's obvious that making a valid, let alone successful, map is not an easy task. That's why I decided to try my hand at it. Yes, I like a challenge.
Since I have access to Photoshop and ImageReady, I plan to use them for the initial stages. I've prepared a 5737 by 4736 pixel image representing the southern parts of Finland as seen in the year 1898.
Cropped and scaled down to a manageable size, the final map is expected to take up about 1000x735 pixels of screen real estate. These figures are subject to change, and feedback on the recommended size is appreciated.
Using the aforementioned image as a background, I'll draw superimposed layers of desired country/continent borders on top. Once finished, I'll hide the background layer and open the project in ImageReady.
Now, using ImageReady's magic wand and imagemap creation tools, I'll be able to convert the countries into polygons and ultimately export the whole lot as a HTML file.
Finally, a Perl script will process the HTML and spit out valid XML <country>...</country> blocks with <name> and <polygon> tags inside, complete with optional Y-axis flipping (to remove the need to flip the image in the first place) and coordinate scaling (for fine tuning).
If the project comes to fruition, I'm planning to release the Perl script, so everybody may use it to convert imagemaps to Lux XML.
Comments? |
|
| Back to top |
|
 |
dustin Lux Admin


Joined: 15 May 2003 Posts: 9127 Location: Vancouver
|
Posted: Tue Aug 03, 2004 9:39 am Post subject: |
|
|
Sounds like a good plan.
You should be aware that most people (like me) have no connection to Finland. This means that a map of it will not get any 'emotional bonus points' from people. That's not to say that it won't be cool, just that I have no idea what it is going to look like.
Also, you might want to consider going through your process with a simple map to start with just to try it out. |
|
| Back to top |
|
 |
Kef Lux Translator

Joined: 24 Feb 2004 Posts: 4480 Location: in j0r f0rumz, Tr0||in j0r t0pixzz
|
Posted: Tue Aug 03, 2004 3:50 pm Post subject: |
|
|
| perl is a pretty cool way to do it, and I'm sure that that app will be cool. You could find someone that makes cocoa out of it |
|
| Back to top |
|
 |
cyanshade Lux Newbie

Joined: 03 Aug 2004 Posts: 106 Location: Finland
|
Posted: Tue Aug 03, 2004 7:38 pm Post subject: Making progress |
|
|
It's official: ImageReady's auto-polygon tool sucks rotten whale meat through a straw. I had to resort to clickety-clicking the vertices by hand, but fortunately that's about the only laborious part of the project.
The Perl script is working satisfactorily. Feeding it the HTML from ImageReady yields the following XML tags:
- <width> and <height> derived from the image size
- each imagemap polygon becomes a <country> with:
- <id> from the href attribute in ImageReady
- <name> from the alt attribute
- <polygon> from the imagemap vertices, flipped automatically
- <armylocation> centred on the polygon (using bounding box, so not perfect, but usable)
For obvious reasons, all countries go in a single <continent> block, so the continents have to be established by editing the XML further. The same goes with the <adjoining> tags.
Now that the script works, I'll try to create something more elaborate than test maps. Stay tuned. |
|
| Back to top |
|
 |
rob Lux Addict

Joined: 01 Apr 2004 Posts: 593
|
Posted: Thu Aug 05, 2004 1:31 am Post subject: |
|
|
Finland matters.
go to the Upper Peninsula of Michigan.
or check out Oulu and Waino Wisconsin
sisu |
|
| Back to top |
|
 |
cyanshade Lux Newbie

Joined: 03 Aug 2004 Posts: 106 Location: Finland
|
Posted: Thu Aug 05, 2004 12:09 pm Post subject: html2lux -- initial public release |
|
|
The Perl script responsible for the <country> tags in my first map, GodStorm, is ready for public release for all the map makers out there. The script automagically converts Adobe ImageReady XHTML output to a Lux XML map.
html2lux v0.3 can be downloaded from http://leela.homelinux.net/lux/
Since it's Perl, you'll need perl to run it. Fortunately, Mac OS X comes with perl, so you're good to go. Other platforms able to run perl may work, but you'll need the POSIX libraries. AFAIK windoze ain't POSIX compatible.
There are some instructions included in the opening comments, i.e. how to configure Adobe ImageReady for correct output, the command line switches available, and so forth.
To try it out, create a simple test map in ImageReady, export it as XHTML, and run html2lux like this:
perl html2lux your_test_map.html > test_map.luxb
Last edited by dustin on Fri Nov 24, 2006 4:16 am; edited 1 time in total |
|
| Back to top |
|
 |
dustin Lux Admin


Joined: 15 May 2003 Posts: 9127 Location: Vancouver
|
Posted: Thu Aug 05, 2004 12:16 pm Post subject: |
|
|
Cool tool.
Is that a stable webserver (i.e. always on)? If so I will put a link to that script from the map-making page. If not I can put a copy of it hosted here on sillysoft. |
|
| Back to top |
|
 |
cyanshade Lux Newbie

Joined: 03 Aug 2004 Posts: 106 Location: Finland
|
Posted: Thu Aug 05, 2004 12:24 pm Post subject: New URL |
|
|
I've relocated html2lux at http://leela.homelinux.net/lux/
The earlier address is my OS X box, so it may not be always on. Use the above URL for future releases. There may be new features on the line... |
|
| Back to top |
|
 |
cyanshade Lux Newbie

Joined: 03 Aug 2004 Posts: 106 Location: Finland
|
Posted: Fri Aug 06, 2004 7:29 am Post subject: New & Improved |
|
|
Was bored at work, so I improved html2lux a bit. Because the bounding box method for finding the centre point of each land didn't work very well, I've replaced the function with a much better one.
Now the centroid (centre of mass) of each polygon is calculated and used as <armylocation>. It's surprisingly robust, to the point that you seldom have to tweak the placement by hand.
I've updated the copy at http://leela.homelinux.net/lux/ |
|
| Back to top |
|
 |
rip Lux Newbie

Joined: 31 Mar 2004 Posts: 353 Location: Vienna Austria
|
Posted: Fri Aug 06, 2004 7:46 am Post subject: Re: New & Improved |
|
|
| cyanshade wrote: | Was bored at work, so I improved html2lux a bit. Because the bounding box method for finding the centre point of each land didn't work very well, I've replaced the function with a much better one.
Now the centroid (centre of mass) of each polygon is calculated and used as <armylocation>. It's surprisingly robust, to the point that you seldom have to tweak the placement by hand.
I've updated the copy at http://leela.homelinux.net/lux/ |
Do you mind if I snarf your area/centre subs? Gemisys.pl (random map generator, available in the plugins) has that same issue...and sounds like your method is much more generic than what I ended up using (since my polys are 'well formed' in the general case (they are all four or five point polygons and don't generally double back or cross-over themselves), I simply compute the average x, average y and use that.
rip |
|
| Back to top |
|
 |
cyanshade Lux Newbie

Joined: 03 Aug 2004 Posts: 106 Location: Finland
|
Posted: Fri Aug 06, 2004 8:26 am Post subject: Re: New & Improved |
|
|
| Quote: | | Do you mind if I snarf your area/centre subs? Gemisys.pl (random map generator, available in the plugins) has that same issue...and sounds like your method is much more generic than what I ended up using (since my polys are 'well formed' in the general case (they are all four or five point polygons and don't generally double back or cross-over themselves), I simply compute the average x, average y and use that. |
I don't mind. I found the algorithm on some visual basic site and recreated it in Perl, so can't really take credit for it in the first place. I hope you'll find it useful. |
|
| Back to top |
|
 |
yi3artist Lux Newbie

Joined: 01 Mar 2005 Posts: 68 Location: Texas
|
Posted: Fri May 25, 2007 10:56 am Post subject: Could someone upload the perl script again? |
|
|
I have begun working on a large map in Illustrator and the pdf to excel to xml process, but I keep botching it up.
Is it possible for someone to re-upload this mythical perl script I read about on so many threads?
Last edited by yi3artist on Fri May 25, 2007 11:00 am; edited 1 time in total |
|
| Back to top |
|
 |
dustin Lux Admin


Joined: 15 May 2003 Posts: 9127 Location: Vancouver
|
|
| Back to top |
|
 |
blackj3sus Lux Messiah

Joined: 05 May 2006 Posts: 3208 Location: sillysoft.net/roman-battles
|
Posted: Fri May 25, 2007 4:47 pm Post subject: |
|
|
u guys are makin my head hurt...  |
|
| Back to top |
|
 |
yi3artist Lux Newbie

Joined: 01 Mar 2005 Posts: 68 Location: Texas
|
Posted: Sat May 26, 2007 5:56 am Post subject: Wacky Chinese Internet |
|
|
Ah! So that link is still working. Crap. I'll explain: My being in China prevents certain sites from loading for absolutely unexplainable reasons. And homelinux.net happens to be one of them. I checked and I can't access any site under that server
Is it possible for the file to be hosted on sillysoft.net itself, or perhaps for someone to email it to me?
Last edited by yi3artist on Sat May 26, 2007 6:15 am; edited 3 times in total |
|
| Back to top |
|
 |
Preacherman Semi-Holy Priest

Joined: 24 Feb 2004 Posts: 4513 Location: Sweden (capital of Denmark, an island in Norway, southern Europe)
|
Posted: Sat May 26, 2007 10:09 am Post subject: |
|
|
| I've emailed the .pl file to you. |
|
| Back to top |
|
 |
yi3artist Lux Newbie

Joined: 01 Mar 2005 Posts: 68 Location: Texas
|
Posted: Sat May 26, 2007 8:36 pm Post subject: :) |
|
|
| You are a good man. Thank you. |
|
| Back to top |
|
 |
Sylocat Lux Veteran

Joined: 11 Sep 2006 Posts: 1404 Location: Wisconsin
|
Posted: Sat May 26, 2007 9:48 pm Post subject: |
|
|
yi3artist, where have you been for 2 years? Your profile shows you joined up in March of 2005, made one post on your first day and haven't been on the forums since until this thread began. 
Last edited by Sylocat on Sat May 26, 2007 9:48 pm; edited 1 time in total |
|
| Back to top |
|
 |
yi3artist Lux Newbie

Joined: 01 Mar 2005 Posts: 68 Location: Texas
|
Posted: Sun May 27, 2007 7:50 pm Post subject: PHP Script in the Works |
|
|
Sylocat, I've been away from home in a foreign country for two years travelling and studying. I've recently started playing Lux again, and finally have the patience to make a map. I appreciate your concern.
I did receive the file, only to realize I don't have ImageReady. No matter. From my first post on this thread, I had began to build my map with Illustrator and wrote a PHP file to convert an exported uncompressed PDF into XML data (in case the Perl script wasn't what I need). Well, the PHP file works (on my PDFs at least) and I'll share it once I make it more user-friendly, so that I can get some feedback and find bugs. |
|
| Back to top |
|
 |
|