Barbaraian Civ needs tweaking

phungus420

Deity
Joined
Mar 1, 2003
Messages
6,296
While Barbarian Civ is an awesome option conceptually, in practice it is pretty broken (though sometimes when the stars align it can be quite interesting). For the most part either a barbarian civ pops early and gets a massive attack stack that is unbeatable, or comes late and is so epically backwards they are completely ineffectual. Today in a test game a barb civ popped, destroyed Egypt, then came gunning for me and with a 20 Unit stack, I had focused on military because I was trying to elminate a nearby barbarian city. Even with my military focus I had 3 Warriors and 2 Charriots, the Iriquois stack was 20 units 5 of which were spears. Nothing could be done by my part, this was just a "Game Over" function. Keep in mind this was after they had just destroyed Egypt as well.

So basically something needs to give with Barbarian Civ. There needs to be a scale here in spawned stacks and units the Barb Civ gets.

I know I'm not the only one who has experienced this, and seen how epically game breaking, or conversely how ineffectual this component can be. Basically Barb Civ needs to change so that it doesn't ruin early games, and also so that spawned barbarian civs in the mid game actually have an effect, and can do something.

What sorts of ideas do people have to fix this? How should the spawned units for barb civs be tweaked? Anyone messed with the code here? Where is it? jdog/glider you guys have any thoughts or plans here?
 
Just to reiterate this is a complex issue that I can't figure out a good solution for. This is because Barb Civs suffer from two opposite issues, they are both too strong, and too weak depending on when they emerge.
 
I agree with Phungus. I really like Barbarian Civs, but they just get too powerful in the early game where it matters. A solution could possibly could be to give the barbarians 1/2-2/3 the units they receive now and give them many more techs than they receive now. Or make the requirements for Barb Cities to change higher.
 
There are two spots where this is controlled, once when a barb city becomes a minor civ and then again when the minor civ becomes a full civ. Minor civs only get a handful of extra units, so the tweak needs to come in the second spot.

In function settleMinorCiv, starting around line 1434, the code decides how many offensive units to add to each new city (this is on top of the defensive units which are handled separately). The final number it will add is iOffensiveUnits which is produced with a fairly high level of randomness from two other variables, baseUnits and extraUnits.

Basically, for the first city:

Code:
baseUnits = 2*(initial defender in barbarian cities)
extraUnits = (game era) + (handicap type - 3)/2

iOffensiveUnits = baseUnits/2 + (random number between 0 and baseUnits + extraUnits)

Perhaps a better approach would be to reduce the randomness and up the scaling by era:

Code:
baseUnits = (initial defender in barbarian cities) + (game era)
extraUnits = 2*(game era) + (handicap type - 3)/2

iOffensiveUnits = baseUnits + (random number between 0 and extraUnits)
 
Certainly that would be the best way to do it. The issue is, what would be a good formula. It's a difficult balance to achieve, as you want Barb Civs to be able to rise up and stand a chance themselves of winning, but you also don't want them to destroy the players chances either, no matter what they do. (There was absolutely nothing I could have done in my last game, and that's frustrating :mad:, by player here I mean AI and Human, the player should stand a chance, and so should the barb civ, which is a difficult balance to achieve).

Tying it to era and giving a pretty concrete number would certainly be a good step, it probably wouldn't hurt to throw in a little randomness for flavor, but overall the strength should be relative to the stage of the game that would give the emergent civ a nice good invasion stack. Also I'd really like to see the barb civ tech formula work so that it checked the techs and calculated them based on the civs on it's own continent, so that Terra maps ended up with very backwards civs when you discover them. Also I've had it happen before where I was on an isolated start and a barb civ emerged on a nearby island and they ended up with the techs from the world so they were quite ahead, didn't matter though, as they were so small, but still seemed odd. Anyway the tech issue isn't important, as it's not a current game breaker. The military aspect is.

Off the top of my head I think a formula like this would work well (this is just a rough formula, to give an idea of what I think the reletive strength of the barbarian civ's army should be):

Form a tech list of what the new civ has. Make a list of available units, check for strategic resources within 10% of map distance tiles from the city, Make resource requiring units available if the strategic resource is within range.
Add defensive units as is done now.
Calculate offensive units: 2:hammers: per turn that has passed in ancient era, + 4:hammers: per turn in classical era, + 8:hammers: per turn that has passed in medieval era, etc (2^X :hammers: per turn where X is era level). Allocate hammers based on units available, units picked by dice roll and then are created subtracting from :hammers: total until reaches 0, can go in negative for last unit built.
Add Non military units, Setters/Workers. Barb Civ gets 1 free worker per Era, and 1 free Setter per Era/2.

That's a pretty unwieldy equation but I think it would give a good relative army size for the barbarian civ. You can probably think of something better though.
 
Minor Civs pop up with way more units than the current players and their AI neighbors do. Perhaps this is different in multiplayer games, but they are a worse threat as a minor civ than as a full civ - partly because they start with a huge military and partly because you can't get peace with them. My AI neighbors are usually about even with me and we've gotten a guarded peace going (depending on who they are). I do agree, they start out too strong in the early games and really aren't much of a factor later. Of course later in the game the map is usually full anyway, or darn close to it.
 
You could just change the Python portion so that Barbs don't start with any offensive or counter units, but give them a tech level equivalent to the most advanced civs of the day.

Right at the end of the part that gives them units, just change your mind

Code:
iCounter=UnitTypes.NO_UNIT
iMobile=UnitTypes.NO_UNIT
iAttack=UnitTypes.NO_UNIT
iAttackCity =UnitTypes.NO_UNIT 
return [iWorker, iSettler, iScout, iBestDefender, iCounter, iAttack, iMobile, iAttackCity, iAssaultShip]


and further down replace

barbTechFrac = self.config.getfloat("BarbarianCiv", "BarbTechFrac", 0.60)

with

barbTechFrac = self.config.getfloat("BarbarianCiv", "BarbTechFrac", 1.00)

I' haven't actually tried this but it would probably work.
 
Tholish did you even read the OP, or any subsequent posts? The issue is that Barb Civs are too strong in the very early game, and too weak later on. They are pretty much perfectly balanced in the middle-late Classical Era, but outside that they are either inefectual, or game breaking. Your post adresses neither issue...
 
Yeah, if you leave them with only defensive units worker settler and scout they will not get slaughtered at the outsed but will not start with a stack of doom either. Yet if they have every tech any civ has, that won't mean as much early in the game when all civs are pretty equal but it will be a powerful start for them in the later game. I'm just saying there's probably a simpler way than to get into all that complexity. Only drawback I can think of to my scheme is that civs starting with lower development and extra tech will trade the tech away too much, so it would be better if they got the tech while they were still minor civs, so it would be less cutting edge by the time they could trade it. What I was proposing was a plan for barbs to eventually become viable civs before getting wiped out.

If you wanted barbs to have a chance of just appearing and suddenly being a real threat, but not unbeatable, with SOME initial attack ability maybe you could give them attack units but deny them attack city units. Or something. The point is, rather than some complicated scheme, just deny them your choice of whole category of start units. That wouldn't keep them from building other types later. All the details the regular mechanics of the game would iron things out. It would be more like a civ emerging and less like a mega event (Vedic invaders et al). So its just a matter of design intent of what you want barbs civs to do to the game, which you say is rise up and have a good chance of winning but not spoil the players chance. Ie, you want them to pose a new threat like the Mongols or Huns not just be a new civ that emerges and might become something eventually like, say, the Inca. What I'm proposing is that they be more like, say, Rome or Persia, suddenly appearing, initially small but quick adopters of all existing technologies, then suddenly developing to overshadow the older civs.
 
Tholish, the problem with that idea is the philosophy behind BarbCiv that some minors are going to be militaristic and have been preparing an invasion force for a long time/with a lot of resources (The Gothic sack of Rome is a perfect example). I'm with phungus on this one, though I'd personally also like to a little more weight on peaceful barbcivs.

IIRC there's a switch for peaceful/aggressive barbcivs, so I wonder if that could be mutated into something like:
Code:
[PSEUDOCODE]
Randomly pick a leader trait based on weightings similar to current peaceful/aggressive switch
[OPTION 1A]
Scan available leaders with that trait to see what combos are available
Randomly pick second trait based on availability, still weighted
Randomly pick leader with chosen combo
[OPTION 1B]
Randomly pick second trait, still weighted
IF: At least one leader with chosen pair is availble
THEN: Randomly pick among available leaders with chosen pair
ELSE: Repeat IF using next-closest second trait
[/OPTION]
Initialize starting-stuff (techs, units, etc.) variables, including any random factors
FOREACH trait, apply appropriate boni:
[LIST]
[*]Recieve all double-speed buildings for free if availble
[*]Aggressive: +100% ATTACK units, +50% ATTACK_CITY units
[*]Charismatic: Free Monument if available
[*]Creative: -15% TechPercentKnown, free GtArtist
[*]Expansive: +50% Workers, free Farm or Pasture on random food resource or +1 pop if none available
[*]Financial: Free Cottage on random eligible tile or +100 x ERA gold if none eligible, free GtMerchant
[*]Imperialistic: +100% Settlers (0 becomes 1), free GtGeneral
[*]Industrious: Free GtEngineer, free Mine or Workshop on random eligible tile (proritize mineral resources)
[*]Organized: +25% Workers, free GtSpy
[*]Philosophical: Free GtScientist, free random GP
[*]Protective: +100% CITY_DEFEND units, +50% COUNTER units
[*]Spiritual: Free GtProphet
[/LIST]
What do people think?
 
jdog any specific code proposals? I was getting ready to update the current test build of LoR, but realized I really need a fix for this (getting bumrushed in the first 100 turns by 20 units is not fun). This extreme case stems from the Barbarian World option, but I've had similar occur without, and was also hoping for a later game buff to barbarian civ. I've looked through the code, but am not skilled enough, and don't have a clear idea of where to start on this to implement something. I'm sure I could figure something out, but am hoping you have something in mind. If so please share it, I'd like to get in a "fix" for barb civ soon so I can update, even if it's just something to try, I can test changes pretty quickly and having code in front of me to implement would probably help give me direction on how to start.
 
I definitely want the new warlike civilizations to be a threat. Certainly there are balance issues needed to be addressed, but in an average game, I want the new civ to be able to take a city or two, and have some chance of holding onto them.

A non-military balance issue is that I'd swear that the new civ always uses its GP to start a golden age. I would think that with only their capital, settling the great person would produce in only a couple dozen turns the equivalent yield bonus as the golden age, to say nothing of the long-term. Additionally, using a GSpy to infiltrate, GEngineer to rush a wonder if there's one available, use a Gprophet to bulb a religion, or saving a GMerchant until there's peace and can be used for a trade mission all seem like better options than a golden age for 1 city.
 
Phungus:

Here's what I've got right now ... code version of what I pseudoed up above. Has not been game tested yet (was going to get to that after getting the next UP into RevDCM):

BarbarianCiv.py, starting around line 1439 replace the very similar looking lines with:

Code:
                baseUnits = max([iNumBarbDefenders-i,0]) + int( newPlayer.getCurrentEra() )
                extraUnits = 2*int( newPlayer.getCurrentEra() )
                if( not bNonBarbCivUnits and self.iNewWorldPolicy > 0 ) :
                    extraUnits -= 1
                if( (len(cityList) == 1 and bNonBarbCivUnits) or (i == 0 and bForeignCivCities) ) :
                    extraUnits += 1
                extraUnits += max([-1,(game.getHandicapType() - 3)/2])
                extraUnits = max([0,extraUnits])

                iOffensiveUnits = baseUnits + game.getSorenRandNum(extraUnits, "BC - Num off units")
                iOffensiveUnits = int( self.militaryStrength*iOffensiveUnits + 0.5 )
 
Thanks jdog, I'm too drunk right now to sort through this, plus I figured since it was a testbuild I wanted to release I could just release it and say Barbarian World with Barbarian Civ would break things if enabled together, and givning that disclaimer for a test build would make things OK. Do apreciate it, and will test this in a bit to see how it goes. Just wanted to thank you for taking the time to adress this, as it was my main hang ATM for an official release (at least on my end, I thankfully have a team, so if this works, that means I can now reg on the art and text folks to speed up their work, lol--lol-just didn't want them to finish their stuff and be stuck with them waiting on mine...).
 
Checked it out, and it does seem a little better, but that could be caused by the die roll. Still though A couple barbarian Civs just did their settelling event and got gifted around a dozen units in 500 BC, that's a little bit too many I think, but it's close to a good ammount. You do want the barb civs to be a threat and be able to capture cities or even take over nearby empires if they are not well defended, still though seems 1 or two units too much, but this is much better then what I experienced with having a 20 unit stack enter my territorry around 1500 BC. Haven't looked at how this change effects later era barbarian civs, hopefully it buffs them quite a bit, also I think that if a barb civ spawns in the Medieval or later era it should get gifted with a free settler for every era after the classical it is.
 
Top Bottom