Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2001:
[Freeciv-Dev] Re: AI's advisors actually do stuff
Home

[Freeciv-Dev] Re: AI's advisors actually do stuff

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Baumans <baumans@xxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: AI's advisors actually do stuff
From: Jordan Crouse <jordanc@xxxxxxxxxxx>
Date: Mon, 05 Mar 2001 18:11:03 -0700

Bravo - For those of us who care about the AI, this is a good step. 
However, I wonder about the fixed route that the AI takes when
determining which technologies to research, and which wonders to build. 
I kind of like the way each nation tries to get a particular set of
wonders built (i.e., Italians go for the Leonardo's wonder), so you have
different AI players going for different things.  I would hate it if
every single AI was trying to get the same technologies and wonders
(especially if they all thought like me).  I think that it would be
better if each AI took a different strategy or attitude as to where they
dedicate their time.  This could also be useful when we start
considering AI diplomacy, and how each AI player treats the other.

Just for a small example, consider three attitudes:  Neutral,
Capitalist, and Warrior:

The Neutral player would build up a strong military, but only
defensively.  His main technology goals would be defensive military
units, and anything that encourages trade.  His Wonder goals would be
defensive (Great Wall, etc...), and diplomatic (Marco Polo's Embassy,
etc...).  When this player meets a new AI or human player, his attitude
is always one of peace (unless he is attacked).  

The Capitalist player would build up a moderate military, some attack,
some defensive.  His main technology goals would be a typically modern
army, anything that encourages trade, and income.  His wonder goals
would be economic and growth oriented (pyramids, trading post).  When
this player meets a new AI or human player, he will encourage
neutrality, but he will attack when he believes his best interests are
at stake.

The Warrior player would build up a strong offensive and defensive
military.  His main technology goals will be anything military or
transportation oriented (to move his troops easier).  His wonders will
be military (warrior academy) and transportation (lighthouse, etc.)...

This is just an example, of course, we would define more AI
personalities and make them easily to modify much like nations and
rulesets.

It would be nice if these attitudes were random at startup time, so that
we wouldn't be stuck pigeonholing each nation with a given attitude
forever.  Maybe for those who prefer a more realistic game, this could
be an option.  

I know that this this may bend or even break the ICS rules that everyone
is so passionate about, so ignore me if this is a bad idea.  But when I
play the game, I would like to know that I have a 33% chance that I will
meet a AI player who will want to encourage trade, and a 33% chance of
meeting a warrior.  That gives me more options and considerations other
than immediately choosing war.

Thoughts, flames and death threats are welcome... :)

Jordan

Baumans wrote:
> 
> I've made a diff that tells the ai's advisors what to advise the ai to do.
> It's pretty rudimentary, and right now the "wants" need to be tweaked and it
> needs to have some of the techs that are wanted changed, and really added
> to.
> 
> .--- advattitude.c.orig Tue Feb 27 16:56:52 2001
> +++ advattitude.c Tue Feb 27 17:05:01 2001
> @@ -14,6 +14,7 @@
>  #include "city.h"
>  #include "tech.h"
> 
> +#include "game.h"
>  #include "aitools.h"
> 
>  #include "advattitude.h"
> @@ -25,8 +26,12 @@
>      the moment
>  ***********************************************************************/
> 
> -void attitude_advisor_choose_tech(struct player *pplayer, struct ai_choice
> *choice)
> +void attitude_advisor_choose_tech(struct player *pplayer,
> +      struct ai_choice *choice)
>  {
> +  choice->want = (total_player_citizens(pplayer)> 15 ||
> pplayer->score.unhappy > 2) ? 25 : 5;
> +  choice->choice = find_tech_by_name("Ceremonial Burial");/* for the
> temples, of course*/
> +  if (choice->choice < A_LAST && get_invention(pplayer,choice->choice) !=
> TECH_KNOWN) return;
>    choice->choice = A_NONE;
>    choice->want   = 0;
>    /* this function haven't been implemented yet */
> --- advforeign.c.orig Sat Mar  4 06:52:15 2000
> +++ advforeign.c Tue Feb 27 17:01:52 2001
> @@ -13,8 +13,9 @@
> 
>  #include "city.h"
>  #include "tech.h"
> -
> +#include "player.h"
>  #include "aitools.h"
> +#include "game.h"
> 
>  #include "advforeign.h"
> 
> @@ -27,8 +28,33 @@
> 
>  void foreign_advisor_choose_tech(struct player *pplayer,
>       struct ai_choice *choice)
> -{
> +{
> +  int fotherps = 0;
> +  enum diplstate_type dpl;
> +  players_iterate(other_player) /* any other civs found?*/
> +   if (pplayer != other_player) {
> +    dpl = pplayer_get_diplstate(pplayer,other_player)->type;
> +    if (dpl != DS_NO_CONTACT) fotherps++;
> +   }
> +  players_iterate_end;
> +
> +  choice->want = ((fotherps) ? 10 : 20); /*TWEAK ME*/
> +
> +  choice->choice = find_tech_by_name("Horseback Riding");/*try to find more
> civs*/
> +  if (choice->choice <A_LAST && get_invention(pplayer,choice->choice)!=
> TECH_KNOWN) return;
> +
> +  choice->choice = find_tech_by_name("Map Making");/* to trade maps(and
> find civs) */
> +  if (choice->choice < A_LAST && get_invention(pplayer,choice->choice) !=
> TECH_KNOWN) return;
> +
> +  choice->want = ((fotherps) ? 10 : 5); /*TWEAK ME*/
> +
> +  choice->choice = find_tech_by_name("Writing"); /* Diplomats */
> +  if (choice->choice < A_LAST && get_invention(pplayer,choice->choice) !=
> TECH_KNOWN) return;
> +
> +  choice->choice = find_tech_by_name("Espionage");
> +  if (choice->choice < A_LAST && get_invention(pplayer,choice->choice) !=
> TECH_KNOWN) return;
> +
>    choice->choice = A_NONE;
>    choice->want   = 0;
> -  /* this function haven't been implemented yet */
> +  /* this function should care about the current choice, but whatever */
>  }
> --- advscience.c.orig Tue Feb 27 16:22:30 2001
> +++ advscience.c Tue Feb 27 17:05:56 2001
> @@ -28,6 +28,19 @@
>  void science_advisor_choose_tech(struct player *pplayer,
>       struct ai_choice *choice)
>  {
> +
> +  choice->want = 30;
> +  choice->choice = find_tech_by_name("Monarchy");/* should be one of the
> first goals */
> +  if (choice->choice < A_LAST && get_invention(pplayer,choice->choice) !=
> TECH_KNOWN) return;
> +
> +  choice->want = 10;
> +  choice->choice = find_tech_by_name("Philosophy");/* extra tech */
> +  if (choice->choice < A_LAST && get_invention(pplayer,choice->choice) !=
> TECH_KNOWN) return;
> +
> +  choice->want = 15;
> +  choice->choice = find_tech_by_name("Republic");/* another good government
> */
> +  if (get_invention(pplayer,choice->choice) != TECH_KNOWN) return;
> +
>    choice->choice = A_NONE;
>    choice->want   = 0;
>    /* this function haven't been implemented yet */
> --- advtrade.c.orig Mon Feb 26 18:11:04 2001
> +++ advtrade.c Tue Feb 27 17:06:33 2001
> @@ -27,6 +27,13 @@
> 
>  void trade_advisor_choose_tech(struct player *pplayer, struct ai_choice
> *choice)
>  {
> +  choice->want = 20;
> +  choice->choice = find_tech_by_name("Trade");/* pretty obvious, really */
> +  if (choice->choice < A_LAST && get_invention(pplayer,choice->choice) !=
> TECH_KNOWN) return;
> +
> +  choice->choice = find_tech_by_name("Map Making");/* to find civs to trade
> with */
> +  if (choice->choice < A_LAST && get_invention(pplayer,choice->choice) !=
> TECH_KNOWN) return;
> +
>    choice->choice = A_NONE;
>    choice->want   = 0;
>    /* this function haven't been implemented yet */



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