Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2001:
[Freeciv-Dev] Re: Development Strategies [Was Documentation, Usability a
Home

[Freeciv-Dev] Re: Development Strategies [Was Documentation, Usability a

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: Development Strategies [Was Documentation, Usability and Development]
From: Gregor Zeitlinger <zeitling@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 2 Dec 2001 21:27:54 +0100 (CET)
Reply-to: gregor@xxxxxxxxxxxxx

On Sun, 2 Dec 2001, Andrew Sutton wrote:
> an alternative would be to define a separate language that allowed the 
> specification of the extensions and would compile directly into code. 
> however, capabilties are pretty unique and it would probably be pretty hard 
> to generalize. if you think you can figure out how to do it though, i won't 
> complain ;)
This is what I meant with Simkin (simkin.co.uk). It's embeddable in XML
and has acces to your C++ or Java API.

Founding a city would be something like:
Here init_unit would be a callbackfunction.

<unit name=settler>

  <function name="init" args="Unit u">
    Capabillity c = new Capability();

    Precondition p = new Precondition(u.position().distance(u.nearestCity) 
&lt; u.getGame().parameters().minDistance());
    c.require(p);

    Action a = new Action(fouundCity(u.position(); u.disband());
    
    u.addCapability(c);
  </function>
</unit>

I know it's not 100% correct Java code because I'd have to use inner
classes for the action and precondition, I think. But thats basically how
it works.

Because this looks almost as hard-coded I'd add another layer like

<unit name=setter>
  <capabilities>
    <found_city/>
  </capabilities>
</unit>

and then transform via XSLT to the avove code. Its still extensable if you
add to the above code and then the xslt stylesheet. You still  keep the
actual kernel clean.

-- 
Gregor Zeitlinger      
gregor@xxxxxxxxxxxxx



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