[Freeciv-Dev] Re: Client/Server localization problem (fwd)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Hi,
accidentally sent the first version of this to Reinier Post. Sorry
Reinier.
> Although it has clear advantages, I think this is a bad idea.
> See the thread starting at
I read the whole thread. If I correctly understand it, the majority wants
new packets without making them to much new packets.
So here a totally new suggestion, which includes some of the ideas I read
and some of the ideas I had when writing first message:
OurTransferPacketGeneralTextStructure
{
- uint16 size /* I hope I got this right from source? */
- uint8 message type /* The generic message header */
- unit8 x
- uint8 y
- uint32 eventype
/* now the news */
- char[] formatstring /* zero terminated */
- uint8 Number of arguments
- uint8 argument type /* num argument fields /*
- char[] argument data
}
Where argument type stores the data type:
/* generic types */
#define TYPE_GENERIC_STRING 0 /* a string*/
#define TYPE_GENERIC_VALUE 1 /* a number*/
...
/* id types which have Id as data, but result in strings */
#define TYPE_IDNAME_UNIT 10 /* unit name */
#define TYPE_IDNAME_CITY 11 /* city name */
#define TYPE_IDNAME_PLAYER 12 /* player name */
#define TYPE_IDNAME_TECH 13 /* tech name */
#define TYPE_IDNAME_NATION 14 /* nation name */
#define TYPE_IDNAME_NATIONS 15 /* plural nation name */
#define TYPE_IDNAME_IMPROVEMENT 16 /* improvemnt name */
...
/* special string types */
#define TYPE_STRING_CITY 100 /* city name as string */
...
/* special number types */
#define TYPE_NUMBER_FUTURETECH 180 /* future tech number */
...
#define TYPE_MINSTRING 100
#define TYPE_MAXSTRING 179
#define TYPE_MINNUMBER 180
#define TYPE_MAXNUMBER 255
The transfer data is seperated from type data now. The type determines the
data size (normally sint32). For TYPE_GENERIC_STRING and the TYPE_STRING_xxx
types the size can be determined by parsing for 0-byte.
As this format always includes the format string like the currently used
server side format strings, old client have no problems with new servers (
as long as they support this packet). This string can be used for localization.
The clients can base AI stuff and sound support and stuff like that on the
eventtype, whereas they print texts based on the format string.
Maybe a second event field can be added containg some more information (e.g.
a flag field).
This suggestion increases network traffic sometimes and decreases traffic
sometimes. It allows easy migration of old and new. And it allows future
expansion to allow whatever AI or sound support is needed, as the raw data
can be interpreted.
The generic types should not be used too often. It is better to use
TYPE_STRING_xxx or TYPE_NUMBER_xxx, as these can be interpreted, but need not
(e.g. knowing type >=TYPE_MINSTRING and <=TYPE_MAXSTRING is a string is
enough for displaying, but AI may interpret the direct number).
Ciao
____ _ _ ____ _ _ _ _ ____
| | | | | | \ / | | | the cool Gremlin from Bischofswerda
| __ | ____| | \/ | | | WWW: http://home.pages.de/~stoecker/
| | | | | | | | PGP key available on www page.
|____| _|_ |____| _|_ _|_ |____| I hope AMIGA never ends to make fun!
************************************************************************
* snail-mail: Dirk Stoecker * e-mail: *
* Geschwister-Scholl-Str. 10 * stoecker@xxxxxxxxxxxxxx *
* 01877 Bischofswerda * phone: *
* GERMANY * GERMANY +49 (0)3594/706666 *
************************************************************************
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] Re: Client/Server localization problem (fwd),
Dirk Stoecker <=
|
|