Thread Tools
Old April 30, 2002, 03:29   #1
Dale
Emperor
 
Dale's Avatar
 
Local Time: 09:48
Local Date: November 1, 2010
Join Date: Dec 2000
Posts: 3,944
Project: AI Unit Useage Script
Hey all. Following on from discussions on the WAW thread, and between Dave and myself, I believe we have come up with a good working model for how the AI could perform in regards to army and naval movement. It's only in pseodocode form at present, but gives a 'plain-spoken' account of how the AI will work in this script.

Feel free to leave any comments/logic bugs/suggestions. This is the "AI army/naval improver" I've been crapping on about for the last week.
Attached Files:
File Type: txt ai unit useage.txt (5.3 KB, 31 views)
Dale is offline  
Old May 3, 2002, 16:12   #2
child of Thor
Call to Power II Democracy GameCTP2 Source Code Project
Emperor
 
child of Thor's Avatar
 
Local Time: 23:48
Local Date: October 31, 2010
Join Date: Jan 2002
Location: UK
Posts: 3,272
Any of this make it into WAW? The transport thing seems familiar?
So as a brief overview, what this aims to do it stack the AI units on land first to attack any enemy cities/units on same continent. If no enemy exists on same continent it will check if at war elsewhere and moves stacks to costal cities, to board any transports and move transports to where the action is(and unload stacks to attack enemy). It also stacks Naval units with a mix of different units to attack enemy naval units(this can be any naval unit that is listed in the code right?).Seems sound enough.

On land units you specify 'attack' units, is this to ensure the AI doesn't put weird units in its front line when it attacks?(like having ranged units up front?).
Isn't there a way to make the AI produce the units in a certain order - say for example if its going to war and on the offensive then once it has reasonable city defense(2-3 defensive units of the best type it can feild), It starts to build armies in a ratio of roughly 50% Attack, 25%Flanking+25%ranged. Something like this. So it has reasonable balance in its stacks - but it is going out and attacking the enemy.
If on the other hand it starts to lose more battles than it's winning(can this be checked?), then its build queues change priority so it builds say 25%Attack, 25%Defense,25%Flank,25%ranged units.
Its still on the attack, but has some defensive units to help it.
If it starts to lose cities then it changes again to produce say 50%defensive and 50%ranged units. It stops attacking and looks to build up in its cities to (near) max unit capacity. Once this is done and if its stopped loseing cities it will start the process over again(if its still at war)?
It may already do this i guess? I was just wondering if this kind of level of AI response is open to the modders to mess around with?
__________________
'The very basis of the liberal idea – the belief of individual freedom is what causes the chaos' - William Kristol, son of the founder of neo-conservitivism, talking about neo-con ideology and its agenda for you.info here. prove me wrong.

Bush's Republican=Neo-con for all intent and purpose. be afraid.
child of Thor is offline  
Old May 3, 2002, 19:29   #3
Bluevoss
Prince
 
Local Time: 23:48
Local Date: October 31, 2010
Join Date: Dec 2000
Location: Orlando, Florida
Posts: 326
Will diplomacy be part of this? I know its getting to be a pretty big bite, but right now, everyone is pissing at me, and I haven't had a peace treaty ever.

Yeah, I want to get a good run from the AI, but I dont ALWAYS want to be at war.
__________________
Bluevoss-
Bluevoss is offline  
Old May 4, 2002, 05:08   #4
child of Thor
Call to Power II Democracy GameCTP2 Source Code Project
Emperor
 
child of Thor's Avatar
 
Local Time: 23:48
Local Date: October 31, 2010
Join Date: Jan 2002
Location: UK
Posts: 3,272
I've found that in the initial stages of the game(when your powergraph is ALWAYS the lowest), then no other nation will give you the time of day, to them all(bar the most peacefull ones) you are no more than kangaroo do-do on their shoe. So you will always have this problem untill you have started to dominate the game - then they will grovel. I think having looked at Dale's psuedocode this deals exclusively with the AI land and naval units tactics - so no diplomacy there!
__________________
'The very basis of the liberal idea – the belief of individual freedom is what causes the chaos' - William Kristol, son of the founder of neo-conservitivism, talking about neo-con ideology and its agenda for you.info here. prove me wrong.

Bush's Republican=Neo-con for all intent and purpose. be afraid.
child of Thor is offline  
Old May 4, 2002, 09:21   #5
Bluevoss
Prince
 
Local Time: 23:48
Local Date: October 31, 2010
Join Date: Dec 2000
Location: Orlando, Florida
Posts: 326
When you think about it - it should be the other way around. When you are small and weak in the game, you should be able to do diplomancy to stay alive. Its when you get huge that everyone else should have it in for you.

i.e. What the game currerntly does makes historic sense. But it gameplay sense, its wrong. It should get harder and harder as you get bigger. In my current game, I was fighting tooth and nail against the Macidonians, and the Babalonians were running raids against me, burning fields, and just making my life a living hell. But now that I've FINALLY gotten the edge on the Macs, the Babs have suddenly quieted right down.

Maybe we need a code that triggers when you get to be more powerful then the 2nd and 3rd place races - they should combine (I mean , really combine - become one race under whoever was larger) - call it a diplomatic marrage or a suprise takover. Set them to totally hate you. That way, ballance would be restored to the games week endturns.
__________________
Bluevoss-
Bluevoss is offline  
Old May 4, 2002, 09:50   #6
Peter Triggs
CTP2 Source Code ProjectCivilization IV Creators
King
 
Local Time: 23:48
Local Date: October 31, 2010
Join Date: Jan 2000
Location: Gone Fishin, Canada
Posts: 1,059
Quote:
Isn't there a way to make the AI produce the units in a certain order - say for example if its going to war and on the offensive then once it has reasonable city defense(2-3 defensive units of the best type it can feild), It starts to build armies in a ratio of roughly 50% Attack, 25%Flanking+25%ranged. Something like this. So it has reasonable balance in its stacks - but it is going out and attacking the enemy.
If on the other hand it starts to lose more battles than it's winning(can this be checked?), then its build queues change priority so it builds say 25%Attack, 25%Defense,25%Flank,25%ranged units.
Its still on the attack, but has some defensive units to help it.
If it starts to lose cities then it changes again to produce say 50%defensive and 50%ranged units. It stops attacking and looks to build up in its cities to (near) max unit capacity. Once this is done and if its stopped loseing cities it will start the process over again(if its still at war)?
It may already do this i guess? I was just wondering if this kind of level of AI response is open to the modders to mess around with?
Yes, but personally it hurts my little brain when I start thinking about those kind of details.
Peter Triggs is offline  
Old May 4, 2002, 12:11   #7
child of Thor
Call to Power II Democracy GameCTP2 Source Code Project
Emperor
 
child of Thor's Avatar
 
Local Time: 23:48
Local Date: October 31, 2010
Join Date: Jan 2002
Location: UK
Posts: 3,272
Quote:
Originally posted by Peter Triggs
Yes, but personally it hurts my little brain when I start thinking about those kind of details.

You know, just the other day i was browsing over the forum here and i was filled with an overwhelming thought of how all you Slic guys deserve some kind of vacation.........don't want anyone to suffer burn-out or Slic melt down!
IMO there is too much good stuff that needs attention in terms of what could be done with this game, and not enough people who can actually do it! My sympathies are with you guys.
Still so you are saying it could be done right
__________________
'The very basis of the liberal idea – the belief of individual freedom is what causes the chaos' - William Kristol, son of the founder of neo-conservitivism, talking about neo-con ideology and its agenda for you.info here. prove me wrong.

Bush's Republican=Neo-con for all intent and purpose. be afraid.
child of Thor is offline  
Old May 4, 2002, 19:24   #8
hexagonian
The Courts of Candle'Bre
Emperor
 
hexagonian's Avatar
 
Local Time: 18:48
Local Date: October 31, 2010
Join Date: Jun 1999
Location: Smemperor
Posts: 3,405


This game, along with the Mods would be nothing without SLICers. All I'm doing is just compiling everything that they do into my Mod...That is why Cradle is as good as it is. You can only do so much with the text files.

ALL HAIL THE SLICers!!!!!!!!!
__________________
Yes, let's be optimistic until we have reason to be otherwise...No, let's be pessimistic until we are forced to do otherwise...Maybe, let's be balanced until we are convinced to do otherwise. -- DrSpike, Skanky Burns, Shogun Gunner
...aisdhieort...dticcok...
hexagonian is offline  
Old May 5, 2002, 18:17   #9
Dale
Emperor
 
Dale's Avatar
 
Local Time: 09:48
Local Date: November 1, 2010
Join Date: Dec 2000
Posts: 3,944
Quote:
ALL HAIL THE SLICers!!!!!!!!!
All donations gratefully received.

ANYWAYS, back on topic:

COT:
This script will deal exclusively will land and naval unit useage. Warfare basically. Also, this makes no changes to AI strategies.txt useage. So when an AI is threatened, it's strategy will change. When it builds an "attack" unit (tanks, riflemen, war walkers, etc) then the script grabs that unit. Defense units will not (pikes, mech inf, etc). So, this covers your section as the current strategies.txt in WAW covers your situation, and I'm pretty certain Cradle's does the same thing too.

Bluevoss:
Peter is working on a new diplomatic script. No need to poach ground. Plus, after writing diplomod, I'm a bit over diplomacy now.

Peter:
I've got a script in WAW that does COT's proposal already. Depending on the AI's military numbers in relation to everyone else's, it'll either build attack units, or defense units. This is controlled by strategies.txt, and the build lists. This script is what makes WAW so lethal as the AI spawns units like crazy.
Dale is offline  
Old May 8, 2002, 08:41   #10
child of Thor
Call to Power II Democracy GameCTP2 Source Code Project
Emperor
 
child of Thor's Avatar
 
Local Time: 23:48
Local Date: October 31, 2010
Join Date: Jan 2002
Location: UK
Posts: 3,272
So Dale (if i've understood correctly!) this code includes an 'attitude' adjuster - when the AI is winning battles it builds Attacking units only ,but does it switch to a more defensive mode if it loses battles?(you seemed to say it didn't??). Anyway how do you trigger this change in AI stratagies, is just a case of putting a trigger so when a AI loses X amount of battles it re-orders it's build queues for more defensive units?Can it be coded to trigger on degrees of loss(like the example i gave in my first post)? So you get different stages to the AI's response not just on or off(all attack/all defense)? So far the attacking ability of WAW is very impressive - and i look forward to the defensive code. This will bring all the doubters back when its complete
__________________
'The very basis of the liberal idea – the belief of individual freedom is what causes the chaos' - William Kristol, son of the founder of neo-conservitivism, talking about neo-con ideology and its agenda for you.info here. prove me wrong.

Bush's Republican=Neo-con for all intent and purpose. be afraid.
child of Thor is offline  
Old May 8, 2002, 09:02   #11
Bluevoss
Prince
 
Local Time: 23:48
Local Date: October 31, 2010
Join Date: Dec 2000
Location: Orlando, Florida
Posts: 326
Pipe-dream time - how about code so that the AI will run raider units through my territory. I know that a lot of times, when I'm in a long war with the AI, I'll do a Sheridan on him, burning and pillaging all over the place. Dunno how much it helps the war effort, but it sure is fun.
__________________
Bluevoss-
Bluevoss is offline  
Old May 12, 2002, 09:45   #12
Dale
Emperor
 
Dale's Avatar
 
Local Time: 09:48
Local Date: November 1, 2010
Join Date: Dec 2000
Posts: 3,944
Update and some answers......
You know, it's so bloody hard to beat a "naval AI" when he's got stacks of 8+ floating around! (And all his transports escorted!) I've got the naval stacking component working perfectly.

Oh, whoever asked me ages ago to look at it, sorry but there's no way to make naval units front-line or back-line in the battle screens. Well, not that I could find, and I was hunting to get my aircraft carriers away from the barrels of the enemies battleships and cruisers, while my battleships bombarded from behind.

So this project is moving slowely, but successfully.

COT:

The way the AI attack/defend build strategy in WAW works is like this:
1. The AI works out it's rank based on units per city.
2. If it ranks in the top half, there's still the top 30% threatened cities building defense units as well as the bottom 40% powerfull cities. But the top 40% production cities are building attack units.
3. If it ranks in the bottom half, the AI builds defense units in top 30% threatened, the top 40% production, and bottom 40% powerfull cities.

My theory is that if an AI has a high ratio of units per city, it has units to spare to attack (hence why I made it build attack units), while if it had a low ratio it should be preparing for defense. As it works out, the AI's hitting the high ratio marks are the militarist personalities, while the science personalities are hitting the low mark. It's logical.

Hope this clears it up. Effectively the only difference between the two build-strategies is what the top 40% production cities are doing.

Bluevoss:

You mean guerilla tactics? I was thinking of looking at guerilla warfare after I got this script finished. It could quite easily come into this script.
Dale is offline  
Old May 12, 2002, 11:51   #13
Bluevoss
Prince
 
Local Time: 23:48
Local Date: October 31, 2010
Join Date: Dec 2000
Location: Orlando, Florida
Posts: 326
Something like that - not even guerilla tactics so much as raiding. There are times (sigh - lots of times) where the computer catches me short. I'll bottle up in my cities and he'll run about, not doing anything except an occasinal pillage.

Me, when I got after a city that I'm not that interested in keeping (or that I know won't go down for quite a while, the first thing is to wipe out all the tile improvements. This is where cav really comes into its true form. They can come in with a big stack, scatter and burn a bunch of holdings, and then reform into a stack at the end of a turn.

We have relatives that lived along the Ohio river. There was the story about the confederate raiders who came across the river, burned the farm (and the neighboring farms) and even stole the bread out of the over. Dunno if we can get to that level of detail, but you never know.

Hey, as a side note - has anyone ever considered sieges? If you have ZOC all the way around a city, shouldn't it be cut off from its food sources? Could this be done in the game? Right now, its rather silly that I'm blasting away at a city while herders walk their sheep right past my siege line and into the gates. Just a thot.
__________________
Bluevoss-
Bluevoss is offline  
Old May 12, 2002, 16:43   #14
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 00:48
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
Quote:
Something like that - not even guerilla tactics so much as raiding. There are times (sigh - lots of times) where the computer catches me short. I'll bottle up in my cities and he'll run about, not doing anything except an occasinal pillage.
Is there a GOAL_PILLAGE? Probably.
Have you played Cossacks? The AI in that frequently sends a group of Cossack Raiders into your territory, captures your workers and buildings, then destroys them. It ruins the economy for a good few minutes unless you have a lot of pikemen standing around, because Cossacks are fast!.
__________________
Concrete, Abstract, or Squoingy?
"I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis
Immortal Wombat is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 19:48.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team