Buffed AI for BNW

I stopped posting and testing when you changed direction to adaptive buffs. I liked the changes to the AI handling of units and the combat buffs. I dislike that change because it penalises the player for doing good and changes the strategy to be more about denying buffs to the AI. Now I'm looking through the very long thread and it seems that the adaptive buff kind of works as intended but it is hard to chose a criterion for buffing, as choosing a criterion changes the game balance in everything regarding that criterion. Is that your impression as well? (btw, is there a changelog somewhere so I can keep up?).

What I personally want to see is the AI getting unassailiable lead in everything through exponential growth unless you play top notch. My proposal was to give the AI 10% more growth, hammers, happiness, science, culture, faith, gold for each level above prince. It should probably have some units at the start: 3 warriors, 1 worker and no technologies seems reasonable for all levels above prince. Would that not produce similar results as your adaptive buff but with smaller effects to balance? Have you tried anything like that (not counting the per era buff to science you tried in the beginning)?
 
What I personally want to see is the AI getting unassailiable lead in everything through exponential growth unless you play top notch. My proposal was to give the AI 10% more growth, hammers, happiness, science, culture, faith, gold for each level above prince. It should probably have some units at the start: 3 warriors, 1 worker and no technologies seems reasonable for all levels above prince. Would that not produce similar results as your adaptive buff but with smaller effects to balance? Have you tried anything like that (not counting the per era buff to science you tried in the beginning)?

I would be against increasing AI happiness, culture, or faith. Other than being slow to connect the spare copies of the luxaries it's actually fine as far as happiness goes. That problem might actually have been increased by the reduction in the AI desired worker to city ratio.
Also note that 10% more population growth really is more science, hammers, and gold.

The main thing I could suggest on thread length is ask a mod to create a sub forum for it. Then one thread could be the change log, another thread on discussions about current and planned features of the mods, and other threads could be reporting how the game does in version X of the mod.

On the very new version of the mod, my Egypt game is now bogged down in a late game war, at current pace during it, it's looking like it won't be until the weekend that I finish the remaining 30 to 40 turns in order to start testing the new version.
 
Thanks Chumchu, Joncnunn and JooseGoose

Chumchu I agree with you that we were focusing on how to beat the adaptive system. However think about the base game. Players have also adjusted their playstyle to beat the AI, which is also about beating the base game's default handicap system....

Everybody has got a good point on this. I personally think the adaptive system as it currently stands is broken. It doesn't work properly for all phases:

Here is my take:
  • Early game: The restrictions in happiness make the AI way too tentative. The AIDeclarWarProb system is broken and does not work as I intended.
  • Midgame: The mod starts to improve, but the tech funnel boosts the AI in too a predictable a way.
  • Endgame: The mod plays really well, about as well as could be expected with the AIs low intelligence.
  • On a general level, the adaptive system does not regulate the AI as I intended, for the huge variety in map types and play styles.

Heres what I am hoping is the solution, would be interested in your thoughts.
  • Delete all my handicaps and restore them to default
  • Regulate the AI adaptively based on the per-era-modifier (PEM)

I've already written the code for it and have started testing it. The idea is simple. The player starts on whatever difficulty they want, for the flavour of game they want. If you want the AI to have reduced happiness, you play it on prince (for example). If you want the AI to come out blazing, you start it on deity.

Once the difficulty is chosen, the code merely monitors the progress of the AIs in tech rate, and regulates the AIs PEM on an ongoing basis. It doesn't mean that the AI gets a once off boost at each new era. The boost is happening every time the code wants to know what the bonus is.

So if you are a prince player that chose deity, the AI initially would be immense but very quickly slow back to prince in progress.

If you are a deity player that chose prince, the AI would initially start slowly but very quickly start to build up in power.

I've worked out the algorithm for it. The question is whether the PEM is able to regulate the AIs science performance as well. The PEM would have an indirect effect on science, because PEM boosts the AIs growth, gold and production.

The experiment will be to see how quickly changes in PEM have an effect on AI performance during the game.

The way I have set up the algorithm at the moment you can see here. I have deleted the adaptive buff system and all the handicaps I previously assigned. It is just the base game handicaps plus the AI improvements already existing in this mod plus this algorithm:

Spoiler :
Code:
int CvHandicapInfo::getAIPerEraModifier() const
{
	// Glider1 - BuffedAI
	// Dynamically adjust the per-era-modifier
	TeamTypes eActiveTeam = GC.getGame().getActiveTeam();
	PlayerTypes eActivePlayer = GC.getGame().getActivePlayer();

	PlayerTypes eLoopPlayer;
	CvPlayer* pLoopPlayer;
	TeamTypes eLoopTeam;
	CvTeam* pLoopTeam;
	int iTotalTechs = 0;
	int iNumAIs = 0;
	int iAdjustedPerEraModifier = m_iAIPerEraModifier;

	for(int iPlayerLoop = 0; iPlayerLoop < MAX_MAJOR_CIVS; iPlayerLoop++)
	{
		eLoopPlayer = (PlayerTypes) iPlayerLoop;
		pLoopPlayer = &GET_PLAYER(eLoopPlayer);
		eLoopTeam = pLoopPlayer->getTeam();
		pLoopTeam = &GET_TEAM(eLoopTeam);

		// Must be alive
		if(!pLoopPlayer->isAlive())
			continue;

		// Can't be us
		if(eLoopPlayer == eActivePlayer)
			continue;

		// Can't be minor or barbarian
		if (pLoopPlayer->isMinorCiv() || pLoopPlayer->isBarbarian())
			continue;

		iTotalTechs += pLoopTeam->GetTeamTechs()->GetNumTechsKnown();
		iNumAIs++;
	}

	int iPlayerTechs = GET_TEAM(eActiveTeam).GetTeamTechs()->GetNumTechsKnown();
	int iAverageAITechs = iTotalTechs / std::max(iNumAIs, 1);

	if (GC.isBUFFED_AI())
	{
		iAdjustedPerEraModifier += (iAverageAITechs - iPlayerTechs);
		iAdjustedPerEraModifier = std::min(iAdjustedPerEraModifier, 0);
		iAdjustedPerEraModifier = std::max(iAdjustedPerEraModifier, -6 /*one more than deity*/);
	}

	return iAdjustedPerEraModifier;
	// end

EDIT:
The algorithm is very crude at the moment but hey that is what an alpha is! It is just proof of concept.

Let me know if you want to try the V19 alpha or if you have alternative suggestions. If I can get it to work, it will mean that the AI is playable at all phases of the game (I hope), because the selection of difficulty decides what style of game the player wants initially, and the adaptive buff adjusts itself to fit the players progress so that a game completes through all phases. It is capable of both boosting and retracting AI performance, something the previous adaptive buff could not do.

Fire away if you think the idea is lame! :) Factor in that my own motivation to make genuine improvements to the AI is limited to small qualitative improvements that make the game more enjoyable for me to play (things like its diplomatic choices, or easy to fix tactical weaknesses etc).

AI improvements that make the AI quantitatively better, would take too much time and effort for me to be bothered with. I just don't have the motivation and energy to make quantitative improvements because there are soooooooo many to make, and I have got better things to do with my life than slave away fixing the mega mountain of convoluted code that is the AI.

I also realise that this idea smashes peoples idea of making progress. The better you play, the more buffs the AI gets. The worse you play, the more the buffs are withdrawn. For me personally, the fix players want is gained by beating the base game until you get to immortal/deity. This mod is for players that have exhausted the games potential, but want a relaxing yet challenging and diverse game.

Think about it. With this adaptive mod, you could start out on deity and full piety and still possibly survive. Sounds like fun to me!

The other feature of this concept is that because the DLL is independent of other code, including the handicaps file, it would be able to cope with mods that break the AI's performance but that are fun for the player to play in any case.
 
What you managed to do was turn the current system, where the AI is really strong in the beginning and then flounders, on its head =) This is an achievement of sorts. Hopefully you can devise a system where the AI is a major threat throughout the game. For it to feel fresh for me, it has to be more difficult. As it stands, I challenge myself to win SV at deity in the shortest amount of turns. It is telling that in most cases, it is actually easier to win fast at deity than immortal or emperor, because of the small challenge of the AI and the large amount of resources you can extract from them. I want a system where the AI will beat me to victory if I do not stop them or play my best. This means that the leading AI should win around t230 if left unchecked. So I do not think we are on the same page here.

In every game you try to game the system for optimal results. This is only a problem if the necessary actions to do this are tedious, or in conflict with story of the game. Ideally you want a range of optimal or very good strategies that are in accordance with the story or theme of the game, that feels right basically. A system which discourages the player from developing his civilisation in a certain aspect is in conflict with the story of the civilisation games, it feels wrong. This is the case with PEM as well. Making it more transparent is a good thing none the less.

Another idea to improve performance is to change the AI:s high preference for faith and culture. Way too many AI:s choose piety and suffer as a result. While it might be decent for the first AI to choose piety to try and establish a dominant religion, when five AIs do the same, they cancel each other out and fill the map with religious spam. Is it feasible to mod it so that the chance of them choosing piety decreases dramatically with every player that have already chosen it. The same might in lesser degree be applicable to aesthetics and order.
 
This means that the leading AI should win around t230 if left unchecked. So I do not think we are on the same page here.

Actually I would prefer a system in which it would be considered a major achievement for anybody (be it human or AI) to launch the spaceship before 2000 AD. This would of course involve changing the base rules to greatly slow down science.

But in the context of the AI handicaps, it would actually mean that instead of giving the AI larger discounts on costs of buildings & food growth while holding the human's constant across all difficulty levels that I'd be holding the AI's costs constant across all difficulty levels but instead subjecting the human to increased costs for buildings & food growth as the level increases.

Also, on AIs doing bad who picked Piety, it's because the starting policy trees aren't balanced.
Both Tradition & Liberty would need nerfs to bring Piety into shouting distance. (As to Honor, the best thing we could do for the AI here is require the Classical era to be reached before opening, which is a simple XML change.)

It definitely is a much more interesting late game for the AI to start weak and get stronger compared to base game start strong but get weaker.
 
Thanks for at least 2 people out of more than 300 acknowledging that this mod did achieve something in V1-V18.

I cannot implement multiple ideas at once and so will continue on with PEM until I hit a dead end.

In V19 alpha #1, I started out a game on warlord. In the industrial age the AI was only two techs behind and competitive enough for me to continue. The PEM had adjusted to feel like I was playing emperor which is actually my normal ability in this mod on pangaea.

In alpha #2, I've adjusted the algorithm and exposed the PEM to the interface and will see how it feels on prince.

EDIT:
Let me know if you want a copy of V19 alpha #2
 
You do interesting and needed work, that's why I keep posting =) I just hope that my input is helpful to you.
 
It is helpful Chumchu. You and JooseGoose blew my little bubble about the opening phase of this mod. I thought it was ok but when I went to play it on pangaea and compared it to original, I saw with my own eyes how timid the opening phase AI is. I have to be brutally honest here and say that when I set this mod back to original V1 and played my first game in months on pangaea on prince *with only the combat changes in this mod* and no handicap changes, I was blown off the map by Rome. The handicap system in this mod had caused me to become complacent to the max because of the AIs tentativeness....

EDIT:
So it has caused me to go back to basics and try again with want I really wanted to try along, which is to develop a simple adaptive system that actually works.
 
It is helpful Chumchu. You and JooseGoose blew my little bubble about the opening phase of this mod. I thought it was ok but when I went to play it on pangaea and compared it to original, I saw with my own eyes how timid the opening phase AI is. I have to be brutally honest here and say that when I set this mod back to original V1 and played my first game in months on pangaea on prince *with only the combat changes in this mod* and no handicap changes, I was blown off the map by Rome. The handicap system in this mod had caused me to become complacent to the max because of the AIs tentativeness....

EDIT:
So it has caused me to go back to basics and try again with want I really wanted to try along, which is to develop a simple adaptive system that actually works.

From my own perspective, end game has been most exciting in the two most recent versions than in base game. It is however unfortunate that end game starts earlier, and that's even in conjunction with my mod pushing back National College construction. This might be caused by RAs leaking the AIs science boosts back to the human via being added into the RAs.

My own map type tends to dodge completely any AI combat bonuses / human penalties, to be honest that's the section I'm least interested in.

The early game AI issues are of course happiness driven. Anything that helps the major AIs against the barbs will on margin help this, but the lowering of the AIs worker to city ratio may have made it worse. (The AI really does need to build a higher worker to city ratio than a human to make up for poor worker choices even in absence of any barbs.) If it could be taught to give the same high priority to spare luxuries as it does a unique one it would probably solve the issue entirely.

The science per era modifications (the ones independent of human player action) have the interesting affect of both being too weak up to and including the Industrial era and too strong in the Atomic & Information era. It's about right in the Modern era.

So if only there was a way to remove the "per era" portion and really be the same value at that difficulty level across all eras that Modern era currently does in science ... May be even better to instead increase the cost of the humans tech by the reciprocal amount and hold the AI constant to avoid the higher difficulty level -> game ends earlier affect.
 
Thanks Joncnunn. I can't remember there being any passive per-era-boosts to science independent of humans (just the normal per era modifiers). They were all adaptive. In early versions of this mod, I had coded them in, but removed them later and went adaptive.

You could well be right that turning down the worker to city ratio was a mistake!

You could have a point about the RA leak as well!

The opening game tentative AI is ugly, so ugly it is back to the drawing board.

EDIT:
Yes, you would not have noticed it on islands maps! Basically you were the only one giving me continual feedback, and I had my eye off the ball trying to get the midgame/endgame right.
 
You could well be right that turning down the worker to city ratio was a mistake!

The opening game tentative AI is ugly, so ugly it is back to the drawing board.

The other thing I'm thinking is that maybe the AI should start with 12 happiness instead of 9 as a stop gap measure until it can be taught to make connecting the spare luxuries a higher priority.
 
I've got exams on Oct-5 and so am limited in time. It would be handy to know if happiness is the cause. Somebody could change V18 beta 13 with the happiness fix and see if it plays the opening phase the same as the base game. There is also the issue of ongoing happiness that the AI gets in the base game too. Best way to test is to play this mod on pangaea and compare the opening game in just 150 turns, that should be enough.

EDIT: It is time consuming. Testing a simple thing like that actually needs 2x150 turns.
 
I've got exams on Oct-5 and so am limited in time. It would be handy to know if happiness is the cause. Somebody could change V18 beta 13 with the happiness fix and see if it plays the opening phase the same as the base game. There is also the issue of ongoing happiness that the AI gets in the base game too. Best way to test is to play this mod on pangaea and compare the opening game in just 150 turns, that should be enough.

EDIT: It is time consuming. Testing a simple thing like that actually needs 2x150 turns.

I'm afraid I'm not particularly familiar with how fast the AI expands on standard Pangena for Civ V.
Some observations of some random restarts after about 30 turns on the map layouts strongly indicates that strong resource diversity is most likely when majors are close enough together that the scripts placement zones of the primary luxuries overlap.

I did see a random turn 50 happiness on what's my real game though. AIs 6,7,8 at happiness 0 with the starting happiness of 12 instead of 9. AI 5 at happiness 1, AI 4 at happiness 2. It occurs to me that shortly before then is also a common place of a human to have founded a city and if that new city is next to the luxury instead of on it the human would also be near 0.
At starting happiness of 9 instead of 12, all those AIs would have negative happiness.
 
I did check AI happiness with infoaddict when I first set V1-18 at +9 happiness and didn't see the majority collapse into unhappiness early. You may well have a point though!

V19 alpha #3
  • Reintroduce AI two warrior start
  • Reintroduce AI free worker
  • Settle and finish testing PEM algorithm
  • Build in game notification icon when the PEM automatically changes

I started on prince and am neck and neck with the AI once the PEM automatically adjusted up to deity (-5). The game feels very competitive and have enjoyed not having to focus on science. On prince, the game starts quite easily until the PEM rises. I think the endgame is going to be really tough, but I'm not sure yet.

Let me know if anyone wants to join in testing V19 alpha #3
 
I did check AI happiness with infoaddict when I first set V1-18 at +9 happiness and didn't see the majority collapse into unhappiness early. You may well have a point though!

V19 alpha #3
  • Reintroduce AI two warrior start
  • Reintroduce AI free worker
  • Settle and finish testing PEM algorithm
  • Build in game notification icon when the PEM automatically changes

I started on prince and am neck and neck with the AI once the PEM automatically adjusted up to deity (-5). The game feels very competitive and have enjoyed not having to focus on science. On prince, the game starts quite easily until the PEM rises. I think the endgame is going to be really tough, but I'm not sure yet.

Let me know if anyone wants to join in testing V19 alpha #3

With my Egypt game now over, I'm actually testing as Arabs the Beta 13 at the moment. I'll probably stay with that one for one more game as well since I want to test while holding yours constant my global tech stagnation mod.

1. ResearchPercent of the "AI Default Handicap" raised from 85 to 100.
2. ResearchPercent of Warlord+ human levels raised from 100 to 115.
3. ResearchPercent of Chieftain raised from 95 to 110
4. ResearchPercent of Settler raised from 90 to 105
(The later two for completeness)
This should amount to a 15% tech slowdown, and since its the costs being changed and not yields won't impact RAs.

For the national wonder portion of my mod, it turns out that Iron Works and Hermitage are both getting built way too fast with only requiring 1 building. So in addition to the NC, Oxford, and Circus Maximus tech delays:
1. Iron Works requires Chemistry.
2. Hermitage requests Archaeology.
This will bring the completion times of these within the mod closer to when 3 or 4 city tall empire would but without requiring a copy everywhere.

Also to help the AI in early game, the Force the AI to open a good policy tree first mod:
1. Honor requires Classical Era to open.
2. Piety requires Classical Era to open.
AI will now at least open either Tradition or Liberty to get some culture bonus while being free to interrupt for either Piety or Honor after having a policy or two.
 
The research percent in this mod has been on 100 across all difficulties for a while already, just in case you didn't know.

Thanks, I'd forgotten about that. I'll try adjusting the world size research percent on my tech stagnation mod instead, which won't interfere at all and in fact is likely to be a better place anyway.

Alpha 1 of that will be:
Duel : Unchanged (stays at 100)
Tiny : Research Percent increased from 100 to 105 (5% increase)
Small: Research Percent increased from 100 to 110 (10% increase)
Standard: Research Percent increased from 110 to 125 (13.6% increase)
Large: Research Percent increased from 120 to 140 (16.7% increase)
Huge: Research Percent increased from 130 to 160 (23.1% increase)

More civs -> more RAs so by design my tech stagnation mod increases the cost both in raw terms and in percentage terms more on bigger maps.
 
Note that

Code:
UPDATE HandicapInfos SET HappinessDefault = 9;
should have a where clause to really be changed to limit it to only apply to the AI Default Happiness. Otherwise when tweaking it you accidentally improve things to the human, I didn't notice it at the time of the turn 50 happiness shot, but I had accidentally given myself a +3 happiness bonus in addition to the AI.
This also applies to some of the other values unless you really wanted to remove some of the bonuses normally given to humans playing on Warlord and below.
 
I tried a couple of unmodified BNW openings. What I noticed is that the AI is more likely to expand rapidly than in this mod and so can build up a more rapid escalation in capacity.

So the difference in this mod in the early game is not so much about combat, but how quickly the AI expands early. If we can solve the expansion problem, I think that would solve other issues, because things like combat depend on having a quick well developed productive capacity.

EDIT:
In this mod there are four different controls of happiness! :eek:
Which happiness line is the one(s) need(s) to change for the sake of more rapid expansion?
 
Back
Top Bottom