glob2-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [glob2-devel] Minimap algorithm


From: Kai Antweiler
Subject: Re: [glob2-devel] Minimap algorithm
Date: Fri, 13 Jul 2007 22:56:56 +0200

I've been trying to recreate minimap code in its own class with sort of
half/success. My algorithm bassically assigns a colorType to every point on
the map, (colorType is just a smaller memory footprint used to reference the
color itself), and then interpolates between these values. The minimap is
only 100x100, but maps are 64x64 or 128x128 so they don't line up.

Good point.  Why don't we use a minimap that has a size which is a power of 2?
128x128 would make more sense than 100x100.  If it is too large 64x64
might be better.
Than you can cluster map squares easily to pixels.  Lets say, 4
squares become one
pixel, than you can mix the colors of those squares or determine the
most frequent or
most important color and assign it to the pixel.

So I
bassically I just interpolated between values, casting the 128 to 100. Some
pixels will lie close to a point on the map, others will be half way
inbetween two points, so the values are interpolated (in 2 dimensions) for
every pixel.

The algorithm works, and I did various optimizations on it, so it doesn't
use very much CPU (less than the last one did). However, the algorithm
doesn't produce as nice as a minimap as the old one. Specifically, it
doesn't create the nice, curved terrain, instead, (thanks to the
interpolated), the terrain edge seems like a sort of blurred conglomerate. I
tried instead mapping a pixel to its closest map point (no interpolation),
but that was far worse.

As far as I can tell, the old minimap averaged between the colors of points
of terrain, rather than interpolating. If anyone has the details on how this
works, it would be greatly apprecciatted.

Maybe a look into a raster-to-vector converter can help:
http://autotrace.sourceforge.net/
But I doubt it.
Interpolation for tft-screens should fit our situation better.

If your code is fast, we can drop the line-by-line update of the
minimap and instead
update the whole map every 5 turns. The map is scanned anyway for
gradient construction.
--
Kai Antweiler




reply via email to

[Prev in Thread] Current Thread [Next in Thread]