Getting my feet wet
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?
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?
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.
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.
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:
Now that the script works, I'll try to create something more elaborate than test maps. Stay tuned.
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)
- - <id> from the href attribute in ImageReady
Now that the script works, I'll try to create something more elaborate than test maps. Stay tuned.
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
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
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...
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
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/
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
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.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/
rip
Re: New & Improved
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.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.
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?
Is it possible for someone to re-upload this mythical perl script I read about on so many threads?
- blackj3sus
- Lux Messiah
- Posts: 3223
- Joined: Fri May 05, 2006 12:27 pm
- Location: sillysoft.net/roman-battles
- Contact:
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?
Is it possible for the file to be hosted on sillysoft.net itself, or perhaps for someone to email it to me?
- 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:
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.
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.
Who is online
Users browsing this forum: No registered users and 1 guest