Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[Freeciv-Dev] Re: (PR#11433) Fog of War rendering improvement
Home

[Freeciv-Dev] Re: (PR#11433) Fog of War rendering improvement

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#11433) Fog of War rendering improvement
From: "Andreas Røsdal" <andrearo@xxxxxxxxxxxx>
Date: Fri, 10 Dec 2004 04:55:02 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=11433 >

On Thu, 9 Dec 2004, Jason Short wrote:
> This does make things a *lot* prettier, but it also makes them a *lot*
> slower.  It really cannot be stressed enough how much prettier and
> slower it is.
>
> Without the patch I get 15-30 FPS.  With it I get 2-10 FPS.  This is on
> a random late-game savegame I happen to have lying about.

Like you said, the main reason that it's slow is that each layer is fogged
in the civ2 style fogging, which means that a lof of calculations are
wasted on pixels which will not be shown. The method could be changed to
only darken pixels which are going to be displayed, by looking at the mask
for the sprite which will be fogged. This makes it a lot faster,
and with the possibility to have civ3-style fog with a smooth gradient,
this can be a third alternative. I get over 100 FPS for both with and
without the patch.

> --- 1 --- The easy way ---
> For each sprite we have a mask and a pixmap.  We could create a second
> pixmap, which is the same sprite fogged.  This can be created on demand
> but it need only be created once per sprite.  After that drawing is fast.

This method will not make it possible to have civ3-style fog?

> --- 2 --- The right way
> First of all, I think civ2-style fog must go.  It makes alpha-blending
> for fog much slower (since it must be done many times per tile) unless
> you use the above method that takes lots of memory.  In civ3 the fog
> graphics in the tileset used a grayscale gradient that the game would
> interpret at runtime (I assume) into a sprite with alpha level.
>
> Note we don't have to use pixbufs to draw all graphics (although that
> would be nice since alpha-layers for all graphics would be nice).  We
> just need a special case to use pixbufs for fog.  Oh, and it has to be
> able to work in other clients too.  So we use tileset graphics similar
> to what civ3 has, and have the GUI clients render these into alpha
> sprites at runtime.  We might want to introduce a new type struct
> alpha_sprite.  Then we just draw this fog on top to fog areas.  Doing it
> the way civ3 does it (with, IIRC, 16 different fog sprites to give a
> smooth gradient everywhere) will take even more work.  It's all possible
> though and shouldn't be too much slower.  Old tilesets that don't
> support alpha levels will have to return stippled sprites that can still
> just be drawn on top to get alpha fog.

This will be good, but so complicated that I don't think it will happen
any time soon...

Andreas Røsdal





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