Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2001:
[Freeciv-Dev] freeciv2 kernel,modules and rulesets
Home

[Freeciv-Dev] freeciv2 kernel,modules and rulesets

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] freeciv2 kernel,modules and rulesets
From: Andrew Sutton <ansutton@xxxxxxx>
Date: Sat, 1 Dec 2001 18:24:00 -0500

all,

here's a basic overview of the framework. i'd like some feedback on 
feasability of implementation and some other basic information from the group.

essentially, what's going to make freeciv2 fundamentally different than 
freeciv1 is a) the programming language (c++) and b) the server architecture. 
in freeciv1, the server is implemented as a monolithic system where all 
capabilites are hardcoded. in freeciv2, the server is going to use a 
microkernel pattern, providing api's to major gaming elements and letting 
modules implement the actual behaviors of game elements. rulesets are going 
to be used to configure the modules and set the rules for a specific game.

here's a "simple" example. the kernel maintains generic information about 
units. specifically it provides a framework for attributing units with 
capabilities and properties. a core module (lets call it core :) provides 
some default unit capabilities such as move, sentry and fortify. a civ3 
ruleset then specifies what units have what capabilities and the various 
parameters of those capabilities have (e.g. a settler can move and has the 
ability to move 1 square per turn over land).

now, here's where it gets a little complicated: the actual module 
implementation. the kernel needs some way of loading modules. in linux, we 
can use dl_open() on windows... i forget what it's called. using ACE, all 
that's taken care of, we just have to call into ACE to do it. when a module 
is loaded, it registers all of its information with the kernel. so the core 
module would register the move, sentry and fortify capabilities.

does this sound like an appropriate behavior for the freeciv kernel? are 
there any other alternatives besides static linking (which would defeat the 
entire microkernel architecture?)

anyways, there are two ways for modules to be loaded. a) we load all modules 
at the runtime of the server from, say, a configuration file or b) the 
ruleset specifies which modules will be used. i think i'd prefer b simply 
because loading all modules might introduce some weird data into a game where 
it shouldn't be.

thoughts?

anyway, i've also started thinking about an implementation to allow for 
dynamic allocation of constant identifiers (i know it sounds weird or not 
possible, but it can be done). so, for example, define an identifier, 
CAPAB_MOVE to uniquely identify the movement capability. this has to allocate 
space for a named integer.

static unsigned CAPAB_MOVE;

then register the capability with the kernel:

kernel->register_capability( CAPAB_MOVE, new FC_Move_Capab );

this would set the value of CAPAB_MOVE to some unique capability 
identifier.

then use it later for lookup later on.

FC_Capability = unit->query_capability( CAPAB_MOVE );

or something like that :) it shouldn't decrease performance at all since it's 
just an integer. aha! flexible identifier values with constant names.

any thoughts on any of the above? i'd really like some feedback on this.

andy


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