How is the pool of barbarian clans unique units determined? Can it be changed?

whorble

Chieftain
Joined
Apr 25, 2023
Messages
14
I've grepped the entire Assets directory and combed through BarbarianClansMode_GameplayData.xml but found nothing mentioning particular units.

There's a parameter BARBARIAN_CLANS_UNIQUE_UNIT_STRENGTH_RANGE that presumably selects from all units and filters out ones that are too strong or weak, but that doesn't seem to be the case, since I have seen plenty of barbarian gardes imperiales, but not a single barbarian redcoat, and those units have the same exact stats except their continent bonus.
 
I'll try again, haha. I'm looking for a place in the database for barbarian clans mode where the logic for cycling through unique units are defined. For example, say the Stone Kite clan is currently spawning Legions and offering Legions for me to purchase. How did it get assigned Legions and not Toa or just plain Swordsmen? Can I ban or force certain units?

Regarding the BARBARIAN_CLANS_UNIQUE_UNIT_STRENGTH_RANGE parameter, since I haven't found anything else mentioning unique units, I'm speculating what it does. Purely based on its name, I would assume that it thinks something like this:

1. Currently it is the classical era, and this is a hills clan, so we will spawn Swordsmen.
2. Scan through some list of unique units, and filter ones who have between 25 and 45 strength (the Swordsman's 35 ± 10), and if no other clan has this unit assigned, pick it as our unique unit.

But if that were the case, I would very likely have seen more than 0 barbarian Redcoats in my hundreds of games. They're always Gardes Imperiales or plain Line Infantry. But I've seen all Swordsman uniques, so it doesn't look like it picks the first in the list alphabetically either. I'm just confused about how it works. It might just be my bad luck too!
 
I was looking through the list of unique units to see if I could find any other "missing" units and if there were any patterns, and I think I found one: it could be that they choose from all civilization unique units but not leader unique units: Longship, Hetairoi, Tagma, Black Army, Janissary, Redcoat and Rough Rider - I can't remember seeing any of those in barb clans mode (while, again, I've seen plenty of their civ unique siblings Berserker and Hypaspist). I'm unsure about Dromon, Huszar, Barbary Corsair and Sea Dog, however. No clan offers air units to my knowledge, so the Mustang is not applicable.

I also can't remember seeing privateers being offered. If it's anything like how Empire Victoria works, it would offer caravels after cartography, frigates after square rigging, and sea dogs after mercantilism, and since the latter two are late renaissance era techs/civics, it's easy to have their window of opportunity be very short, or even skipped entirely depending on which one you unlock first. Or maybe you reach steam power for ironclads even before that... Which would explain why I don't remember seeing a lot of privateers, while I do see De Zeven Provincien fairly often. Quadriremes would presumably be disqualified because both their ranged and melee strength is lower than galleys. Not sure about Frigates since their melee is weaker but have the same ranged.

I will acknowledge that I'm attempting to do science on randomly generated effects, which is a fool's errand, but I'm having fun! :hammer2:
 
Last edited:
While I haven't found out how to prevent clans from using certain units, I think I have found a way to make them use new units. I created a new "dummy" civilization and give it all those leaders' unique unit traits. The clans then seems to add those automatically to their pool. I haven't tested too much but seeing barbarian Viking Longships was a sign of some progress for me.

I'm wondering what side effects this method could have.
  • The dummy civ doesn't have a leader, but could it still show up in the game randomly somehow?
  • What about if Harald is in the game - will barbs still use Longships, since they don't "belong" to Harald but to the dummy civ?
I'm also still not sure what BARBARIAN_CLANS_UNIQUE_UNIT_CLAIM_INTERVAL_STANDARD and BARBARIAN_CLANS_UNIQUE_UNIT_STRENGTH_RANGE do, if anything at all. Changing to extreme values hasn't caused anything weird to happen (yet...)
SQL:
INSERT INTO Types (Type, Kind) VALUES
    ('CIVILIZATION_BARBARIAN_EXTENDED_UNIT_POOL', 'KIND_CIVILIZATION');

INSERT INTO Civilizations (CivilizationType, Name, Description, Adjective, StartingCivilizationLevelType) VALUES
    ('CIVILIZATION_BARBARIAN_EXTENDED_UNIT_POOL', 'LOC_CIVILIZATION_BARBARIAN_NAME', 'LOC_CIVILIZATION_BARBARIAN_DESCRIPTION', 'LOC_CIVILIZATION_BARBARIAN_ADJECTIVE', 'CIVILIZATION_LEVEL_FULL_CIV');

INSERT INTO CivilizationTraits (CivilizationType, TraitType) VALUES
    ('CIVILIZATION_BARBARIAN_EXTENDED_UNIT_POOL', 'TRAIT_LEADER_UNIT_AMERICAN_ROUGH_RIDER'),
    ('CIVILIZATION_BARBARIAN_EXTENDED_UNIT_POOL', 'TRAIT_LEADER_UNIT_BYZANTINE_TAGMA'),
    ('CIVILIZATION_BARBARIAN_EXTENDED_UNIT_POOL', 'TRAIT_LEADER_UNIT_ENGLISH_REDCOAT'),
    ('CIVILIZATION_BARBARIAN_EXTENDED_UNIT_POOL', 'TRAIT_LEADER_UNIT_HETAIROI'),
    ('CIVILIZATION_BARBARIAN_EXTENDED_UNIT_POOL', 'TRAIT_LEADER_UNIT_MATTHIAS_BLACK_ARMY'),
    ('CIVILIZATION_BARBARIAN_EXTENDED_UNIT_POOL', 'TRAIT_LEADER_UNIT_NORWEGIAN_LONGSHIP'),
    ('CIVILIZATION_BARBARIAN_EXTENDED_UNIT_POOL', 'TRAIT_LEADER_UNIT_SULEIMAN_JANISSARY');

UPDATE GlobalParameters SET Value =  1 WHERE Name = 'BARBARIAN_CLANS_UNIQUE_UNIT_CLAIM_INTERVAL_STANDARD';
UPDATE GlobalParameters SET Value = 50 WHERE Name = 'BARBARIAN_CLANS_UNIQUE_UNIT_STRENGTH_RANGE';
 
Some news: I finally found a Redcoat! [party] Also, I have never seen Lahore make a Nihang themselves, but I just saw a barbarian Nihang, after replacing the CivilizationTraits section above with a list generated like this (which is probably overkill):

SQL:
INSERT INTO CivilizationTraits (CivilizationType, TraitType)
    SELECT DISTINCT 'CIVILIZATION_BARBARIAN_EXTENDED_UNIT_POOL', TraitType
    FROM Units WHERE TraitType NOT NULL;

So at this point I'm like 99% sure I'm not hallucinating. :crazyeye:
 
Top Bottom