Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2001:
[Freeciv-Dev] Re: Client AI development
Home

[Freeciv-Dev] Re: Client AI development

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: <rf13@xxxxxxxxxxxxxxxxxxxxxx>
Cc: freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: Client AI development
From: Cameron Morland <cjmorlan@xxxxxxxxxxxx>
Date: Thu, 19 Apr 2001 06:36:57 -0500 (EST)
Reply-to: <cameron@xxxxxxxxxx>

La 2001-04-19, Raimar Falke skribis:

> Cell based client structure
> ===========================

First of all, I really like the idea of making the entire AI writable
in any language, especially considering how AI has historically been
done primarily in Lisp (now Scheme). Emphasising standards-compliance
by the use of XML and so on is also a good idea. This method also
permits many AIs to easily be written in many different ways, which
may make it worthwhile in any case. However, this is an awful lot of
coding, so it might take quite a while. Continuing to do it in C might
not be so terrible, especially if the AI section can be logically
separated from the rest of the code.

I have a simpler way, which I intend to explore during my spare time
in the summer. The idea is of Behaviour Based Robotics, developed at
MIT by Rodney Brooks and others. In a nutshell, BB involves tying the
inputs of the robot very closely to the outputs, and using several
layers of the input-output pairs. This is known as the subsumption
architecture. The idea is to have many layers of behaviours stacked
upon each other. If higher-level behaviours are broken (or not written
yet) the agent is still able to function, just at a lesser competence.

For a thorough examination of Behaviour Based Robotics, read Brooks'
paper _Intelligence Without Reason_ found at
<http://www.ai.mit.edu/people/brooks/papers/AIM-1293.pdf>, or any of a
number of other papers at
<http://www.ai.mit.edu/people/brooks/papers.html>.

So an outline of my AI would be this: each unit is an autonomous
agent, which gets its information from the map, and marks information
on the map, permitting communication between units. This allows
selection of action; there are very few possible actions for a
non-settler unit --- move, attack, fortify, pillage, disband. A
handful of subsumption-architecture layers control the actions. (The
same is true for settlers, they just have a bunch more things to do.)

This deals with individual units. An additional bit of code is
required to make each city an autonomous unit. The city controls only
setting production, placing citizens, and some unit control (shields,
happiness). Cities communicate again via the map, both with each other
and with units.

A third AI type is required; this is the civilization. The
civilization sets tax rate, selects advancements, does diplomacy,
and chooses government. It also communicates via the map.

An appropriate combination of these should be workable. It should also
be possible to automate generation of some of the intelligence,
because optimally-intelligent behaviour is likely to be
ruleset-dependent.

So my intention is to start with the first section, the individual
units. This means I can simply add a "automate military unit" item to
the Orders menu, then fiddle with the AI. Levels of competence could be
something like this:

- If could be attacked by much stronger unit, retreat.
- If could attack much weaker unit, attack.
- If could be attacked, move to a defendable tile, such as a hill.
- If could be attacked, fortify.
- If are a good defensive unit, move towards areas of the map that
  feel undefended, such as empty cities.
- If are not a good defensive unit, make the map near you feel
  undefended, especially if you see an enemy unit.
- If are fast, seek unknown land.
- Make good tiles near enemy cities feel undefended. (To encourage your
  old trireme to sit on his whales. :) )

A few more levels like that should provide reasonable behaviour. The
details, of course, need to be worked out.

This should be testable at all points, with a human controlling city
and civilization functions. Once this works, code for making
autonomous cities is required, and eventually, autonomous
civilizations.

You might notice that Raimar's design is essentially a design of my
civilization AI; I just want to make each unit and city a seperate,
autonomous entity below the civilization. Did you come up with the design
on your own? It's quite BB-ish.

Fun, eh? I'm going to Europe for a month, but when I come back this will
be my project, if I have any spare time. This has been "simmering"  for
some time, but I've been too busy to make any progress.

This sort of design has the advantage of permitting small patches to
implement it; one patch for "automate military unit", one patch for
"automate city", one patch for "automate civilization", one patch for "get
rid of this now-useless GUI". I guess there could be an option "--nogui"
or somesuch on the client, and the server could spawn the appropriate
number of GUI-less clients.

+----------------------------------------------------------
| PGP http://www.eng.uwaterloo.ca/student/cjmorlan/pgp.txt
| cjmorland@xxxxxxxxxxxx
|
| Thought is not a management function.
|     --John Ralston Saul
+----------------------------------------------------------





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