Complete.Org: Mailing Lists: Archives: freeciv-dev: September 1999:
Re: [Freeciv-Dev] Unit fog of war
Home

Re: [Freeciv-Dev] Unit fog of war

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Freeciv Dev <freeciv-dev@xxxxxxxxxxxx>
Subject: Re: [Freeciv-Dev] Unit fog of war
From: Artur Biesiadowski <abies@xxxxxxxxx>
Date: Thu, 02 Sep 1999 16:03:40 +0200

Peter Schaefer wrote:


>         You write turn/move. If you talk about about doing this
>         for every move, the following scheme might be faster;
>         uses memory.

I was thinking about every move.


> Scheme 2:
>         Data: For every player, for every tile, there is a visibility counter,
>         for all types of visibility
>         (see_ground, see_ground_stealth, see_sea, see_sea_stealth, see_air,
>         see_air_stealth, see_space, see_space_stealth).
> 
>         When a unit moves off a tile, then on each tile it had been seeing, it
>         decreases the counter.
>         This includes disbanding the unit, and other forms of disappearance.
Lets suppose that byte is enough to keep count. 16 players * 200x100
tiles * 8 visibility groups * byte is 2.4Mb - but I wonder how much
space server uses itself then in late game (16-20M maybe?). For smaller
maps/number of players it should be quite reasonable.

It is good as long as we just use visibility groups. But what with unit
that is invisible in forest ? It can be handled by additional code
maybe.. I have to think about it.



>         You could easily introduce a "scanning" value; for example, a scout 
> may
>         have a scanning value of 2,
>         which adds up with the values of other units; You would be able to see
>         stealth units if you stacked
>         enough units atop each other, because their scanning values would add;
>         Normal units would have a stealth
>         value of 1; Units with stealth value 0 would be seen always.
>         The visibility counter, now named "scanning" counter would be at 
> least two
>         bytes then, so you can add up scanning values.

I don't think it will add anything to gameplay - except maybe some
frustration.



>         What happens if a unit moves several tiles in one move ?
>         It would be more efficient to remove the unit from the start tile,
>         and place it on the end tile for scanning calculation,
>         but the rules of the game (I'm talking freeciv mode, okay?)
>         would need tweaking for this.

I think that it would be good for many things not only visibility mode,
but I'm afraid it is too large change.


>         Does it makes sense to use a mask in this case, i.e.
>         if a unit moves diagonal to upper right, decrease only the
>         scanning on the left and bottom rows, and increase on the
>         top and right rows. The other scanning values stay the same.
>         This gives a big boost if the scanning range is greater than 2,
>         but it is a bit tricky.

It can be done I think. Other possible optimization is to put 4 byte
counters into one int and then perform adding/substracting on entire
int. As long as it do not overflow/subflow (it shouldn't) it will work
many times faster (int operations are faster in most cases, not to
mention doing 4 additions in one step). Good idea, but only if counter
scheme is used.

Artur

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