[MUD-Dev] Re: Terrain/Landmass & GIF/BMP

Petri Virkkula pvirkkul at iki.fi
Thu Oct 8 06:39:10 New Zealand Daylight Time 1998

>>>>> "quzah" == quzah [sotfhome] <quzah> writes:

quzah> After finally generating a world mass, I need a way to "see"
quzah> what it looks like. Even on a very small world (500x1000) in
quzah> ASCII form, it will be very very hard to get an over all look
quzah> at the world. I was thinking that if there is a simple way to
quzah> output to a GIF or BMP, then I'd be able to just open up the
quzah> picture in a paint program and "see" what the world looks
quzah> like. Does anyone know of any good links that explain how to
quzah> output either "x number of bits" or "x number of bytes" to a
quzah> GIF or BMP? (PCX would even work). Currently, each piece of
quzah> info on the land mass takes up 20 bits, so I can either drop
quzah> it down to 16 bits, or bump it up to 32 bits for the use of
quzah> GIF/BMP (Yeah, I know GIF is 8bits, I THINK I can lower it
quzah> enough to be able to use a GIF format).

	How about utilizing NetPBM and using its fileformats.

	With this command line:

cat MAP | maptoraw | rawtoppm 482 481 | ppmtogif > batmap.gif

	you get a picture like this:


	rawtoppm and ppmtogif are part of NetPBM and maptoraw is a
	simple C-program like:

--- cut here ---
#include <stdio.h>

  char c;
  long col;

  while (!feof(stdin)) {
    switch (c) {
      case '?' : col = 0xff00a0;break;
      case '!' : col = 0xffffff;break;
      case 'r' : col = 0xa0a0ff;break;
      case 'R' : col = 0x5050ff;break;
      default  : col = 0xddd384;break;
    printf("%c%c%c",(col & 0xff0000) >> 16,(col & 0x00ff00) >> 8,col & 0x0000ff)
--- cut here ---


More information about the MUD-Dev mailing list