GG BBAI code

phungus420

Deity
Joined
Mar 1, 2003
Messages
6,296
I added some new code to the RevDCM core, that might make it into BBAI, though most of it wouldn't effect a non modded game. Basically the old code went like this:

[psuedocode]
If player feels it is danger:
-Look for unit to attach to with specific UnitAI type to attach to, if there is a good one, do it
*Otherwise:
Settle in a city
*maybe build a Military acadamy if AI gets here
-Settle in a city then
----If GG can't do anything useful where it is, it should run it's tail off
[/psuedocode]

I changed it so it goes:
[psuedocode]
Look to see if you have a WorldWonderClass unit, if you do, see if there is a good unit to attach to, if there is a better unit then a WoldWonder unit to attach to, forget it
-If player feels in danger, run normal AI atachement code
*Otherwise:
-Roll some dice to see if you want to settle a city
--If not, look for a unit to attach to again with some looser logic
---If not look to build a Military acadamy
*If none of that works:
-Look to settle again
---If GG can't do anything useful where it is, it should run it's tail off
[/pseudocode]

Now the looking for a world wonder class unit is somewhat resource intensive too, but I can't see a better way to run this check, plus it just makes sense to me looking at the base BBAI code (and it evaluates the worldwonder unit to see if it's good, so it's not going to attach to worthless modded units). Mainly though I'm wondering if it makes sense for it to roll dice on whether or not to settle or run some looser attachment logic. That attachment logic was written by jdog, but just never really used so far as I could see. I think the way I have it do stuff now makes the most sense, but if someone has better ideas of how to get the AI to use (and keep in mind mods --that use existant XML) it's great generals, let me know. I think it's other GP logic is pretty damn good though, but GGs, it pretty much just always settled them (and in the capital too, I should probably look at how it chooses the city to settle in, now that I think about it).
 
I think the AI should try
  1. building a Military Academy in a high production city
  2. creating a super-healer if in a total war or planning one, if there isn't one already
  3. attaching to a good limited unit to make it even more dominating (attach to Legends)
  4. settle as military instructor in high production city (account for military production modifiers)
At least that's how I'd do it if I was an AI. As a human I always attach the GG to a warrior I still have left from the stone ages and upgrade it for free then.
 
Top Bottom