Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2006:
[Freeciv-Dev] Re: Packet format question
Home

[Freeciv-Dev] Re: Packet format question

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Forrest Sondahl <forrest@xxxxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Packet format question
From: Raimar Falke <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Tue, 7 Mar 2006 07:37:42 +0100

On Mon, Mar 06, 2006 at 03:21:35PM -0600, Forrest Sondahl wrote:
> I'm a graduate student, involved in a project to develop a
> general-purpose strategic game-playing AI.  We have some Java code
> that reads the "packets" from a Freeciv server (version 2.0.1, for
> reasons I won't go into...), and it works for a lot of the packets,
> but it keeps choking on certain packets -- so maybe I'm not
> understanding the delta compression, or something else..
> 
> Here's an example packet, which our program fails to read, given as 8
> bytes, printed in decimal.
> 
> 0 8 39 4 8 0 1 0
> 
> 0 8 - This is always the length of the packet, right?
> 39 - This is the packet id -- a PLAYER_INFO packet.
> 4 8 0 1  - I thought these bytes represented the delta-header
> Which would be a string of 31 bits:
> 00000100 00001000 00000000 00000001
> 
> Which suggests that there are three fields being sent in this packet. 
> But there is only one more byte, which is a 0.

The booleans (is_male,...) are given directly in the delta-header
since it would be pointless to use an extra byte for this.

> Also, if anyone could point me to some documentation or discussion
> about how arrays are sent as "diffs" in the packets, that would be
> most helpful...

A list of couples are sent. Each couple consists of an index (1 byte)
and the value (size depends on the type). The end of the list is
denoted by an index of 255. After such an index no value is sent.


If you have further questions, please ask me, since I designed it.

        Raimar

-- 
 email: i-freeciv-lists@xxxxxxxxxxxxx
 "If at first you don't succeed... well so much for skydiving."



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