Getting my feet wet

Lux maps won't make themselves.
Post Reply
User avatar
cyanshade
Luxer
Posts: 106
Joined: Tue Aug 03, 2004 9:26 am
Location: Finland
Contact:

Getting my feet wet

Post by cyanshade » Tue Aug 03, 2004 9:48 am

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?

User avatar
dustin
Lux Creator
Lux Creator
Posts: 10998
Joined: Thu May 15, 2003 2:01 am
Location: Cascadia
Contact:

Post by dustin » Tue Aug 03, 2004 10:39 am

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.

User avatar
Kef
Lux Translator
Posts: 4471
Joined: Tue Feb 24, 2004 11:23 am
Location: in j0r f0rumz, Tr0||in j0r t0pixzz
Contact:

Post by Kef » Tue Aug 03, 2004 4:50 pm

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

User avatar
cyanshade
Luxer
Posts: 106
Joined: Tue Aug 03, 2004 9:26 am
Location: Finland
Contact:

Making progress

Post by cyanshade » Tue Aug 03, 2004 8:38 pm

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.

User avatar
rob
Lux Addict
Posts: 593
Joined: Thu Apr 01, 2004 10:21 pm

Post by rob » Thu Aug 05, 2004 2:31 am

Finland matters.

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

sisu

User avatar
cyanshade
Luxer
Posts: 106
Joined: Tue Aug 03, 2004 9:26 am
Location: Finland
Contact:

html2lux -- initial public release

Post by cyanshade » Thu Aug 05, 2004 1:09 pm

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

User avatar
dustin
Lux Creator
Lux Creator
Posts: 10998
Joined: Thu May 15, 2003 2:01 am
Location: Cascadia
Contact:

Post by dustin » Thu Aug 05, 2004 1:16 pm

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.

User avatar
cyanshade
Luxer
Posts: 106
Joined: Tue Aug 03, 2004 9:26 am
Location: Finland
Contact:

New URL

Post by cyanshade » Thu Aug 05, 2004 1:24 pm

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...

User avatar
cyanshade
Luxer
Posts: 106
Joined: Tue Aug 03, 2004 9:26 am
Location: Finland
Contact:

New & Improved

Post by cyanshade » Fri Aug 06, 2004 8:29 am

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/

User avatar
rip
Luxer
Posts: 352
Joined: Wed Mar 31, 2004 10:22 am
Location: Vienna Austria
Contact:

Re: New & Improved

Post by rip » Fri Aug 06, 2004 8:46 am

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

User avatar
cyanshade
Luxer
Posts: 106
Joined: Tue Aug 03, 2004 9:26 am
Location: Finland
Contact:

Re: New & Improved

Post by cyanshade » Fri Aug 06, 2004 9:26 am

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.

User avatar
yi3artist
Luxer
Posts: 68
Joined: Tue Mar 01, 2005 7:36 pm
Location: Texas

Could someone upload the perl script again?

Post by yi3artist » Fri May 25, 2007 11:56 am

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?

User avatar
dustin
Lux Creator
Lux Creator
Posts: 10998
Joined: Thu May 15, 2003 2:01 am
Location: Cascadia
Contact:

Post by dustin » Fri May 25, 2007 4:59 pm

Here's a link to the perl script:

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

User avatar
blackj3sus
Lux Messiah
Posts: 3223
Joined: Fri May 05, 2006 12:27 pm
Location: sillysoft.net/roman-battles
Contact:

Post by blackj3sus » Fri May 25, 2007 5:47 pm

u guys are makin my head hurt... :?

User avatar
yi3artist
Luxer
Posts: 68
Joined: Tue Mar 01, 2005 7:36 pm
Location: Texas

Wacky Chinese Internet

Post by yi3artist » Sat May 26, 2007 6:56 am

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?

User avatar
Preacherman
Semiholy Priest
Posts: 4496
Joined: Tue Feb 24, 2004 3:52 am
Location: Sweden (capital of Denmark, an island in Norway, southern Europe)
Contact:

Post by Preacherman » Sat May 26, 2007 11:09 am

I've emailed the .pl file to you.

User avatar
yi3artist
Luxer
Posts: 68
Joined: Tue Mar 01, 2005 7:36 pm
Location: Texas

:)

Post by yi3artist » Sat May 26, 2007 9:36 pm

You are a good man. Thank you.

User avatar
Sylocat
Lux Veteran
Posts: 1404
Joined: Mon Sep 11, 2006 2:59 pm
Location: Wisconsin
Contact:

Post by Sylocat » Sat May 26, 2007 10:48 pm

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:

User avatar
yi3artist
Luxer
Posts: 68
Joined: Tue Mar 01, 2005 7:36 pm
Location: Texas

PHP Script in the Works

Post by yi3artist » Sun May 27, 2007 8:50 pm

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.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 4 guests