Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] [Patch] Attribute handling

[Freeciv-Dev] [Patch] Attribute handling

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] [Patch] Attribute handling
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 31 Aug 2001 12:02:49 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

This is an updated version of the attribute handling stuff. From the

Client/server model

Each client player has an attribute block and the server also holds
such an attribute block for every player. All attribute blocks the
server holds are included in the save game. The client and server
synchronize their blocks. The server sends it's block to the client at
game start or reload. The client sends an updated block at each end of
turn to the server. Since the maximum packet size is limited (to 4k)
and the attribute block can have arbitrary size (although limited to
64k in this version) the attribute block can't be transferred in one
packet. So the attribute block is divided into attribute chunks which
are reassembled at the receiver. No part of the server knows any inner
structure of the attribute block. For the server an attribute block is
just a block of bytes.

User interface

Since an attribute block isn't a good user interface the user can
access the attributes through a mapping/dictionary/hashmap/hashtable
interface. This hashtable will get serialized to the attribute block
and the other direction around. The key of the hashtable consists of:
the (real) key, x, y and an id. The (real) key is an integer which
defines the use and format of this attribute. The values can have
arbitrary length. The internal structure of an value is unknown to the
attribute handling.

For easier access there are wrapper functions for the common types
unit, city, player and tile. So there are easy methods for attaching
arbitrary data to a unit, a city, a player (self or other) or a tile.

If there are further questions please ask. If there are no comments
this patch will be applied in some days.


 email: rf13@xxxxxxxxxxxxxxxxx
  Living on earth may be expensive, but it includes an annual free trip
  around the sun.

Attachment: attribute6.diff.gz
Description: GNU Zip compressed data

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