Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2005:
[Freeciv-Dev] Re: (PR#12735) posting patches
Home

[Freeciv-Dev] Re: (PR#12735) posting patches

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#12735) posting patches
From: "Brian Dunstan" <bdunstan149@xxxxxxxxx>
Date: Thu, 14 Apr 2005 10:34:05 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12735 >

--- Benoit Hudson <bh@xxxxxxxxxxxxxxxxxxx> wrote:
> 
> <URL:
> http://bugs.freeciv.org/Ticket/Display.html?id=12735
> >
> 
> > OK, but before making any changes, those
> configuration
> > parameters would have to be decided.  Should, for
> > example, militarism be a boolean, or should it be
> on
> > some scale e.g. 1-100? 
> 
> One thing that would be great is to drag out all
> the hard-coded constants all throughout the AI 
> code and make that be something read in from 
> file and looked up in a table.
> 
> Given that, we could do pretty much anything
> we felt like, like making militarism increase
> parameters X and Y by some % but set Z to zero.


OK I am attaching a diff with a first draft of how to
represent the AI's personality traits.  I think a
0-100 scale is better because of the flexibility it
gives.  In user interaction you could always have a
small number of 'presets' that could be used, "nice
ai" or "nasty ai" for example.  You could also have a
function that prints a short descriptive string for a
particular setting.

Some of these things I think will be relevant for
making refinements to the settler code -- e.g. the
relative need for food and trade on the one hand, and
shields on the other, will depend on the play style of
the AI.


                
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/
diff -Nur -Xfreeciv/diff_ignore freeciv/common/player.h 
freeciv-altered/common/player.h
--- freeciv/common/player.h     2005-04-14 09:59:38.751789256 -0400
+++ freeciv-altered/common/player.h     2005-04-14 10:15:27.078621664 -0400
@@ -58,6 +58,34 @@
   H_REVOLUTION = 4096 /* Cannot skip anarchy */
 };
 
+
+/* AI personality trait [0-100]
+ * where 100 is having this trait in excess,
+ * and 0 is having almost nothing of this trait. */
+enum personality_trait {
+  PT_AGGRESSION, /* starts wars early and often */
+  PT_MILITARISM, /* emphasis on quantity and quality of offensive units */
+  PT_EXPANSIONISM, /* tries to maximize land area and number of cities */
+  PT_URBANISM, /* emphais on building very large, very productive cities */
+  PT_CURIOSITY, /* emphasis on research of all kinds, especially prerequisites
+                * for the space race.  Other investments made if they 
+                * will increase research in medium term.  */
+  PT_MERCANTILISM, /* Strives to build trade routes to foreign cities, and 
remote 
+                   * domestic cities.  Responds more readily to financial 
incentive */ 
+  PT_DIPLOMACY, /* eager to form diplmatic agreements of all types, e.g.
+               * alliance, cease fire, tech trade, map trade */
+  PT_HONESTY, /* honors all agreements in all cases */
+  PT_ENVIRONMENTALISM, /* tries to avoid pollution, cleans polluted tiles,
+                       * and avoids use of nuclear weapons */
+  PT_SURVIVALISM, /* takes care to make sure cities are very well defended,
+                  * using units, defensive improvements, city site selection,
+                  * and terrain transformation */
+  PT_LAST
+};
+
+typedef enum personality_trait Personality_Trait_id;
+
+
 struct player_economic {
   int gold;
   int tax;
@@ -144,6 +172,8 @@
   enum barbarian_type barbarian_type;
 
   int love[MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS];
+
+  int personality[PT_LAST]; /* settings, 1-100 of traits */
 };
 
 /* Diplomatic states (how one player views another).
@@ -314,6 +344,15 @@
   }                                                                           \
 }
 
+#define personality_trait_iterate(trait)                                   \
+{                                                                          \
+                                                                           \
+  for (trait = 0; trait < PT_LAST; trait++) {
+
+#define personality_trait_iterate_end                                      \
+  }                                                                        \
+}
+
 /* ai love values should be in range [-MAX_AI_LOVE..MAX_AI_LOVE] */
 #define MAX_AI_LOVE 1000
 

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