Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2004:
[Freeciv-Dev] Re: (PR#7408) Client knows about hidden units
Home

[Freeciv-Dev] Re: (PR#7408) Client knows about hidden units

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: matusik_s@xxxxx
Subject: [Freeciv-Dev] Re: (PR#7408) Client knows about hidden units
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 9 Mar 2004 10:30:57 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7408 >

mateusz stefek wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7408 >
> 
> 
> Dnia 2004.02.24 08:49, Jason Short napisał(a):
> 
>><URL: http://rt.freeciv.org/Ticket/Display.html?id=7408 >
> 
> [cut]
> 
>>We're back to the original two solutions for this one.  Either we track
>>whether the player "knows" about the unit, and send a delete when this
>>changes, or we introduce a check every time a condition for the
>>knowledge changes.
>>
>>The latter would be done like this: when alliance is removed, iterate
>>over all units on all tiles occupied by the player.  For each unit, if
>>the other player *could* see the unit before but *can't* now, it goes
>>out of sight.  This is very ugly!  can_player_see_unit has a lot of
>>checks but it's very localized.  Duplicating this logic all over the
>>place is something to be avoided.
>>
> 
> So here is what I think about the first solution you propose:
> 
> Pros:
> - Flexibility. Adding a new rule for visibility should be easy
> - Delta gets less packets(this probably means lower bandwidth)
> Cons:
> - If we track some kind of bitvector for every unit, we must call something 
> like recalculate_visibility(punit) every time a condition for the knowledge 
> changes. So the logic is still duplicated
> - Performance
> - Much time is needed for writing this :( (It isn't as is easy as it seems)

On further thought (as I think I said in my last mail) this 
sophisticated system isn't needed.  All we need to do is pass TRUE to 
the remove_unseen parameter of send_unit_info_to_onlookers.  Or do 
something like you do and remove units that are out of sight.

Note this does allow a very limited form of cheating: the client knows 
that these units _exist_.  Since the player may have seen them before 
(and remember the ID) he may now know everything about the unit except 
the location.  Probably this is not an issue.

> Anyway, Is my patch going to be commited or we're waiting for someone to 
> write The New Flexible And Bugfree Sight System For Freeciv(tm)?

No, we're not waiting.  I think I overlooked your patch :-(.  What it 
implements is:

- When an alliance is broken allied visibility is removed.
- Removing allied visibility means sending a client_remove_unit packet 
for every unit the former ally can't see.

Does anyone have an objection to this algorithm?

jason




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