Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2002:
[Freeciv-Dev] Re: [RFC][Patch] Reduce bandwith by using deltas
Home

[Freeciv-Dev] Re: [RFC][Patch] Reduce bandwith by using deltas

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Per I. Mathisen" <per@xxxxxxxxxxx>
Cc: freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: [RFC][Patch] Reduce bandwith by using deltas
From: Raimar Falke <rf13@xxxxxxxxxxxxxxxxx>
Date: Mon, 4 Nov 2002 18:36:08 +0100

On Mon, Nov 04, 2002 at 02:24:17PM +0000, Per I. Mathisen wrote:
> On Mon, 4 Nov 2002, Raimar Falke wrote:
> > > Now _please_ shoot this into flames if you think it is stupid before I
> > > start any coding :)
> >
> > I also came to this solution (including something multiple times and
> > change the semantic of certain macros). I don't think it will be more
> > pretty.
> 
> Maybe not, I am not sure. But at least you do not require freeciv coders
> to know Python... and a programming language you don't know is never
> pretty.
> 
> > The disadvantage I see is that you can't look at the output.
> 
> gcc -E | more, no problem.

Have you looked at the output?

> > And also can't save it (longer compile time for everyone).
> 
> As I said in the other post, you can autogenerate those files on
> compilation using gcc -E > outputfile. I don't think that is a good reason
> for doing it, however, since cpp is extremely fast and the difference in
> compile time will be unnnoticable. (As opposed to running Python, I
> suppose...)
> 
> > I'm working on version 2 of the delta protocol/generating. It will
> > support all packets. Since this will break the complete protocol
> > (capabilities won't help you here) I'm thinking about what else can be
> > added at this time. One thing is sub-byte values.
> 
> Go for it. Oh, we can also finally remove the conn_info capability ;)
> 
> > Is this a good idea?
> 
> I have no idea what speed impact this bit parsing stuff will have.

Me too.

> > Also delta2 will not waste a byte for a bool but instead will use the
> > bit in the fields to store the real value instead of the has-changed
> > status.
> 
> Apart from bools, do we really waste so many bits for the other types?

I don't know. Let's see

packet_unit_info; PACKET_UNIT_INFO
        UNIT id; key  # 16bit to support 64k units
        PLAYER owner; # 6bit for 64 players
        COORD x,y;    # 8bit for 255x255
        CITY homecity;# 12bit to support 4k cities

        BOOL veteran, ai, paradropped, connecting, carried, select_it;

        UINT8 type,   # 6bit for 64 unit types
              movesleft, # 6bit for 64 moves
              hp, # 2bit
              fuel, # 2bit
              activity, # 5bit
              activity_count # 4bit

        UINT8 unhappiness # 4bit
                , upkeep  # 4bit
                , upkeep_food # 4bit
                , upkeep_gold; # 4bit
        COORD goto_dest_x,goto_dest_y;
        UINT16(enum tile_special_type) activity_target;
        UINT8 packet_use; # 2bit
        CITY info_city_id;
        UINT16 serial_num;
end

If I calculated correctly this are 47bits = 6byte by 26
bytes+6bits=27bytes total. This is 22% reduction.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "If at first you don't succeed... well so much for skydiving."


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