Israel <israel_...@yahoo.com.br> writes:

> Hello,
>
> I am interested in working on FreeCiv AI, and would like to know if there is
> any documentation or "begin reading this" doc to help me. It's my first 
> contact
> with the freeciv code, so maybe I should start from something more general 
> than
> the AI itself.
>
> I have already downloaded the source code (altough not compiled it yet) and
> read these wiki articles:
> http://freeciv.wikia.com/wiki/AI_Documentation
> http://freeciv.wikia.com/wiki/AI_Plans
>
> I'm a brazilian civ fanatic (but no relation with civfanatics.com) and 
> actually
> studying in a "Master in Computer Science" course. I have some ideas that may
> improve freecivs' AI global decisions, more specifically what each city will
> build in a turn. But first I would like to understand better how it is done
> today, so I can evaluate if my idea makes sense or not. If the results are 
> good
> I plan to use them on my final work and, of course, make it part of the main
> freeciv code (if it is good to the project too).
>
>
> Thanks for any help
>
> Israel

Personally I think it would be a good idea to scrap the AI and start
again. The code has so much bitrot in it and the rest of freeciv has
changed so much that bringing it up to date might just be more work.

I would also like the AI to run as seperate client (that way it can't
use privileged information from the server at all) or at least seperate
thread. In large maps the AI takes a majority of the time and nowadays
multi-core systems are more and more common. Freeciv would run 4 times
as fast here with the AIs spread over 4 cores.

An argument for seperate AI clients would also be that it makes
developing the AI more fun. You can start your game and play it a bit
and when you notice something off you kill the AI, fix the issue and
restart the AI all without stopping the game. Or when the AI crashes the
game continous. Or you can easily play different versions of the AI
against each other.



As to what is wrong with the AI here are a few things:

- road/rail building

Road/raid is build by looking at a tile and its neighbours. Building a
road/rail when two neighbours have one connects them so it gives that a
big bonus. Apart from that it looks where roads would be beneficial to a
city. More or less.

Here one could do 3 thinks to improve this:

1) plan to connect 2 cities with a road/rail, find a good route for the
road/rail and then send worker to the affected tiles. Also consider
road/rails to future cities.

2) keep track of where units move. Tiles that units cross a lot need
road/rail first.

3) If you are a worker and you are on a tile without road/rail then build
one before doing whatever you were doing.


- Explore near your land

Explorers move in a way that discovers the most hidden tiles. But what
use it discovering a hidden tile at the other end of the earth if there
is one right next to your city? The score for tiles should be weight by
the distance from the border. Also, with fog of war, the time since a
tile was visible last should be considered. Have the exporers revisit
tiles to see if maybe someone moved in. In effect, after an initial time
of discovering hidden tiles, the explorers should become a border patrol.


- Pick a job and stick with it

Often you see units move towards A and the next turn they all move back
again. That easily repeats. That is just a collosal waste of time. If
you decide to attack with an unit then stick with it for a while. Rember
that you were going to attack something across turns.


- Pick a target and coordinate attacks

This would massively improve the AI, possible to the point where it
becomes anoyingly hard to beat.

Currently afaik each unit on its own decides wether to atack something
and if so then what. Instead it should find something to attack and then
gather a force by finding idle units near it. If a sufficient force is
ready then units should be moved so they all end up attacking the target
at the same turn with a full move left. Since stacking units too deep is
dangerous they could also come in waves. And don't forget to put a good
defensive unit in each stack that won't attak (so it keeps up its
strength).

Building a road/rail towards the target can also help greatly.


MfG
        Goswin

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

Reply via email to