Better than BTS

I remember the wonderful "discussion" you had with Bhruic regarding "worker behaviour" and the like and that plus AI-build schedules would have to be yet another prime avenue for improvement. Not a simple problem at all to say the least!

Like Yakk said, the BTS AI is already very cool. Help on a project like this is zeroing in on the tough task of visualising "clear" avenues of progress that can be made through the haze and the maze of the "ghost in the machine" of unintended consequences.

Cheers.

Another difficult and interesting improvement avenue would be the AI assessment of the strength of an enemy stack of units compared to their own stack of units, especially when attacking cities. More in general, the AI battle behaviour might be an area that could be improved although I guess it's a hard nut to crack. Some discussion about this matter also took place in Bhruics thread.

Maybe easier would be improving the AI's use of money to spread corporations. From my experience, the AI is not very capable at saving money to spread corporations. It spends its money to upgrade units and rush buy stuff (according to Bhruic) and nothing is left for using the corporate executives it has constructed. Bhruic taught the AI to not build an endless supply of corporate executives, but the heart of the problem is the AI's problem with saving money for spreading corporations.
 
That's just for choosing whether to pick a fight, in terms of the tactical choices of which city to attack I believe there is no check for defensive power.

Thanks for that and I understand that determining whether and how this check happens in some indirect way is ongoing....

We need ideas no question. My thoughts on improving the ai in modest ways are at least these:
1) Algorithm "improvement" or new algorithm to check specific defensive power of the intended attack target prior to launching a border attack and then either cancelling, postponing or modifying the war plan. The BTS method at the moment is already a big improvement on Jdog's observation about the old days when you could keep the AI double guessing "infinitely" which was not good. Now what should happen is that the AI's single minded attack target decision has to be honed even more prior to launch.

2) Improving the calculate path distance algorithm in CvCityAI now that CPU power has gone up since BTS was released.

3) Introducing an algorithm that allows AI cities to share and work common plots without having to redo the entire plot improvement and worker algorithms. Not a simple problem! at all because of "oscillation" issues and the like.

4) Revisiting Roland's and Bhruic's excellent investigations into the AI ripping up towns. What was the conclusion?

5) Many other ideas including all Yakk's and Jdog's ideas.

6) Working out how to do all this and still get the dishes washed.

Cheers.
PS) I wish I had the knowledge to answer Yakk's excellent question on whether: "The value we get from this calculation -- is it relative? Is it absolute?"

From my perspective it could be catagorized as this:
Affine-itdifficult? (every change in value declares my ignorance) :rolleyes:
 
Could we split this forum into seperate topics? There are so many different areas of potential improvements that can be made in small but significant ways. Sub-forums could be:
Better BTS war strategy
Better BTS war tactics
Better BTS city production
Better BTS city improvements
Better BTS corporate AI

I'm sure that there are ways to forge forward in all these and more areas without totally re-engineering the AI. Reasonably simple ways. But the discussion will get messy unless it is divided up.

For example, on better BTS war tactics, just a simple thing like ensuring that before an AI DOWS in a border war, that it's planned city razing stack has 10% extra offensive capability against the planned city would already be good. (just one extra city razing unit for example). Now that border wars are much more common, even a cancellation of a border conflict until there is better offensive capability would be justified. If as Jdog has hinted, that there is no direct assessment of this in the code (that we can see so far) well simple then, let's implement one :)

As it stands now, it is indeed a complex thing to totally overhaul war tactics. With the "closeness" bug fix, already I am beginning to see much more "colour" in the behaviour of AI war tactics when neighbours DOW in conjunction with non-neighbour partnerships. Very nice. This behaviour often was not triggered in vanilla BTS because of the "closeness" bug.

But the issue of totally revamping the AI war tactic is really hard. For example, in my scenario currently under investigation, three AI's neighbours have dowed on me on different fronts. One is raiding, two are city attacking. I am able to defend against this but long term how much will it hit me even if I am successfully defending in the short term? How difficult is it to judge to what extent an AI can afford to loose a city razing stack in reality?

Already the behaviour is good. I go for 10% more city razing offense is all.
Big questions.....Small answers?

Cheers.
 
I would like to join.

The BTS AI is quite an improvement from before, no doubt. It manages to do a marginal job of handling some tasks that are very complex, such as city production choices, irrigation, and plot improvements. But it can be much better.

I am currently of the opinion that the main weakness of the AI is its lack of centralized control, at all levels. I have been looking through the city code recently, and cities seem to rely on 1) AreaAI and 2) the civ's number of units, for determining when to build combat units. Those two factors, (and perhaps a few other things, like number of warplans), are nearly the only means for the city to know whats going on in the rest of the world, outside the city's BFC. Not an easy problem to remedy, I know, but it can be done.
 
So, the value we get from this calculation -- is it relative? Is it absolute?

Is it linear-relative? (if you double all values, does the situation not change)
Affine-relative? (if you add 1000 to all values, does the situation not change)
Ordered-relative? (if you do any operation that doesn't change the order, the situation doesn't change)
Linear-absolute? (every doubling of the number has about the same effect)
Affine-absolute? (every increase of 100 in the number has about the same effect)

For closeness? At least when it comes to affecting the startWarVal it has none of those properties ... it gets summed with other values so doubling would make a difference. There is special handling for the == 0 case plus different multipliers depending on attitude so affine is out as well.
 
I'm not a programmer, but I'm going to follow this project and wish you the best of luck. :thumbsup: Your ambitions will at least not be the limiting factor of this project. :)


I'm with Roland -- though I hope to learn a bit more about C++ programming along the way.
 
I would like to join.

The BTS AI is quite an improvement from before, no doubt. It manages to do a marginal job of handling some tasks that are very complex, such as city production choices, irrigation, and plot improvements. But it can be much better.

I am currently of the opinion that the main weakness of the AI is its lack of centralized control, at all levels. I have been looking through the city code recently, and cities seem to rely on 1) AreaAI and 2) the civ's number of units, for determining when to build combat units. Those two factors, (and perhaps a few other things, like number of warplans), are nearly the only means for the city to know whats going on in the rest of the world, outside the city's BFC. Not an easy problem to remedy, I know, but it can be done.

I thought you might want to get in on this ... welcome to the fold :cool:

I'm with Roland -- though I hope to learn a bit more about C++ programming along the way.

Cool ... I hope we have a lot more discussions like the one spawned by the first bug, it will be great fun. BTW, I saw you got some serious props in the 3.17 change list for Next War :goodjob:
 
I read about this at the same time I found out about the new official patch. Just wanted to let you guys know that I am very excited about this important bug fix and I will stick with the 3.13 and apply your patch right away (instead of applying 3.17, until you release the 3.17 version). 3.17 does not look too different from Bhruic's anyways. Keep up the good work!
 
For closeness? At least when it comes to affecting the startWarVal it has none of those properties ... it gets summed with other values so doubling would make a difference. There is special handling for the == 0 case plus different multipliers depending on attitude so affine is out as well.

Aha, but look at how AI_startWarVal is used. If you double the value of AI_startWarVal for every player, the gameflow logic remains unchanged.

If you increase the value of AI_startWarVal by 10000 for every player, the gameflow logic remains unchanged.

AI_startWarVal is basically the sum of:
1> How much closeness we have with them.
2> The value of the tiles near the border between us and them
3> How close our capitols are.

These 3 values are then multiplied by:
8 if their Victory countdown is lower than ours.
6 if we are close to domination on aggressive AI, 4 otherwise (! I think this does nothing)
A value between 1 and 16 depending on attitude
The value is then divided by 3 or 8 depending on if a member of our team is doing a cultural victory

As the value is only used for ordering potential war options... much of the above us utterly wasted. Anything that uniformly scales your AI_startWarVal does nothing!
 
Version 0.1 for BTS 3.17 is out!!! Get it here.

It includes the closeness changes we have been discussing, the captured holy city defender bug from earlier, plus three other things. The first is a reduction to the demand for transports when the AI is involved in a local war or when they only have galleys. Transport demand is determined by the number of attack units, when the AI is in a land war it will have many attack units that it doesn't intend to load on transports. The second set of things is an unfinished project to create a new A* route solver for closeness to replace the current combo of one to two solvers plus multipliers. These do not yet effect gameplay. Finally, I have modified the debug mode output when mousing over cities and territory so that it gives more information about things important to these developments and included my AIAutoPlay SDK code.

Better BTS AI Changelog
_________

- Fixed bug in player closeness calculations causing the AI to be blind to its actual proximity to other players (CvPlayerAI::AI_playerCloseness, used Option A from Unofficial Patch discussion thread)
- Fixed bug with needed defenders where the AI would choose to defend a recently captured holy city less than a normal city
- Modified how closeness is used for determining who to attack, different settings for regular and Aggressive AI
- Modified city closeness calculations to use population from both cities, not just pop of the other city
- Created functions for determining when cities share the same water area (lake, ocean)
- Lowered demand for transports when either in a land war or when the civ can only build galleys
- Partial implementation of a new A* solver for determining closeness, does not yet affect calculations
- Modified debug mode output to show relevant information for these developments
 
How big are Civ4 maps, anyhow? Hmm. I've been playing with planar pathing recently. :-)

500 x 400 is 80,000. 80,000^1.5*ln(80,000) = 255,458,603

* 20 civilizations = 5 gig.

Think a 5 gig cache for ultra-fast pathing is worth it? Probably not. ;)
 
Download resubmitted after glider caught a section of code I had forgotten to comment and update. For the 16 of you who downloaded already you'll want to pull it in again even if you're not checking out the sources.

All the changes are now commented and can be found by searching for BETTER_BTS_AI_MOD in the sources.
 
I've been playing with planar pathing recently
I can tell that you have here been do so here!?:
http://forums.xkcd.com/viewtopic.php?f=12&t=6206

Very interesting Yakk and yeah I can confirm that a 500x300 map is not huge.......it is very huge by vanilla BTS standards.

By the way could you split the forum up into sub topics? It's a bit of work or do you want to leave that for source forge or the like?

Cheers
 
Just curious if the all-new Better AI is going to include Solver's unofficial 3.17 patch?

I mean, I can always merge the two myself, but let's not forget those cold and timid souls who, unable to compile, know neither victory nor defeat. :)
 
Just curious if the all-new Better AI is going to include Solver's unofficial 3.17 patch?

I mean, I can always merge the two myself, but let's not forget those cold and timid souls who, unable to compile, know neither victory nor defeat. :)

I was worrying about this just now. Ideally I don't want to have to make a choice between two unofficial patches. Granted Solver's patch appears to be the more "official" unofficial patch since Better BTS is a bit more experimental, it also has a lower scope (so far) so I don't know which to go with.

My vote would be to include Solver's changes in this patch as a matter of course.
 
Hey guys, what's up with this mod?

If you have a detailed changelist, it'd be good if you posted in the unofficial patch thread. AI improvements are among the stuff I want in my unofficial patch. I'm also looking to make a few tweaks to the AI myself, though sadly I'm not much good at AI programming.
 
I'll definitely fold in Solver's fixes for this and also tried to summarize what we've done so far in the unofficial patch thread so more can benefit. Not everything we've tweaked is necessarily appropriate for an unofficial patch even though I'd wouldn't want to play without the changes.

Anyway, I say we just basically take over this forum for our discussions. Once we have a chance to get organized we can ask a mod to change the stickied posts and all that jazz. Just mark new threads with [BTS] or something ... so glider, blast away with new threads!

On the sourceforge front, if I don't hear back on taking over the existing Better AI project in the next few days I'll request a new project.
 
Back
Top Bottom