[Freeciv-Dev] Finishing up AI dialogue
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
> > > > I noticed this. I sent some patches a long
> while
> > > back to Thue trying
> > > > to fix the movement code, because so much of
> the
> > > code has majic
> > > > numbers in it.
> > >
> > > Do you still want this? Do you have updated
> patched?
> >
> > The code was accepted some time ago. I haven't
> sent
> > any new patches because I was beaten by the magic
> > number problem. I'll probably return to it some
> day.
>
> This would be nice. Note that we are currently two
> small steps from
> the goal of a remove-all-magic-direction-numbers
> crusade.
What two steps would be needed to make this a general
get rid of all the magic numbers crusade? By the way,
I was not at all involved in magic direction numbers,
I was responsible for the introduction of
SINGLE_MOVE_COST
and other movement constants to replace magic numbers
used in various places in the AI code. If you're
interested I could probably dig up my original patch
to show you, but I see no point as it's already part
of the freeciv code. My original plan was to allow for
units that had different costs for moving over
terrain, different rulesets where railroad move cost
would not be
0 etc.
> > Incidentally I noticed a small mistake in the
> code. In
> > the function below
> >
> > +static unsigned int cache2_hash_val_fn(const void
> > *key,
> > + unsigned int num_buckets)
> > +{
> > + const struct cache2_key *pkey = (const struct
> > cache2_key *) key;
> > + unsigned int result = 0;
> > + int x, y;
> > +
> > + for (x = 0; x < CITY_MAP_SIZE; x++) {
> > + for (y = 0; y < CITY_MAP_SIZE; y++) {
> > + result |=
> (pkey->worker_positions_used[x][y] !=
> > 0);
> > + result = result << 1;
> >
> > you're still using for (x = 0; x < CITY_MAP_SIZE;
> x++)
> > {
> > + for (y = 0; y < CITY_MAP_SIZE; y++) {
> > where everywhere else you seem to use
> city_map_iterate
>
> Thanks for spotting this. Yes the code is a bit old
> and I was young
> when I wrote this ;)
>
> > > My current code is attached. It may no be
> properly
> > > documented (but at
> > > least I use longer variable names) and may also
> not
> > > be apply cleanly
> > > to a current cvs version. I hope to get this and
> > > some futher agents
> > > into the code. Any feedback is welcome. The
> citizen
> > > management agent
> > > (CMA) is the most debugged and documented piece
> of
> > > code.
> >
>
> > Actually I wanted to congratulate you. Most of the
> AI code is
> > impossible to follow, but I understood more of
> your AI code in 5
> > mins of looking at it then I have of the freeciv
> AI code and I've
> > spent at least a few weeks trying to understand
> it.
>
> Thanks.
>
When is your diff going into the CVS? Anything I can
do to make it quicker, name it. Far easier to work
with your AI code than the existing one.
> > Still, put more comments in please.
>
> I plan to add a general overview. Please tell me
> what other places
> needs clarification.
>
> > > > I wanted to know if there are any existing
> ideas
> > > about how to
> > > > implement a better AI. With the diplomacy
> system
> > > in place, we can
> > > > finally have a competitive AI player. With
> the AI
> > > trading techs and
> > > > making alliances the human player will finally
> > > have some difficulty
> > > > beating the AI. With someone else hopefully
> > > fixing the AI problems
> > > > with handling planes and ships a competitive
> late
> > > game AI could be
> > > > here.
> > >
> > > I think that a ai which is good at diplomacy is
> much
> > > more difficult
> > > that an ai which handle the basic game mechanics
> > > (tech tree
> > > management, city management,..) right.
> >
> > I'm planning to start off small handling just
> trading
> > techs with players not currently at war with you.
>
> So you first have to teach the AI to not go at war
> with each player. I
> think this task is not easy.
>
> > I'm planning to have the AI by default share world
> maps.
>
> Does this benefit the AI?
>
It certainly benefits the AI. The AI currently
indulges in massive cheating, using data not available
to the human player. But by not cheating, the AI is at
a massive handicap. By having the AI always agree to
swap world maps with players
1) reduce the AI need for exploration until when the
whole map is uncovered no explorers are produced.
2) Pathfinding problems crop up far less often for
all the AI players(esp regards to trireme and air
units)
When you consider by the time of the development of
flight all the world could be uncovered anyway there's
no real disadvantage.
3) AI can see quicker where to expand without
cheating.
For the future when I have time I plan to have the AI
expand in the direction where there is most tiles
free.
4)helps me out in attack planning no end, if the civ
is not even on the same continent as you then peace
should
be possible right up until the AI launches a sneak
attack on you.
Also helps in the search for other civs to help the AI
if it is losing cities and cannot buy a ceasefire or a
peace treaty.
> > I'm also going to solve the tribute problem, if
> you're much bigger
> > than the AI it will offer up tribute.
> >
> > Incidentally, should I care about the
> civilisations perfectionist
> > etc tags at all. It's not used anywhere in freeciv
> as far as I can
> > tell.
>
> What kind of tags are you talking about?
>
I'm talking about the tags in the same file as the
name of the civs cities, the name of the civ itself,
which wonders the civ should pursue etc. There is
usually a tag describing the civ as perfectionist or
expansionist.
But I believe it is almost always ignored.
> Raimar
>
> --
> email: rf13@xxxxxxxxxxxxxxxxx
> "Are you saying that you actually used the
> Classpath Java AWT classes in
> addition to the GTK peers and got them to display
> something?
> Wow. That's way better than I did and I wrote the
> code!"
> -- Aaron M. Renn in the classpath mailing list
>
__________________________________________________
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/
|
|