Scripting engine

"Paul Slusarz" <kmicic-/UBDZejZ/[email protected]>
Newsgroups gmane.games.freeciv.general
Message-ID <04d201c376ee$9b9dcd10$0100a8c0@KMICIC>
Hi all,

Worklists are nice, but wouldn't scripting language be the ultimate
resolution to all the feature requests? It's not that big of a deal as it
used to be in the past as there are many freely available scripting
languages, it'd just be necessary to write the freeciv API to it.

I'd view the scripting as event-driven client side aid, and perhaps some
kind of hybrid human-AI in the future. Here are some events that'd make
sense:

OnCityStarted(city) //set your default production goals

OnEnemyNear(unit) //this one would need serious discussion, but would be
where the action is

OnProductionCompleted(city, [unit])

etc.. (with detail level as desired, IE: OnCityEvent(event_type, city))

Then it'd be necessary to access information about the game state, say like
this:

Unit.Location.X (and Y)
Unit.Type (or better Attack/Defense/Move)
Unit.Stamina
Unit.MovesLeft
(and other things, ie Unit.GoTo)

City.LocationX (and Y)
City.Units[ ]
City.Improvements
City.Wonders

Map[x, y].TerrainType
Map[x, y].Resources[ ]
Map[x, y].Improvements[ ]
Map[x, y].Units[ ]
(for some coordinates Map[ ] would return UNKNOWN values).

Another thing which'd need discussion is how to make it easy to
include/exclude an object (city or unit) from this scripting scheme, or to
switch default behaviors on a group of units. Perhaps some features from FPS
games could be learned, like grouping units (and cities), and setting up
rally points (more specifically - waypoints). So maybe a few more higher
level objects could be useful, like:
UnitGroup (with interesting methods like RallyAt(x,y), and properties like
Ruleset)
CityGroup
Route (a set of connected map points)

The way this could evolve into hybrid human-AI is pretty obvious. Human
makes all the strategic decisions, while management and defense are handled
in a predictable manner, customized to each player's needs. More so, several
years down the road, AI might be able to completely take over and keep up
with humans once we learn to break down the game into a set of manageable
tasks. I'm not sure if that's where the game needs to be, though. Having a
scripting language would give a clear advantage to people who like to
program (even though I'm sure there'd be plenty of generic "skins" to choose
from).

- Paul
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.