Page 1 of 1

Getting my feet wet

Posted: Tue Aug 03, 2004 9:48 am
by cyanshade
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?

Posted: Tue Aug 03, 2004 10:39 am
by dustin
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.

Posted: Tue Aug 03, 2004 4:50 pm
by Kef
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

Making progress

Posted: Tue Aug 03, 2004 8:38 pm
by cyanshade
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.

Posted: Thu Aug 05, 2004 2:31 am
by rob
Finland matters.

go to the Upper Peninsula of Michigan.
or check out Oulu and Waino Wisconsin

sisu

html2lux -- initial public release

Posted: Thu Aug 05, 2004 1:09 pm
by cyanshade
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

Posted: Thu Aug 05, 2004 1:16 pm
by dustin
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.

New URL

Posted: Thu Aug 05, 2004 1:24 pm
by cyanshade
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...

New & Improved

Posted: Fri Aug 06, 2004 8:29 am
by cyanshade
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/

Re: New & Improved

Posted: Fri Aug 06, 2004 8:46 am
by rip
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

Re: New & Improved

Posted: Fri Aug 06, 2004 9:26 am
by cyanshade
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.

Could someone upload the perl script again?

Posted: Fri May 25, 2007 11:56 am
by yi3artist
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?

Posted: Fri May 25, 2007 4:59 pm
by dustin
Here's a link to the perl script:

http://leela.homelinux.net/lux/html2lux

Posted: Fri May 25, 2007 5:47 pm
by blackj3sus
u guys are makin my head hurt... :?

Wacky Chinese Internet

Posted: Sat May 26, 2007 6:56 am
by yi3artist
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?

Posted: Sat May 26, 2007 11:09 am
by Preacherman
I've emailed the .pl file to you.

:)

Posted: Sat May 26, 2007 9:36 pm
by yi3artist
You are a good man. Thank you.

Posted: Sat May 26, 2007 10:48 pm
by Sylocat
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. :shock: :shock: :shock: :shock:

PHP Script in the Works

Posted: Sun May 27, 2007 8:50 pm
by yi3artist
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.