Complete.Org: Mailing Lists: Archives: freeciv-dev: August 1999:
[Freeciv-Dev] Scripting language
Home

[Freeciv-Dev] Scripting language

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Freeciv Dev <freeciv-dev@xxxxxxxxxxxx>
Subject: [Freeciv-Dev] Scripting language
From: Artur Biesiadowski <abies@xxxxxxxxx>
Date: Sun, 08 Aug 1999 16:38:23 +0200

See my post on building rulesets. For now ruleset for building would
look like

[hydro_plant]
name="Hydro Plant"
cost=240
...
need_building=none
special_condition=RIVER_OR_MOUNTAIN_NEAR_CITY

With scripting language we could do something like

condition RIVER_OR_MOUNTAIN_NEAR_CITY
{
        return city_has_terrain_near(city,RIVER) ||
                city_has_terrain_near(city,MOUNTAIN);
}

With scripting language possibilities are a lot greater - effects of
building could be scripted - so citywall would have

{
        modify_defence(city, 50);
}


I suppose that implementing it in useful manner would change freeciv
from civII clone to generic civ-like game engine. But that would require
titanic amount of work - writing parser/interpreter would be easiest I'm
afraid - entire code would need to evaluate various scriptfuns to work.
I doubt if any single ruotine tied to pure logic would be left
unchanged.

I wonder if it would be possible to left this out of client. It would
make client even dumber - for example list of what can be built in
specific city would have to be fetched from server. In other case I see
to possibilities:
- send to client actual scripts - but client sometimes would not have
enough knowledge about all things needed to evaluate function
- send only script ids to client, and it would make remote procedure
calls on server - for example
EVALUATE SCRIPT 1234 ON CITY 12
(either by string as shown or coded into some template)

I feel that having server written in java would be easy answer here - no
problem with modpacks containing extension classes with additional
rules. But with C we have to stick to script language. Anyway, think
about possibilities.

Artur

P.S.
It IS possible to interface C code with java. It would allow using
scripts written in java, but would add 4-15MB to runtime size. Just a
food for thoughts.


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