Complete.Org: Mailing Lists: Archives: freeciv-dev: August 1999:
[Freeciv-Dev] Optional packets
Home

[Freeciv-Dev] Optional packets

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Freeciv Dev <freeciv-dev@xxxxxxxxxxxx>
Subject: [Freeciv-Dev] Optional packets
From: Artur Biesiadowski <abies@xxxxxxxxx>
Date: Sun, 22 Aug 1999 17:44:06 +0200

What do you think about this:

Add two packet types, OPTIONAL_REQUEST and OPTIONAL_INFO. First field of
them would be string, containing id name of real purpose of packet. Both
client and server would be perfectly ok to ignore them if they would not
recognized particular request/info.

Why ? This allows a lot easier extension of both client and server - and
reduce mess with capability strings and versioning. Almost all reports
could be made into OPTIONAL_REQUEST/INFO - they are non-critical to
actual gameplay. Server could provide some hints for client, which if
implemented could be used, in other case ignored.

Actual packet data would be type dependent - so in case of not
understood header, packet would just need to be consumed.


Example (reason why I come up with this idea):

I want to implement othe view of already build things in city then plain
list+upkeep. I want to make grid displaying small icons of improvments
already build - without names (similar to order patches on soldiers'
uniforms). When player puts cursor over given icon name + upkeep +
possibly help shows in another panel. Additionally various types of
bulding would be put in same line - for example Military building in one
(with red background), Crime/Hapiness in other (blue background) etc. I
think that it would be big speedup for advanced players, as they could
spot missing buildings with one eyeshot (maybe also grey outlines for
buildings that can be build but aren'y yet ?)

They would has to be put in correct order - so University goes before
ResearchLab despite of real ids or alphabetic order. This require some
data from server - type of each bulding and order in subgroup. It could
be put into main building ruleset and packet - but would require another
change of both + uncompatibility. Instead I would prefer to change just
server, provide separate text file with building types/order, and send
this data as OPTIONAL_DATA. I would add handling for it in my java
client, and if somebody would like to he could add the same to C ones.

Such acket could be used for nuke info - now it is capability bit, with
optional packets it would be just send and client would display nuke or
not - it doesn't matter as critical game data about tiles/units/cities
will follow.

OPTIONAL_REQUEST can be used for anything - for example to ask server to
send rankings each turn. If server does not understand that, rankings
won't be send and rankings graph will be disabled/empty. In other case
client will happily receive OPTIONAL_DATA with rankings each turn.

About the versioning - to avoid incompatibility, every change in
particular optional packet format would change id name - for example
from "rankings" to "rankings2". Server/client would be perfectly ok to
either ignore old ones or provide implementation for backward
compatibility.


Artur


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