Complete.Org: Mailing Lists: Archives: freeciv-ai: February 2006:
[freeciv-ai] AI Explorer Improvement Idea

[freeciv-ai] AI Explorer Improvement Idea

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-ai@xxxxxxxxxxx
Subject: [freeciv-ai] AI Explorer Improvement Idea
From: Kenneth Strom <the_one_relic@xxxxxxxxx>
Date: Sat, 25 Feb 2006 20:11:55 -0800 (PST)

Freeciv AI explorer modification.

Can't seem to get to the freeciv forums to check the
link that requested AI improvements.

This specifically deals with the problem area of
explorers and a way to fix the AI/auto explore
of land based explorers, however, I think it may well
work for sea based too as long as the current checks
for the trireme is left in or calculated for in new
code.  I am not sure, however, if the changes can be
implemented in a way that is speedy enough for the
players, but I believe they might be.

The major problem with exploration is that it takes
into account the position of the explorer piece and
surrounding territory.  This causes explorers to
in one direction leaving gaps in detection around the
starting area and first few cities.  The explorer will
then wander in that direction non-stop till it hits a
shoreline and is forced to turn.  On high land maps
this can be quite some time, and makes an AI/auto
explorer quite worthless.

The solution to this is to create a search map (full
map xy size) for each player at the start of the game.

At 1 byte per map square this shouldn't be too much
memory use at all. Each map will contain values from
128 (starting position) to 0 (already explored) and
value of 150 (hut here).  

At the beginning of the game once the starting
for a player/ai has been determined, the map would be
created.  The map would be filled at the starting
xy with 128 and for each sucessive xy out from the
starting position the counter would be decremented 1
till it was all the way down to 1 if necessary all
spaces left once it hit one would be filled with a
value of 1.  The speed of this is really not a problem
since it is done once at the start of the game.

At the start of each turn, the map would be
transferred into a temporary map.  This is the map the
explorers would use to determine where to go next. 
explorer would seek the nearest high number map xy to
go to.  Once it was targeted for a specific xy to go
to; the map xys around that xy would be zeroed out in
the temp map so that other explorers won't go to the
same spot.

The search map and the temp would have to be updated
at the same time the vision (what a player can see)
is updated with the search map getting a value 150 for
huts found unless they are moved too.

This system will create a more sensible circular
search pattern around the starting point area of the
player/ai.  This will have the effect of sometimes
going over known terrain, but overall getting a better
picture of the surrounding area is worth it.
If a city was created by a hut, then the maps could
have all the surrounding territory for say 5-10 space
add 25 or 50 to their values so that any explorers
would go around that area too.

A possible mod would be to keep what is there but add
a heavy weight (+10000?) desirability to the unknown
xys.  And when an explorer has more than 25? spaces to
go to a valued xy, the normal routine would kick in.

As for the number of land explorers or when explorers
would be made that could be rather simply done without
the suggested WAG in the forums.  A simple formula of
3+(% of map unexplored * map size value[1-29]) and
build explorers if you have 5-7+ cities, should work
decently. Once the above is implemented it would be
easy to tell how many explorers would be a good idea.

I don't understand the code enough yet to attempt a
mod with these ideas at this time so if anyone else
wants to try it I would be willing to test the

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

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