On 16 September 2012 15:52, Matthias F. Brandstetter <m...@mabra.me> wrote:
> Hi Freeciv Team!
>
> I am a PhD candidate at De Montfort University in UK, working on
> Computational Intelligence for Computer Games. For my current studies
> I am thinking of using Freeciv as test bed for my research on AI in
> games.
>
> On your web site I have seen that you are currently re-writing the AI
> code for v2.4.

 Actually, we've for most part ceased feature development for 2.4 last
November when we branched stable branch to make 2.4 releases from once
it gets stable enough. That AI reorganization was finished before
that, though, and in since then there has been only a litlle bit of
development on this field on trnk (from which next branch will be 2.5)

 That was not so much rewriting the AI code itself than reorganizing
how it gets called. AI code used to be mangled to all server code, now
things are more modular, AI code being separate from the other server
code. It was done in a way that completely new AI implementations can
be introduced as (loadable) modules - distinct players can use
distinct AI implementations. Server calls AI callback functions at
defined situations. Those callback functions for AI module to
implement are listed in common/ai.h. In addition to those callback
functions module needs to define just two functions, one to initialize
it and second to return its capability string for checking
compatibility between the server code and the module while loading the
module.

> Is there any document describing the "big picture" for
> custom AI's? I have skipped through the latest source code a bit, seen
> the AI stub and ai.* files in the "common" dir, but I am not sure
> about each of these functions in detail,m when they are called, etc.

 I'm afraid the documentation is still quite much lacking - so far
I've only added comments to common/ai.h about when each callback gets
called.

 As AI runs just as part of server binary, it has access to all the
data, freedom to modify it any way it wants, and to call any server
functions. This means that AI module can cheat as much as author dares
to make it to cheat. It also gives AI author responsibility not to
mess game state.

> Also, I am new to Freeciv dev in general, have not worked on the code
> so far, only played the game in the past. What would be the best way
> of debugging my own development? When writing a new AI for Freeciv, I
> of course want to see how it works  bit for bit, so a debugging feature
> would be very handy!

 There's no single catch-it-all feature for debugging. Depending on
what exactly I've wanted to know, I've combined several techniques. In
most cases you want to run autogames (games with no human players)
with predefined random seeds for reproducibility. You can run them in
debugger, collect logs (get familiar with logging macros in
utility/log.h) and compare results between original and modified AI,
creating starting situations in editor.

 That's the most general level view, feel free to ask more detailed
questions once you get yourself familarized with the code.


 - ML

_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to