When Do Tier 2 Barbarian Units Spawn?

SuedecivIII

Warlord
Joined
Apr 20, 2019
Messages
147
Tier 2s are horsemen normally, but in the editor you can change it to anything. Only, I changed it, but they won't spawn. Does it have to do with the era? I was under the impression that as soon as a player on the map had built that unit, they'd start spawning in camps. But that doesn't seem to happen in playtests.

Alternatively, if anyone knows a way of delaying when the first barbarian camps initially spawn, that would be great. I made a mod where everyone starts with 2 settlers and 2 workers, but that makes barb camps spawn turn 6 or so.
 
I thought it was once two civs were able to build the unit, the barbarians could.

I had thought that, too. But i found out otherwise. My current theory is:

If 2 civs have the prerequisites for the tech needed to build the unit, then the unit can spawn.

So if 2 civs have warrior code and wheel, then horsemen can spawn. That is because horsemen require horseback riding which requires warrior code and wheel.
 
When two civs enter the next era, you get the uprisings. Horses are the tier 2, right and I don't think you get them prior to the uprisings.
 
When two civs enter the next era, you get the uprisings. Horses are the tier 2, right and I don't think you get them prior to the uprisings.

Yes, you do. In the german PBEM 192 i had the opportunity to see horsemen emerge while i was still in the process of researching horseback riding while being ahead in technology. That was back in 2008.

The uprising appears to be unrelated to tier 2. However, the same is not true about the other direction. If tier 2 is available and an uprising occurs, then tier 2 will be used.
 
I had thought that, too. But i found out otherwise. My current theory is:

If 2 civs have the prerequisites for the tech needed to build the unit, then the unit can spawn.

So if 2 civs have warrior code and wheel, then horsemen can spawn. That is because horsemen require horseback riding which requires warrior code and wheel.
That would explain why Barb-Horses have been showing up so damn 'early' in my recent DG-attempts :mad:

Presumably the '2 Civs must know the prereqs' is a global condition, rather than a continental condition?

And presumably the same also applies to the Barb-Galleys, i.e. they start showing up when 2 Civs know both Writing and Pottery, rather than when 2 Civs know Mapmaking? If so, that's yet another good reason to hold onto Writing for as long as possible, while going for the Republic-slingshot. It keeps the suicide-Curraghs safer...
 
I just tested it. The first horse did not appear, when most had both WC and the Wheel. The test was on DG. The first barb horse was at 1750BC. At that time all knew all tier 1 tech, plus Iron Working and Mysticism. Do not know, if those two tier 2 techs were needed or any t2 tech would work or even, if t2 techs are needed. I would say that at least all t1 tech needs to be known to all. FWIIW
 
Yes, it could be a timed event. The map was nearly close to being full. I was in fact worried that they would expose all tiles and then no barbs could spawn. It was a std pan map. I used DG as I wanted to get to the next age quickly, but not fill the land. A higher level the AI has too many units and will clear barbs too fast. Lower level and I would have to spend more time, waiting for them to get to the next age, if that was the trigger.

Suedeciviii's test makes it look like city count is the key factor. I would not be shocked to find that there are several things that could be a trigger, rather than just a trigger.

Edit: If it is only city count, do they use a different value for each level? Seems like a bit of extra work. Using a city count, same for all levels and an additional trigger. Techs or era, with era forcing it regardless of all other factors.
 
Last edited:
Interesting question. I always thought from experience there was a "barb grace period" of about 40 turns, and that horsemen signaled other civs having the tech. I read somewhere that barbs get galleys when two civs know map making. But I usually play unmodded Monarch or Emperor games, so not enough variety to tell me what the barbs are 'launched' by.

I happen to be working on a program to read save files that might someday help look into the city count vs barbs theory. ('clua' is the one I mean...there are three executables in that repo.) Right now it can decompress and load civ3 save file data, but it's not understanding much of it yet. Batch-scanning saves and pulling statistics (like city counts and unit counts) is one of the target goals.

Come to think of it, there is also a behavior change in barbs that I never stopped to wonder about: at first they're content just fortifying outside your borders, and later they come charging in. I wonder if that's coincident with barb camps spawning or if it's yet another trigger?

Edit: Interesting. I'm not sure it helps this discussion, but there is a very interesting YouTube video mentioned in a recent post explaining barb targeting behavior, and the guy uses it to make a 5-bit adding logic circuit.
 
Last edited:
As I recall, the barb uprisings occur on a turn counter trigger. I don't remember many barb uprisings where they didn't spawn a whole lot of horses.
 
With a specific target in mind, I was able to get my little project to compare city counts versus barb warriors and horsemen. I don't know how to look for camps yet.

I scanned 256 save files, but of course many of those are different turns of the same game. And they're generally standard or large maps, default epic game, Monarch or Emperor difficulty.

It looks like barb warriors jump up in count between 16 and 19 cities, and barb horsemen start showing up between 40 and 50 cities, but I have one outlier save with 39 barb horsemen with 30 cities. Oh, that's a tiny map.

Here's a Google Sheets spreadsheet and scatter plot

It's not conclusive, especially since my games are usually very similar in size and difficulty, but it does seem like a decent guess that maybe tier 1 barbs spawn (aside from popped angry huts) a bit under 2x OCN, and maybe tier 2 barbs spawn around 4x OCN?

Spoiler Lua script that generated the spreadsheet :

Code:
-- left padding for easy terminal viewing
function lpad(s, l, c)
    local res = string.rep(c or ' ', l - #s) .. s
    return res
end

    bic.load_default()
    io.write("\"cities\",\"barb wars\",\"barb horses\",\"save name\"\n")
    civ3_save_files = get_savs({
        install_path .. "/Saves/Auto",
        install_path .. "/Saves",
    })
    for _, v in pairs(civ3_save_files) do
        sav.load(v)
        local barb_horseman = 0
        local barb_warrior = 0
        for _, v in ipairs(unit) do
            if v.civ_id == 0 and v.prto_id == 6 then
                barb_warrior = barb_warrior + 1
            end
            if v.civ_id == 0 and v.prto_id == 11 then
                barb_horseman = barb_horseman + 1
            end
        end
        io.write(lpad(tostring(game.city_count), 4))
        io.write(',', lpad(tostring(barb_warrior), 4))
        io.write(',', lpad(tostring(barb_horseman), 4))
        io.write(', \"', save_name,'\"\n')
    end


Edit: I probably also have a very limited understanding of OCN. I thought it was 10 on a standard map and doubled to 20 with the FP, but it's more complex than that. Perhaps halve my earlier OCN estimates.
 
Last edited:
I expanded my program to read the OCN and difficulty-based percent of optimal cities from the bic for each save. I also found how to count barb camps.

Results are in another spreadsheet.

Looks like barb camps and a jump in warrior count happen at when the global city count matches the adjusted OCN. (Which I know is for one civ, but I needed a way to adjust for map size and difficulty, and global city count / adjusted OCN seems like a good start.)

Horsemen seem to appear at about 2.2 cities/adjusted-OCN.
 

Attachments

  • 2020-05-23 01_09_59-civ3-ocn-vs-barbs - Google Sheets.png
    2020-05-23 01_09_59-civ3-ocn-vs-barbs - Google Sheets.png
    64.8 KB · Views: 57
By adjusted OCN you mean [OCN as per map size] x [OCN percentage as per difficulty setting]?

If that is the relevant threshold, then this will scale well for difficulty setting. Emperor is 80%, DG 70%, Deity 60% and Sid 50%.
 
By adjusted OCN you mean [OCN as per map size] x [OCN percentage as per difficulty setting]?

Yes. I'm pulling those from the bic, and it should work with custom bic games (except for I'm still hard-coding tier 1 barbs as prto_id 6 and tier 2 as prto_id 11).

If that is the relevant threshold, then this will scale well for difficulty setting. Emperor is 80%, DG 70%, Deity 60% and Sid 50%.

It does make sense, but still most of the saves I scanned were my games, to there's probably not enough variety to draw any firm conclusions. But SuedecivIII's conclusions are a global city count trigger, and it would seem to follow this would have to be adjusted at least for map size and probably difficulty, and OCN is a value that combines those three things, sort of. I guess another possibility is the barb aggression setting.

But it's a fun question, and I'm starting to wonder if we can gather a bunch more saves for more analysis.

Spoiler lua code for ocn-barbs csv :
The OCN stuff is about 3/4 of the way down, right before all the io.write's. Lua arrays start at 1 where most languages start at 0, hence the '+1' on the IDs. Speaking of which, I think I missed a '+1'.
Code:
-- left padding for easy terminal viewing
function lpad(s, l, c)
    local res = string.rep(c or ' ', l - #s) .. s
    return res
end

    bic.load_default()
    io.write("\"cities\",\"ocn\",\"barb camps\",\"barb wars\",\"barb horses\",\"cities/ocn\"\n")
    civ3_save_files = get_savs({
        install_path .. "/Saves/Auto",
        install_path .. "/Saves",
    })
    for _, v in pairs(civ3_save_files) do
        sav.load(v)
        local barb_horseman = 0
        local barb_warrior = 0
        for _, v in ipairs(unit) do
            if v.civ_id == 0 and v.prto_id == 6 then
                barb_warrior = barb_warrior + 1
            end
            if v.civ_id == 0 and v.prto_id == 11 then
                barb_horseman = barb_horseman + 1
            end
        end
        local barb_camp = 0
        for _, v in ipairs(tile) do
            if bit32.band(v.improvements, 0x80) ~= 0 then
                barb_camp = barb_camp + 1
            end
        end
        local ocn = wsiz[wrld.wsiz_id + 1].ocn
        ocn = math.floor(ocn * diff[game.diff_id].pct_optimal_cities / 100)
        io.write(lpad(tostring(game.city_count), 4))
        io.write(',', lpad(tostring(ocn), 4))
        io.write(',', lpad(tostring(barb_camp), 4))
        io.write(',', lpad(tostring(barb_warrior), 4))
        io.write(',', lpad(tostring(barb_horseman), 4))
        io.write(', ', string.format("%.2f", game.city_count / ocn))
        -- io.write(', \"', save_name,'\"')
        io.write('\n')
    end


Edit: As I discovered when posting the code, the last spreadsheet was using one difficulty level lower than actual, so the results might be slightly off, but consistently so.
 
Last edited:
Top Bottom