Complete.Org: Mailing Lists: Archives: freeciv-dev: January 1999:
[Freeciv-Dev] proposal for extensible races framework
Home

[Freeciv-Dev] proposal for extensible races framework

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] proposal for extensible races framework
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Sat, 9 Jan 1999 11:17:46 +1100

Hi all,

One of the things I think freeciv needs is a framework for race 
extensibility, so people can add new races, and so freeciv can 
integrate new races, without causing backwards incompatibility 
each time a new race is added.  (Adding the framework will cause 
a one-off backwards incompatibility.)

This post gives a specific proposal of how this could/should be 
done, and addressing some suggestions and problems which have 
been discussed previously.

1. Flags icons.  

Flags cause particular problems, because different clients may be 
using different tilesets, or even different representations, so 
we can't send flag icons around between clients and servers.

I propose that the current flag icons be excised from tiles.xpm,
and placed in a new flags.xpm, for easier extensibility.  

The server will have no knowledge of flag icons, except that 
each race has a default flag number, where the numbers indicate 
the position in flags.xpm.  

Each client will have its own flags.xpm (or equivalent), which 
can be extended locally.  When players select races, they 
also select flags, from the flags known to each individual 
client, and send the flag number to the server.  They also 
select a "solid color", as in Massimo's patch.  The server
will ensure that players select distinct flag numbers and 
solid color numbers.  The maximum number of players will be 
kept fixed at 14, (though there will be more than 14 races to 
select from), so there need only be 14 solid colors.  
(For AI's, the server will have defaults, or chose some other 
(random?) flag/color if the default is taken by another player.)

If clients have different flags.xpm, then a given flag number 
may correspond to a different flag image on different clients.
Tough.  If you want flags to correspond, sychronise flags.xpm
or use standard-freeciv flags.xpm (which should be extended
to include lots and lots of flags).  If some player uses a
flag number which is _higher_ than the number of flags some 
other client has available, then that other client will display
that player's solid color (as in the "use solid colors" option)
instead of the flag.

2. Race details.

I propose that all race details are kept in the server, and
sent to clients as required.  (Eg, send minimal information at 
the start, and then the full info for each player for their race
once races are chosen.)

Initially, the race details will be compiled into the server,
and to add extra races will require recompiling the server,
but should be fairly easy otherwise.  In the future the 
information could be moved to text files which are read in 
(a-la rulesets) but that is not part of this proposal.
(But note that the client/server approach in this proposal
would be a necessary part of doing that anyway.)

Some people have suggested that clients should be able to send 
race information to the server.  That introduces additional
complications.  Basically, the server *must* have the 
information, eg: to form correct messages; to run the player 
as an AI if the player is toggled; to have the information if 
you reload and that client doesn't reconnect this time.   
So since the server *must* have the information, the simplest 
course is for the server to start with the information, and 
hand it out to clients as required. 

What if you want to have obscure or fantastic races?  Fine, but
do it in the server!  If you really want the client to send 
information to the server, then maybe the client could send the
information at some early stage, and then the server distributes 
information from then on, but I consider that something to add 
later, if at all.

3. Scenarios.  

Currently, scenarios which include start positions include 
14 start possitions.  Since the maximum number of players will 
still be 14, that means there will be enough for everyone.  For 
race numbers <= 14, they can use the designated start position 
for that race (eg, on Earth), for other races they can be chosen 
(randomly?) from the remainder.  

Scenario extensions could be: 

A.  Allow scenarios to specify more start positions, to cover 
extra races (so only if your race number is higher than the 
number of start positions do you get assigned from the 
remainders).

B.  Allow scenarios to specify fewer start positions, which 
would impose a hard maximum on maxplayers and aifill;  
eg, a scenarios for two players only.


Regards,
-- David


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