[CF-Devel] Fast worldmap rendering script

crossfire-devel at archives.real-time.com crossfire-devel at archives.real-time.com
Sun Nov 2 23:06:36 CST 2003


Hi all,

I got frustrated over the current combine.pl (both because of the speed
and the way I configured my window manager which makes it necessary to
click 900 times to render the entire world map, once for each time it
runs CFJavaEditor), so I decided to write a script specifically designed
for fast rendering of the world map.

The script is attached with this mail. Its output isn't 100% accurate,
mainly because it assigns colors using some heuristics based on the arch
of each square rather than deriving it from the pixmaps; however, that
means you can tweak it to color different archs so that they show up
prominently. The default color settings in the script shows all
(non-covered) exits as bright purple and walls as white, which makes
cities very visible. Smaller exits are prominently marked if you magnify
the image. Floors show up as dark grey, which makes roads show up clearly
against the background.  I've also made impassable mountains show up as a
different color (light brown); the circle of the Brittany ice crown
mountains is very clear under magnification.

You could change the colors so that terrain features are faint, and exits
are bright dots; this is a good way to scan an area to see if somebody
else has taken it. :-P

Anyway, the script is quite configurable from the command-line (except for
the colors--that's next on the TODO list if people are interested--in the
meantime, you can just edit the script, the values are in normalized RGB
format, each value is between 0 and 1). You can render small portions of
the map so that it's even faster. There's an option to overlay a grid on
the map---invaluable for finding out which file contains that bit of
interesting terrain you want to make a new map in. (Another TODO list item
is to label the map grid with coordinates, but that's a bit complicated
since I'd have to deal with fonts.) You can run the script with --help to
see all the available options. 

The default output format is PPM (mainly because it's so easy to write
from a Perl script), but if you have ImageMagick installed, just specify
--outfile with the extension you want (e.g.  --outfile=map.gif) and the
script will use 'convert' to convert the image at the end. 

I realized after I wrote the script that somebody else apparently has done
the same; but I thought I'd share it anyway, in case somebody else like me
has a slower machine and doesn't have gobs of free memory to afford
starting/stopping CFJavaEditor several hundred times in a row. I haven't
figured out how to only update small portions of the image, which would
make it even faster. It might be possible to directly edit the generate
image, perhaps.

Anyway, I hope somebody will find this script useful. Feedback is welcome.
:
     
     -)
     
     

T

-- 
After listening at length to the discontent that you have just respectfully
expressed against my verbal capabilities, I am afraid that I must
unfortunately bring it to your attention that I am, in fact, NOT verbose.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fastmap.pl
Type: application/x-perl
Size: 12420 bytes
Desc: not available
Url : 
     
     http://shadowknight.real-time.com/pipermail/crossfire/attachments/20031103/3947930e/fastmap.bin
     
     
-------------- next part --------------
_______________________________________________
crossfire-devel mailing list
     
     crossfire-devel at lists.real-time.com
     
     
     https://mailman.real-time.com/mailman/listinfo/crossfire-devel
     
     
    


More information about the crossfire mailing list