[freeciv-ai] Re: AI Diplomacy 10 - AI attacks me because I haven't met h
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
freeciv-ai@xxxxxxxxxxx |
Subject: |
[freeciv-ai] Re: AI Diplomacy 10 - AI attacks me because I haven't met his allies |
From: |
Manuel Gutierrez Algaba <stemanolo@xxxxxxxx> |
Date: |
Fri, 4 Jul 2003 10:30:11 +0200 |
The following is exactly what I mean by "rules are hard to follow".
As you see, you have to visit a couple of files, and it depends on 3 or 4
function + 10/12 flags, and there appears a lot of other functions which
meaning is clear sometimes or unclear other. Finally, Per must perform a
change in C code that will correct it, but that could might crash the server
by a null pointer assignment or anything. And anyhow, the changes require CVS
and testing.
An aiclient out of the server wouldn't crash server, nor require CVS and the
distribution of rules and flags could be done clearer (or not), at least, it
could be a competition of best "aiclients" since there's no need for an
"official" aiclient , because aiclients would not be part of the "core
freeciv".
El Mié 02 Jul 2003 12:19, escribió:
> Firstly, thank you for implementing AI diplomacy, Per.
>
> While testing the patch, one of the AIs declared war on me the turn after
> making contact, claiming I had attacked his allies. I wasn't at war with
> anyone at the time.
>
> I believe I've tracked down the cause.
> The message the AI sent me is in advdiplomacy.c:
>
> /*** Declare war - against enemies of allies ***/
>
> players_iterate(aplayer) {
> struct ai_dip_intel *adip =
> &ai->diplomacy.player_intel[aplayer->player_no];
>
> if (aplayer->is_alive
> && adip->at_war_with_ally
> && !adip->is_allied_with_ally
> && !pplayers_at_war(pplayer, aplayer)) {
> notify(aplayer, _(TALK(%s) "Your aggression against my allies was
> your " "last mistake!"), pplayer->name);
> ai_go_to_war(pplayer, ai, aplayer);
> }
> } players_iterate_end;
>
>
> So the AIs at_war_with_ally flag for me must have been set even though I
> wasn't at war with anyone. at_war_with_ally is set in ai_data_turn_init()
> in aidata.c.
> It depends on the result of pplayers_at_war()
>
> players_iterate(check_pl) {
> [snip]
> if (pplayers_allied(pplayer, check_pl)
> && pplayers_at_war(aplayer, check_pl)) {
> ai->diplomacy.player_intel[i].at_war_with_ally = check_pl;
> }
> [snip]
> } players_iterate_end;
>
>
> But the pplayers_at_war function in player.c returns true
> for players who haven't met:
>
>
> /***************************************************************
> Returns true iff players can attack each other.
> ***************************************************************/
> bool pplayers_at_war(const struct player *pplayer,
> const struct player *pplayer2)
> {
> enum diplstate_type ds = pplayer_get_diplstate(pplayer, pplayer2)->type;
> if (pplayer == pplayer2) {
> return FALSE;
> }
> if (is_barbarian(pplayer) || is_barbarian(pplayer2)) {
> return TRUE;
> }
> return ds == DS_WAR || ds == DS_NO_CONTACT;
> }
>
>
> So having no contact with an AI's ally is considered grounds for war.
>
>
> David
>
>
>
> ____________________________________________________________
> Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
> http://login.mail.lycos.com/r/referral?aid=27005
-------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freeciv-ai] Re: AI Diplomacy 10 - AI attacks me because I haven't met his allies,
Manuel Gutierrez Algaba <=
|
|