File: README.attributes

package info (click to toggle)
freeciv 2.6.2-1~bpo10+1
  • links: PTS, VCS
  • area: main
  • in suites: buster-backports
  • size: 212,500 kB
  • sloc: ansic: 443,831; cpp: 29,541; sh: 7,982; makefile: 7,886; python: 1,933; xml: 945
file content (32 lines) | stat: -rw-r--r-- 1,596 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

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 its 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
currently 4k and the attribute block can have arbitrary size (although
limited to 64k in this initial 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 of the
hashtable 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.