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 <freeciv-dev@xxxxxxxxxxx>
Subject: Re: [Freeciv-Dev] Unit fog of war
From: Ed Cogburn <ecogburn@xxxxxxxxxxxxxx>
Date: Thu, 02 Sep 1999 12:59:56 +0000

Artur Biesiadowski wrote:
> 
> This subject was mentioned few times, so sorry if I'm repetitive in some
> ideas.
> 
> Here is proposed way to implement it.
> 
> Every unit has a field last_seen, which is bitfield for each player that
> specify if unit was seens by that player last turn/move. After move,
> before packets are send following tests are performed
> 
> for each tile in max_visibility_radius from unit.x,unit.y
>   for each ounit on this tile
>     if can_see(ounit, unit)
>       ounit.owner can see unit
>     if can_see(unit, ounit) and not ounit.last_seen by unit.owner
>       send add packet about ounit to unit.owner
>   if city on this tile
>     if can_see(city, unit)
>       city.owner can see unit
>     if can_see(unit,city)
>       send city info to unit.owner
>   // maybe also
>   //if specific improvement on this tile
>   // ? I'm thinking about radar towers from CCTP, but maybe
>   // they can be made as special units that do not move etc ?
> 
> send remove/add unit packets to unit.owner
> 
> for each other player
>   if ( player can see unit now )
>   {
>     send remove/add unit packets to player
>     last_seen |= player
>   }
>   else
>   {
>     if ( player last_seen unit )
>       send shadow unit packet
>     last_seen -= player
>   }
> 
> Shadow unit packet is special packet that informs client that unit has
> moved from last position, but player do not know where. It is up to
> client (maybe configurable) if it want's to show this unit with some
> special outline/greyed out, or plainly remove it.
> 
> Problems: when player x moves his unit A so he do not longer see unit B,
> unit B is not shadowed for as long as it moves. So even with such fog of
> war, players knows if not visible unit is still on old place. This could
> be avoided by adding another check for for fields that was previously
> visible by moving unit - for each stack/unit there check would be
> performed if there is a player unit in max_visibilty radius that can see
> it. I'm not sure if it is worth the effort - it at least doubles the
> time and gives only small improvement.
> 
> Of course can_see_unit_unit, can_see_city_unit etc could be done as
> scripts :)
> 
> Artur


        Do you think this idea could be extended to support a special
kind of unit.  A unit which is normally invisible, except that
during movement of the unit, and during movement of other nearby
units, there is a chance the unit may be revealed.  When this unit
makes an attack it would automatically be revealed.
        I'm just trying to think of a way to make the partisan unit much
more usefull (and fun).


-- 
Ed C.

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