Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] Re: Freeciv server/client communication protocol
Home

[Freeciv-Dev] Re: Freeciv server/client communication protocol

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Teemu Kurppa <tkurppa@xxxxxxxxxx>
Cc: freeciv-dev <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: Freeciv server/client communication protocol
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 12 Feb 2002 15:17:36 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Tue, Feb 12, 2002 at 03:42:05PM +0200, Teemu Kurppa wrote:
> Freeciv server/client communication has some pecularities. To me, it seems
> that the client/server communication has evolved to a working whole,
> instead of being a well-defined communication protocol.
> 
> For example, this afternoon I found that the server doesn't always send
> REMOVE_UNIT packet, when I disband my unit. Server sends it only, if I can
> see the tile unit was on after the removal. However, server sends
> TILE_INFO packet of the just-fogged tile, and the client updates it's unit
> data structures appropriately in handle_tile_info. Aargh.

> I've done some initial attempts to start implementing my own AI client,
> and most of the time I've been hunting these pecularities. I expect that
> others have tried to do AI clients also. This problems may not pop up, if
> one uses C and existing client code. But I use different language. 

If you want to create a normal AI client from scratch you face much
bigger problems IMHO: you have to do for example a city recalculation
in exact the same way as the server does it. This is a huge amount of
code you have to convert. Same for goto calculations (here you can't
even ask the server (which is possible for cities)).

> I would be glad of any information on your attempts, even of anectodal
> information such as the example above.

The only one I know of is:

  if (city_is_new && !city_has_changed_owner) {
    agents_city_new(pcity);
  } else {
    agents_city_changed(pcity);
  }

Which means that if the owner changes the client will create a new
city. But this isn't packet related per se. Just the client code is
odd.

> I could collect a list of problems, which could later be used to
> implement a cleaner communication protocol.

IMHO the basic protocol (2 byte size, 1 byte type and then the
payload, the capabilities and also the various PACKET_*s) is ok. And
yes I agree that sometimes there are dependencies (will there be a
PACKET_START_TURN before a PACKET_NEW_YEAR, or your problem) which
aren't obvious if you look at each packet at its own. Also a "human
driven" client has much lower requirements for such inter-packet
dependencies compared to a code driven client. This means you will
discover things nobody has noticed before.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Only one human captain has ever survived battle with the Minbari
  fleet. He is behind me. You are in front of me. If you value your 
  lives, be somewhere else."
    -- Ambassador Delenn, "Severed Dreams," Babylon 5


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