Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2000:
[Freeciv-Dev] notify_player rewrite
Home

[Freeciv-Dev] notify_player rewrite

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] notify_player rewrite
From: "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx>
Date: Wed, 9 Aug 2000 09:38:49 +0200 (MET DST)

Currently, the various notify_player routines send information about
events (E_XXXX from common/events.h) as text strings to the client. I do
not think this is a good solution, and would very much prefer all text
messages to be produced on the client, and for the server to send only the
necessary parameters. For (an imagined) example, instead of sending
"The player so-and-so conquered city so-and-so">, the server should
just send playernumber & citynumber and leave it to the client to
construct a decent info message.

Doing it this way is advantageous for client side AI and necessary
for sound support (needs the extra information) and for proper and
consistent internationalization. (Sound support could also be achieved by
a separate sound packet, but I think that is the wrong aproach since it
increases network traffic and gives synchronization problems.)

So, I am going to try make a patch to fix notify_player. The problem is
that I just don't know how, yet :)

There are nearly 300 calls to the various notify_player routines. Many of
these use a generic event type, which means I will have to make lots of 
new event types to cover them all.

So, I could add new a new packet for each event type... this would
probably triple the number of network packets in freeciv. It is a simple
solution, but the packet code would become messy with so many packets.

I could encapsulate an "event packet" inside the chat packet, but then I
would have to duplicate packet handling code to deal with the "event
packet"... not a good solution.

Or, I could try to force all notify_player types to use only four ints as
variables (no notify_player call uses more than four variables), making
chat packets into something like
        int E_EVENT, x, y, var1, var2, var3, var4
but I do not know if all notify_player variables (most of which are
strings today) can be expressed as integers, and it would probably be hell
to rewrite them all.

Any suggestions?

Yours,
Per




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