Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Miscellaneous > Archive > CtP2-Creation/AI/Mods/Scenarios-Archive > How does the AI think?
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!

bottom of page
  
Author
Thread    < Last Thread     Next Thread > Post New Thread     Post A Reply
Pedrunn is offline Pedrunn
King
of Natal, Brazil
Jul 2001
time: 02:17
  Old Post 28-02-2002 18:19
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
How does the AI think? Support Apolyton, buy Galactic Civilizations

Can anyone explain me what is priority, MaxEval and MaxExec? How those commands works? And how they interact with the Goals in Goals.txt?

Is There a formula? Or even a theory or thought of one?
Anything?

Thanks in advance.

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:17
  Old Post 28-02-2002 18:44 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Remove this text

This ought to keep you busy for a while. Let us know if you have any questions

Pedrunn is offline Pedrunn
King
of Natal, Brazil
Jul 2001
time: 02:17
  Old Post 28-02-2002 23:34
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Get a bigger avatar today!

Thanks Locutus,

Now it is hands at work to have fun.

Something is wrong with that sentence.

Pedrunn is offline Pedrunn
King
of Natal, Brazil
Jul 2001
time: 02:17
Question  Old Post 01-03-2002 02:31
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Full PM-box? Change here!

I read the interview, although i did not went further in the thread.
It really is explanatory.

Still i have some question. But i am aware the simplicity of them. Any experienced AI modder can help.
So far only 2 of them.

1) Richard Explain some strategies like defense, careful and agressive start. Still what about the major 6: Default, Scientist, militaristic, Economic, Ecotopian and Diplomatic. When they are enacted? Seems self-explanatory, but it inst. First i thought it had something to do with the civ or the personality of the leaders. I looked over the files and nothing to connect!
So, Could someone explain me when those strategies are triggered?

2) Same thing about the STRATEGY_ATTACK, STRATEGY_SIEGE and STRATEGY_DEFEND. When are they triggered? They just complement specific parts of the major ones in specific situations?

Last edited by Pedrunn on 01-03-2002 at 04:23

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:17
  Old Post 01-03-2002 12:37 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Tired of ads?

quote:
Originally posted by Pedrunn
I read the interview, although i did not went further in the thread.
It really is explanatory.

The rest of the thread contains some interesting stuff as well, when you have the time you should read that as well (if you weren't planning on doing so already).

quote:
1) Richard Explain some strategies like defense, careful and agressive start. Still what about the major 6: Default, Scientist, militaristic, Economic, Ecotopian and Diplomatic. When they are enacted? Seems self-explanatory, but it inst. First i thought it had something to do with the civ or the personality of the leaders. I looked over the files and nothing to connect!
So, Could someone explain me when those strategies are triggered?

I'm afraid I don't know the details of this from the top of my head, but I'm fairly certain they're related to the personalities.txt file. Wes or Dave or someone might know more about this...

quote:
2) Same thing about the STRATEGY_ATTACK, STRATEGY_SIEGE and STRATEGY_DEFEND. When are they triggered? They just complement specific parts of the major ones in specific situations?

We don't know exactly when they are triggered (yes, they complement the major strategies in specific situations). We've run some tests for the MedMod in the past but the results were inconclusive. Personally I'm in favor of disabling those strategies altogether and adding a bunch of new ones, which can be controlled from SLIC. This way we would know and understand exactly what is going on and thus make a much better AI. I don't have too much time to play around with it myself though...

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:17
Post  Old Post 01-03-2002 23:53 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Help yourself to an AD-FREE life

quote:
Originnally posted by Locutus
I'm afraid I don't know the details of this from the top of my head, but I'm fairly certain they're related to the personalities.txt file. Wes or Dave or someone might know more about this...


From the documaention available here at Apolyton about the personalities.txt I can quote this:

quote:

Discovery - Sets the default state for the Strategies. Effect of these default states is defined in Strategies.txt Valid values: Scientist, Military, Economic, Ecotopian & Diplomatic.


So it looks that the part about the strategies is hard encoded.

For your second question Pedrunn: Peter got the suspicion that strategies like STRATEGY_ATTACK, STRATEGY_SIEGE and STRATEGY_DEFEND aren't used or only used seldom.

I found another interesting thing in this documentaion:

quote:

ThreatFollowThrough - Percent chance to follow through on threats. Valid value: 0.0 - 1.0


So I think that would mean if the value is set to 0.9 the AI will accept my proposals in 90% of the cases after a thread.

That would explain why this strategy works as the values are between 0.7 and 0.9:

What about a map exchange? If not than war.

What about a peace treaty? If not than war. Although the AI will attack me some turns later anyway.

What about a trade treaty? If not than war.

What about an alliance? If not than war.

For me it looks that the threat response logic is also a little bit randomized. Although I have the feeling if I am weak my threats are rejected more often and the AI rejects also city demands, OK I got a city after a threat for a tech once, but it is to easy to make treaties this way.

-Martin

WesW is offline WesW
CTP1/2 Modification Site Admin
Florence, Al., USA
Jan 1970
time: 23:17
  Old Post 02-03-2002 05:44 Visit WesW's homepage!
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Inflate your Upload Space

I agree with Peter regarding the Attack, Defend and Seige strategies. Either they are not used at all, or only for a few turns immediately after war is declared.
One good way to tell would be to alter the unit readiness levels. When I first started the Medpack II, I set the readiness levels to alert for the personality types, and to war for the 3 war strategies. If I remember correctly, I never did see the AIs at war readiness. I set the readiness settings to war for the personality types before long since they needed to be at war to fight barbarians in the early game. (There was a strategy setting in Ctp1 which only lasted for the first 100 or so turns, and had a default setting of war for everyone, along with increased expanison and exploration settings.)

In both games, the theory seemed to be to set up a "code structure", for lack of a better term, which contained code for all of the "neat ideas" that the designers wanted to try out. Then when they started play-testing, they altered, added to, or cut out pieces of this structure as they went along. Unfortunately, there does not seem to have been someone tasked with making sure that these changes did not conflict with or mess up other parts of the code.
In short, there was no Sid Miere or Brian Reynolds who built the game from the ground up as a labor of love and kept a picture of the overall game in his head (or on his desk).
So, in closing, just because the code is there does not mean it is used or that the AI will know how to deal with it should you activate it using slic. This is what worries me in activating the terraforming code that we are debating in another thread.

Peter Triggs is offline Peter Triggs
Prince
Gone Fishin, Canada
Jan 2000
time: 05:17
  Old Post 02-03-2002 06:26
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Remove this text

Hi, Pedrunn

quote:

First i thought it had something to do with the civ or the personality of the leaders. I looked over the files and nothing to connect!



You were right first time. In civilisation.txt, each civ can have either a male or female leader and in both cases the leader is assigned a personality as in:

PHP:

GREEK    
#2    
    
{    
    
CIV_LEADER_NAME GREEK_LEADERM_NAME    
    CIV_LEADER_NAME_FEMALE GREEK_LEADERF_NAME    
    CIV_PERSONALITY_MALE
"PERSONALITY_CEASAR"
    
CIV_PERSONALITY_FEMALE "PERSONALITY_TELLER"




Suppose that the game has decided that the Greek leader is male so that it assigns him the CEASAR personality. It then constructs the strategy he's going to use based on the data in personalities.txt:

quote:


PERSONALITY_CEASAR {
Exploration: Medium
Expansion: Maximum
Discovery: Military
Conquest: Agressive
Trustworthiness: Lawful
Alignment: Neutral



The last three flags are diplomacy things and about all we know about them is:

quote:


// This describes the liklihood that the AI will attack. This can
// also be considered the disposition of the personality.
Conquest: Agressive, Neutral, Passive

// This describes how likely the AI will be to violate agreements
// and follow through on threats. It also specifies how the
// regard of an AI will be changed by the dishonest actions of
// others.
Trustworthiness : Chaotic, Neutral, Lawful

// This describes in general terms the methodology used by an AI
// to accomplish its goals and whether or not the AI cares if its
// actions cost the regard of other empires. Evil actions might
// include killing settlers, the use of slavery and the first
// strike launch of nuclear weapons. The regard consequences of
// an evil act will be less for an evil empire than a neutral or
// good one.
Alignment : Evil, Neutral, Good



The programmers had plans to expose more of the diplomacy system but the company dropped the game before they could do it.

The first three flags, though, link directly to strategies.txt. The Discovery one is basic: it means that the Greek leader will essentially pursue the MILITARIST_DEFAULT strategy. But that's not all, if this was all there was to it the AI would only have 5 strategies: STRATEGY_SCIENTIST_DEFAULT, STRATEGY_MILITARIST_DEFAULT, STRATEGY_ECONOMIC_DEFAULT, STRATEGY_ECOTOPIAN_DEFAULT, and STRATEGY_DIPLOMATIC_DEFAULT.

(BTW, STRATEGY_DEFAULT is the data that initializes the game for a human player. When you start the game the computer has to have some data to go by, this is where it comes from. It's also inherited by the Barbs.)

So the other two flags, Exploration and Conquest, are used to refine these 5 basic strategies. How? Well, a strategy is just a bunch of data and Locutus or Lou Wigman (who I believe has years of experience in DataBase Programming) can probably describe this better than me, but here goes.

As Richard explained,

quote:

In the personalities.txt file (again) each personality has a Exploration: setting. If Exploration: Minimal is set, then
STRATEGY_EXPLORE_NEAR is used, Exploration: Medium loads STRATEGY_EXPLORE_FAR and STRATEGY_EXPLORE_WIDE is loaded by
Exploration: Wide.

If the Exploration: Wide or Maximum [? I think he meant Medium] are set, then STRATEGY_AGRESSIVE_START is used, otherwise STRATEGY_CAREFUL_START is loaded, btw.


In the above example, then, the game will initialize the Greeks with the MILITARIST_DEFAULT strategy and then load STRATEGY_EXPLORE_WIDE, STRATEGY_SETTLE_COMPACT, and STRATEGY_AGRESSIVE_START. The data in these strategies 'overwrite' (this is a metaphor, it's probably some sort of database union operation) the corresponding data in STRATEGY_MILITARIST_DEFAULT so that this latter overwritten data is in fact never used. After the overwriting, the resulting set of data constitutes the Greek's current strategic state.

The same applies to the other personalities. It seems to be a rather odd way of doing this (there's only 9 personalities, so they could have just had 9 default personality strategies) but it allows for some extensibility. In the Alex scenario, Tony Evans defined three new personalities:

PHP:

PERSONALITY_ALEXANDER1
{
  
Exploration: Minimal
  Expansion
: Minimum
  Discovery
: Military
  Conquest
: Passive
  Trustworthiness
: Lawful
  Alignment
: Good

  StrongGreeting DIP_GREETING_FIRST_FOREIGN_1
  WeakGreeting DIP_GREETING_FIRST_FOREIGN_2

  Description PERSONALITY_CEASAR_DESCRIPTION

  ThreatFollowThrough 0.9
}

PERSONALITY_ALEXANDER2 {
  
Exploration: Minimal
  Expansion
: Minimum
  Discovery
: Military
  Conquest
: Neutral
  Trustworthiness
: Neutral
  Alignment
: Neutral

  StrongGreeting DIP_GREETING_FIRST_FOREIGN_3
  WeakGreeting DIP_GREETING_FIRST_FOREIGN_3

  Description PERSONALITY_DEGAULLE_DESCRIPTION

  ThreatFollowThrough 0.7
}

PERSONALITY_ALEXANDER3 {
  
Exploration: Medium
  Expansion
: Average
  Discovery
: Military
  Conquest
: Agressive
  Trustworthiness
: Chaotic
  Alignment
: Evil

  Description PERSONALITY_STALIN_DESCRIPTION

  StrongGreeting DIP_GREETING_FIRST_FOREIGN_4
  WeakGreeting DIP_GREETING_FIRST_FOREIGN_4

  ThreatFollowThrough 0.5
}



and then assigned them to the scenario's various AI players. (In a somewhat devious way: you have to go to the scenario's civ_str.txt to find out that, e.g., Australia is actually the Persian Empire.)


All the other strategies in strategies.txt are loaded in special situations where again they overwrite the data in the AI player's current strategic state and constitute a transition to a new strategic state. Unfortunately, as Locutus mentioned about the war strategies, we really don't have any idea of what triggers these transitions.

There is one comment that Richard made about the defense strategies:

quote:

At the beginning of each turn, the Maximum Threat for an AI is computed, and as the threat increases, the minimum garrison in each city increases. Essentially this is a way to make sure the AI protects its cities with more units when things get more dangereous later in the game. If you add a new strategic state that is triggered every turn (with a priority > 1000 or so) which redefines the garrison counts, then you can use your own system. I forget the actual threat levels and don't have the code available right now to check when each level is invoked.


The problem here is that I don't think there's any SLIC function that returns this "Maximum Threat" so we'd have to write our own. Assuming we did this, we could then put whatever data we wanted into those defense strategies and put in a handler like:

code:
HandleEvent(NextStrategicState) 'LoadDefenseStrategies' pre { int_t MaxThreatVal; MaxThreatVal=GetThreatTo(player[0]); if (MaxThreatVal<100) { ConsiderStrategicState(player[0],StrategyDB(STRAT EGY_DEFENSE_NONE),1500); } elseif (MaxThreatVal<300) { ConsiderStrategicState(player[0],StrategyDB(STRAT EGY_DEFENSE_VERY_LOW),1500); } elseif (MaxThreatVal<500) { ConsiderStrategicState(player[0],StrategyDB(STRAT EGY_DEFENSE_LOW),1500); } elseif (MaxThreatVal<700) { ConsiderStrategicState(player[0],StrategyDB(STRAT EGY_DEFENSE_MEDIUM),1500); } elseif (MaxThreatVal<900) { ConsiderStrategicState(player[0],StrategyDB(STRAT EGY_DEFENSE_HIGH),1500); } else{ ConsiderStrategicState(player[0],StrategyDB(STRAT EGY_DEFENSE_VERY_HIGH),1500); } }


But we're not stuck with using the strategies that are already there in strategies.txt. Joe's document "AI Modification via SLIC" contains what is actually a good (although very condensed) description of how we can use SLIC to get the game to use our own strategies. I think Martin G and player1 did some stuff along these lines but I can't remember where.

Pedrunn is offline Pedrunn
King
of Natal, Brazil
Jul 2001
time: 02:17
  Old Post 02-03-2002 17:31
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Help yourself to an AD-FREE life

quote:
Originally posted by WesW
I agree with Peter regarding the Attack, Defend and Seige strategies. Either they are not used at all, or only for a few turns immediately after war is declared.

This is good idea. The Ai must be more agressive after declared war. Too bad we are not certain about that and how long it last. Maybe a slic to control that would be good.

quote:
Originally posted by Peter Triggs
Suppose that the game has decided that the Greek leader is male so that it assigns him the CEASAR personality. It then constructs the strategy he's going to use based on the data in personalities.txt:

I got that from Martins explanation. But can i add new personalities? and remove old ones? If so, do we have to do somethimg before besides change the CIV_PERSONALITY in civilisation.txt.

quote:
Originally posted by Peter Triggs
The programmers had plans to expose more of the diplomacy system but the company dropped the game before they could do it.


quote:
Originally posted by Peter Triggs
(BTW, STRATEGY_DEFAULT is the data that initializes the game for a human player. When you start the game the computer has to have some data to go by, this is where it comes from. It's also inherited by the Barbs.

You mean the Barbs change Strategy over the time?



quote:
Originally posted by Peter Triggs
code:
HandleEvent(NextStrategicState) 'LoadDefenseStrategies' pre { int_t MaxThreatVal; MaxThreatVal=GetThreatTo(player[0]); if (MaxThreatVal<100) { ConsiderStrategicState(player[0],StrategyDB(STRAT EGY_DEFENSE_NONE),1500); } elseif (MaxThreatVal<300) { ConsiderStrategicState(player[0],StrategyDB(STRAT EGY_DEFENSE_VERY_LOW),1500); } elseif (MaxThreatVal<500) { ConsiderStrategicState(player[0],StrategyDB(STRAT EGY_DEFENSE_LOW),1500); } elseif (MaxThreatVal<700) { ConsiderStrategicState(player[0],StrategyDB(STRAT EGY_DEFENSE_MEDIUM),1500); } elseif (MaxThreatVal<900) { ConsiderStrategicState(player[0],StrategyDB(STRAT EGY_DEFENSE_HIGH),1500); } else{ ConsiderStrategicState(player[0],StrategyDB(STRAT EGY_DEFENSE_VERY_HIGH),1500); } }


And what about the hard-coded defense change. It became unusefulwith thiscode. As i compare it from Richard Meyer Explanation, they both work exacly the same.

quote:
Originally posted by Peter Triggs
But we're not stuck with using the strategies that are already there in strategies.txt. . I think Martin G and player1 did some stuff along these lines but I can't remember where.

I have seen those threads

quote:
Originally posted by Locutus
Personally I'm in favor of disabling those strategies altogether and adding a bunch of new ones, which can be controlled from SLIC. This way we would know and understand exactly what is going on and thus make a much better AI. I don't have too much time to play around with it myself though...

Agreed. But only by disabling what was written by the programs we can achive that.

player1 is offline player1
King
Belgrade, YU
Sep 2001
time: 06:17
  Old Post 03-03-2002 03:25
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations: Deluxe Edition

Hi, just one qick info about strategies.

As far as I know, while AI is in peace it doesn't use any of them, while when it is in war is uses ONLY SEIGE startegy.

But, sometimes it looks like it goes back to normal start. while in war.


Personally I think that having a trigger wich activates 2 or 3 starteigies
randomly every turn:
-one turn: Bombard with planes
-second tuen: attack with Tanks-
-etc...

I think sombody did this for WW2 scenario.



P.S.
All this mystic is exsisting because Activison REMOVED FLI files (CTP1) which controlled AI stratgy activation sequence.

Why did they removed that?

Pedrunn is offline Pedrunn
King
of Natal, Brazil
Jul 2001
time: 02:17
  Old Post 04-03-2002 18:30
Edit/Delete Message Reply w/Quote
#11 Report this post to a moderator
Support Apolyton, pre-order Civilization IV

I am making some modmaking but i have bumped into a problem.
The AI isnt building enough caravans and has negative gold imput!!!

How can i change the AIs atitude towards trade?

And can someone please write a code for me?
I want to change the the AIs strategy to something like STRATEGY_GOLD_RUSH everytime the gold imput is negative or (if not possible) when AI gold reserve reachs zero.

Last edited by Pedrunn on 04-03-2002 at 18:36

player1 is offline player1
King
Belgrade, YU
Sep 2001
time: 06:17
  Old Post 04-03-2002 19:17
Edit/Delete Message Reply w/Quote
#12 Report this post to a moderator
Support Apolyton, pre-order Civilization IV

quote:
Originally posted by Pedrunn
I am making some modmaking but i have bumped into a problem.
The AI isnt building enough caravans and has negative gold imput!!!

How can i change the AIs atitude towards trade?

And can someone please write a code for me?
I want to change the the AIs strategy to something like STRATEGY_GOLD_RUSH everytime the gold imput is negative or (if not possible) when AI gold reserve reachs zero.


Maybe give higher priority to caravans in build_list? (closer to top)
Don't remebemr what I used in my MOD (so long time has pased from last time playing&MODing CTP2).

Check build lists in MedMOD, Cradle, Apolyton and (of courese) my own mod (MyMod v0.99, can be found in these threads).

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:17.
Apolyton Time is 00:17.
    top of page
Rate This Thread:
archivepost
Forum Jump:
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0520 seconds (90.68% PHP - 9.32% MySQL) with 31 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net