1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Barb Hate and You

Discussion in 'Civ4 - Strategy & Tips' started by MarigoldRan, May 1, 2013.

  1. MarigoldRan

    MarigoldRan WARLORD

    Joined:
    Mar 12, 2011
    Messages:
    2,328
    I wish someone could Code-Dive and find the relevant code, but I've found that barbarians attack you if you seem weak, and they avoid you if you spam units early game like a madman.

    I would literally see dozens of barbarians angling towards my cities if I don't have enough defenses, but when one or two more axeman comes out for me, the barbs all turn away and attack someone else.

    What code causes this? What are the exact mechanics for it?
     
  2. Handel

    Handel Prince

    Joined:
    Nov 29, 2005
    Messages:
    514
    This is one of the hidden AI bonuses although the fanboys stubbornly refuse to accept it. If you don't build the GW the barbs are coming for the human cities from the other side of the map hugging the AI cities they encounter on the way (not talking about the barb events - they seem to target a random civ).
     
  3. Culture Bomb

    Culture Bomb Warlord

    Joined:
    Feb 3, 2010
    Messages:
    298
    I actually think it's worse when they don't attack your cities but just wander around pillaging everything and preventing your workers from doing anything.
     
  4. MarigoldRan

    MarigoldRan WARLORD

    Joined:
    Mar 12, 2011
    Messages:
    2,328
    So what makes them approach you instead of someone else?

    I've noticed in-game that once you get out enough units, the barbs start to go somewhere else. But if you have fewer units than the AI, they come to you.
     
  5. Tommah

    Tommah Chieftain

    Joined:
    Sep 16, 2011
    Messages:
    12
    Location:
    London
    More often than not when I see a leader who is normally very strong have a poor start and low city count it's because barbs took their cities.

    @ OP, stacking units in cities doesn't stop barbs spawning. Have them fortified in positions which denies barbs a lot of places to spawn that's the key.
     
  6. Gwynnja

    Gwynnja Deity

    Joined:
    Dec 8, 2007
    Messages:
    2,010
    Gender:
    Male
    Location:
    CA
    Can you provide evidence?
     
  7. MarigoldRan

    MarigoldRan WARLORD

    Joined:
    Mar 12, 2011
    Messages:
    2,328
    If you take a look at WorldBuilder at turn 90 or so to see where the barbs are coming from on a huge map, you can see them angling towards some unfortunate dude from 20-30 spaces away (most of the time that unfortunate person being you, but not always).
     
  8. Kallikrates

    Kallikrates Prince

    Joined:
    May 30, 2012
    Messages:
    480
    Location:
    VRBS ANSEATICA
    You must be playing very different settings. On standard size, normal barbs (not raging) Monarch/Emperor I remember a single occasion where barbs took a city of Shaka, probably his 6th or so, a tiny one in jungle that spawned barbs before he could defend it properly.

    I do not know about the wanderings of the barbs, but the AI does have a documented bonus fighting barbs.
     
  9. MarigoldRan

    MarigoldRan WARLORD

    Joined:
    Mar 12, 2011
    Messages:
    2,328
    Try a huge continental map with barbs and 11-12 civs. Take a look at the map through worldbuilder on turn 90 if it's marathon. It's very obvious that all of the barbs are angling towards some location (90% of the time that location is YOU).

    On standard settings the barbs are wimps and can be fog-busted, which is why you don't see any of that behavior. Any barb that can be eliminated by some dude in a loincloth sitting on a hill with a club isn't a real barb.
     
  10. Gwynnja

    Gwynnja Deity

    Joined:
    Dec 8, 2007
    Messages:
    2,010
    Gender:
    Male
    Location:
    CA
    That's nice, but I'd be far less skeptical if you could show actual coding rather than anecdotal evidence and 20-30 turn-in-advance angling predictions.
     
  11. Handel

    Handel Prince

    Joined:
    Nov 29, 2005
    Messages:
    514
    I've seen it with my own eyes a lot of times. Maybe it is indeed because I play on huge epic maps.

    PS. Those are not the barbs which spam before 2000 BC (sorry about the politically incorrect usage of "BC". I am a politically incorrect person and I am proud of it). They are exactly like the animals and do not enter the cultural borders.
     
  12. Gwynnja

    Gwynnja Deity

    Joined:
    Dec 8, 2007
    Messages:
    2,010
    Gender:
    Male
    Location:
    CA
    Anecdotal evidence has very little credence. Also, just out of curiosity, if you are a politically incorrect person and proud of it, why are you apologizing for politically incorrect behavior? (Although I'm not entirely certain what is politically incorrect in your usage of BC.)
     
  13. Handel

    Handel Prince

    Joined:
    Nov 29, 2005
    Messages:
    514
    Ahh... I see you are a politically incorrect human w/o even knowing it? Well, I 'll tell you - "BC" means "Before Christ". But the politically correct peoples decided to ban it from use because "You see, someone may feel insulted from the word "Christ" so it politically correct to use BCE (Before Common Era) and CE instead of AD.
    As for the anecdotal evidence... well, that's what the Inquisition told to Giordano Bruno when he explained them the Earth rotates around the Sun, not vice versa.
     
  14. Ghpstage

    Ghpstage Deity

    Joined:
    Jan 15, 2009
    Messages:
    2,944
    Location:
    Bristol, England
    This thread is where most of the forums knowledge of AI behaviours originate, you may find some answers here though I wish the way the game chooses 'areas' was revealed.
     
  15. Gwynnja

    Gwynnja Deity

    Joined:
    Dec 8, 2007
    Messages:
    2,010
    Gender:
    Male
    Location:
    CA
    Well, whatever. The game calls it BC and AD, so that's how I refer to it.
     
  16. MarigoldRan

    MarigoldRan WARLORD

    Joined:
    Mar 12, 2011
    Messages:
    2,328
    From the thread:

    "If the barbs have calculated AREAAI_OFFENSIVE for their AreaAI (huge numbers of ATTACK barb units, most likely after random event; normally it's AREAAI_MASSING) they will straight target their chosen city without any such restrictions."

    AREAAI_MASSING or AREAAI_OFFENSIVE could be reason for their behavior.

    "Oh yeah, and they of course have a very advanced radar to detect all your units, cities and improvements. SearchRange = (Range+1)*(BaseMovements+1), with Range being the other parameter passed in the mission test calls besides the thresholds --> a 1 unit will scan a circle with a diameter of 9 tiles at the minimum (Range = 1)."

    My take on it is this:

    The barb calculates which place they can take an offensive or mass in. Part of that calculation depends on the mysterious AREAAI_MASSING or AREAAI_OFFENSIVE function which I suspect takes into account your relative military strength compared to other AI's. If your relative military strength is low, they mass on you. It's guesswork, but there IS coding evidence for this behavior.
     
  17. MarigoldRan

    MarigoldRan WARLORD

    Joined:
    Mar 12, 2011
    Messages:
    2,328
    Here's another quote from that thread:

    "Have you ever wondered about the sudden "wave" of barb units storming towards your capital followed by surprisingly very calm periods? That's exactly when threshold B) has been passed (NumCities > 3*NumPlayers) and the barbs have calculated AREAAI_OFFENSIVE for your area. In contrast to the misleading comment in the code of CvTeamAI::AI_calculateAreaAIType ("// XXX does this ever happen?") this is almost guaranteed to happen in every game. If the barbs haven't founded a city on your landmass yet, they only need TWO attack units for that AreaAI.
    The formula for this minimum number of offensive units is:
    N = ((NumBarbPop+NumBarbCities+1)*20)/100 + 2
    So once they have a few cities on your landmass they more or less leave you alone again, because the number of "needed" barbs per landmass is limited by the number of unowned tiles and the difficulty level.

    But during this period of harassment, not even the finest [game] tactics or the broadest creative-boosted cultural borders will protect you..."
     
  18. Ghpstage

    Ghpstage Deity

    Joined:
    Jan 15, 2009
    Messages:
    2,944
    Location:
    Bristol, England
    I agree in that it explains why barbs wander past civs and can travel considerable distances to attack places. The problem is as DanF didn't go into how the areas are decided we don't know if theres any intentional bias or whether, as is more likely its just the impact of other factors (e.g. more production->more units->more cities->more spawnbusting) or mistaken perception which is very common with this kind of thing.
     
  19. MarigoldRan

    MarigoldRan WARLORD

    Joined:
    Mar 12, 2011
    Messages:
    2,328
    Oh. That can be easily tested.
     
  20. TheMeInTeam

    TheMeInTeam Top Logic

    Joined:
    Jan 26, 2008
    Messages:
    25,750
    Pretty sure this was touched upon in "when do barbarians enter borders" thread that became an article. Barbs pick a target city. Their criteria for it is in the article, but IIRC when I was reading through it seemed impractical to try to influence it off of being a human city, in instances where it is in fact a human city.
     

Share This Page