Barbarians spawn logic

SWY

Prince
Joined
Oct 3, 2014
Messages
330
Location
The Netherlands
Hey everyone,

I'm trying to figure out when barbarians spawn, and which units they get.
  • Is there a minimum year before which barbarians do not spawn?
  • Do barbarians spawn near a certain type of city, or is it random?
  • What is the logic behind the units the barbarians will get?
  • Is there any difference between difficulty levels?

Basicly, let's list anything we know about barbarians in Civ1. You probably know why I want to know... :)
 
They obviously aren't there in 4000 BC. You also cannot spawn them from a hut if you haven't built your first city. If they can appear without the human having a city, IDK.

Land barbarians will spawn near cities but actually on land that is unsettled. This can be a problem if they keep destroying irrigation and mines in a large empire, but it can also be turned into a profitable scam - run a barbarian farm for diplomats. Use geography to your advantage and block them with a good defender and a quick attacker to hunt the leaders.

Barbarians appear to get higher level units along the lines of the world's general development, maxing out at frigate-cannon-knight-musketeer level. Other units they get are legion, cavalry and, rarely, chariots, only for land barbs.

Yes, there is a difference between difficulty levels. On lower levels barbarian attack is stunted. On Emperor it's actually stronger than it should be, I think. I don't remember numbers, but they're around.

Barbarians cannot kill a defender of a single city. Defenders in a capital get a bonus against barbs. Sea barbarians will not pillage and will take cities. Land barbarians get rid of irrigation and destroy cities (IIRC). There were some other things. This is just off the top of my head.
 
  • Like
Reactions: SWY
Never seen them do it. They just might be able to build them in a captured city, if it was building one as they took it, but I dont think I've seen that either. But the princpile should be the same as for the human player: you can actually build, let's say a mech. inf. without having labor union, if you capture a city that was building one. If you switch production, the option is gone though.
 
As far as I know, the Chariots and other irregular units only happen if the Barbarians capture a city.

I wonder if we can figure out under which conditions Barbarians will start to appear in the game, and whether those conditions are different with other difficulty levels.
 
Barbarian units: legion, diplomat, cavalry, knight, cannon, musketeer, frigate, sail.
Legions and diplomats never pillage. Not sure about the knights. Roads are never pillaged.
It's especially noticeable once you've stopped expanding that they keep spawning at same places. They won't appear in the middle of your empire, and it there's a larger gap placing your unit there will stop them from spawning. So probably they spawn xxx squares from the nearest unit. I'll do some testing.
 
From the sea :
Sails loaded with legions (maybe sometimes a diplomat ?)
Frigates loaded with knights (never seen diplomats with those)
They never pillage, neither destroy cities (unless 1 people cities of course)

From huts :
Cavalries, legions (sometimes chariots ?)
Don't know about pillage and cities destruction, because I cheat so much (save reload)

From land :
A diplomat and cavalries, or a diplomat with musketeers, and sometimes cannons
Sometimes a diplomat and some chariots (especially in sahara and north america, earth map)
They pillage and destroy cities even over 1 population

Sometimes, piles of loaded sails can be found near north pole as if barbarians had a big offshore party. Each time, I found them by exploring with a cruiser, and destroyed them (12 units destroyed).
 
Last edited:
DarkPanda got a great thread where he explains the odds for huts and barbarians.

If you build a city next to a hut, it can never be Barbarians.
 
As far as I know, the Chariots and other irregular units only happen if the Barbarians capture a city.

Negative on that. I do see chariots spawning from 'guerrilla insurgencies', rarely, but regularly.

As far as where they appear, I don't know what the limitations are but unlike new civs land barbarians can and often do spawn on bad terrain. Whether that's caused by the terrain itself or by the fact that large deserts or mountain ranges are more likely to be unsettled, I don't know.

For sea pirates I suspect they choose where to land not so much in accordance with the cities on the continent, but more in tune with where it's easier for them to navigate. That weird AI world map the game generates for pathfinding purposes that darkpanda (I think) uncovered, I believe that to be the key to why barbarian ships and ships in general tend to constantly land troops in some places and avoid others.
 
Barbys who attack from water, you can't do much about, in the early or mid-game. Roads and 2-move military units, and tight clusters of cities, is the best defense. Barbys who spawn on land, however, you can eliminate. Notice them cropping up in a certain patch of land repeatedly? Just build a city there. The insurrections will move farther away. Eventually, as your cities cover every desirable patch of land, the Barbarians will only spawn on the North or South Pole, there's a flash of a red unit on snow, and they immediately die of frostbite. Rule of thumb: any place where you see Barbys pop up, that's a good place for you to build a city. Roll a Settler up there with a Cav/Char/Kni, found a 'burg and start another Cav/Char/Kni in your civ's core to move that way and protect the far city.

Every lobe of your landmass which you can populate, decreases the chances that Barbys will arise on your land. Pleasantly, it increases the chance that land Barbys will pester your rivals. Unpleasantly, far separated cities are harder to protect. Your game will be different, but in some games i have found it useful to keep a stalemate on a rival instead of killing their capital, just because the enemy city prevents Barbarians from spawning on that spit of land.
 
@SWY Here are some of my comments regarding barbarian spawning based on several playthroughs. Hopefully it will be helpful for CivONE development.
What I did was I revealed the whole map with cheats and then by pressing F1 I could monitor where and when barbarians appeared.

For sea (sail/frigate) barbarians:
  • they spawn every 8 turns
  • they start spawning at 3360 BC (emperor diff), 2720 BC (king), 2080 BC (prince), 1440 BC (warlord), 960 BC (chieftain)
  • at one point in the game the naval barbarians stop spawning (unlike the land units). I'm not 100% sure what is the reason, but I'm almost certain it has to do with some advance being researched (by either Civ). In one game naval barbs stopped appearing at 1954 AD, in second game at 1930 AD and in third game at 1770 AD. In the third game I was playing on emperor diff, and it seems Zulus reached a certain advance. But I'm not sure which advance triggers this. I'll have to do more research for this point.
  • the moment they spawn, they do the movement, so it's difficult to pinpoint the exact location where they appear.
  • It seems they appear at least 1 tile from land (e.g. they appeared in the Mediterranean on one EARTH game). The starting location, it seems, is completely random. I also never noticed them appearing near the poles (at least a couple squares from the N/S poles) or in any of the lakes.
  • sails appear until 1500 AD, then frigates. To be more exact, the last sail appears at 1460 AD, the first frigate 8 turns later at 1520 AD (keep in mind that after 1500 AD, 1 turn changes from 10 to 5 years).
  • sails carry 1 Legion + leader (diplomat) up until (including) 1120 BC. From 960 BC to 1460 AD sails carry 2 Legions + leader. From 1520 AD frigates carry 3 legions + leader. At one point frigates start carrying 3 knights + leader (this transition from legions--> knights happened at 1882 AD/1834 AD/1640 AD in 3 games I played. I researched cannons & gunpowder a while back, so perhaps this triggers it.)
  • When barbarian ship appears, it starts moving (GO-TO order) towards the nearest capital (of any civ) until it reaches land, then it disembarks its units. This go-to function is not always working properly, for example in EARTH map when a barbarian ship appears in the pacific and starts moving towards Europe or Africa, it gets stuck on the edge of America and it stays there indefinitely. This eventually causes stacks of enemy ships standing together on one particular tile. Also ships tend to get stuck somewhere close to the north pole for whatever reason. Once you get near them they start attacking you.

For land barbarian unrests:
  • as was already posted, they appear near a city only if there is enough space around and only in tiles which you've discovered. This makes sense otherwise map would get flooded with barbarians. I've had games where throughout the game not a single barbarian spawned.
  • the most common spawns are cavalry which are later replaced by musketeers (the replacement happened at 1800 AD in one of my games, but I cannot confirm if something else triggered this)
  • some combinations I've seen: 6 cavalry+legion, 2 cavalry+leader, 8 cavalry, 4 cavalry+leader, 4 cavalry+2 chariots+leader (yes, chariots are a thing), 3 cavalry+leader, 4 cavalry+1 chariot+leader, 2 musketeers+leader, 4 musketeers+4 cannons+leader, 4 musketeers+2 cannons+leader, 6 musketeers+3 cannons+leader. There are probably more combinations, but this needs to be researched. Also I have not seen knights spawning on land.
  • musketeers & cavalry pillage irrigation but not roads. Cannons, knights, leader, legion do not pillage. Not sure about the chariots.
  • the spawns seem to be 4/5/6 tiles away (can also be diagonally) from a city
  • unrests will not happen if you place a unit nearby
  • it's hard to determine the frequency of these unrests. Seems to be a random thing. In 2 games the first unrests started at 2720 BC and 2560 BC. As much as 27 turns and as little as 3 turns can take place between unrests in the same place.
  • while land spawning barbarians always seem to target a particular objective (city), barbarians from ships can get lost and just wander around the map aimlessly
  • regarding fleeing leaders (diplomats), you've noticed they disappear if you don't catch them soon enough. In some games they can stay in tiles indefinitely. Enemy AI just ignores them.
 
@SWY I did one more playthrough and barbarian ships stopped appearing after I researched combustion. Makes sense and I hope this is true. Would be good if anyone else could confirm this.

A couple more things:
  • I mentioned that land barbarian uprisings occur only in tiles that have already been discovered/revealed. I should point out that it does not matter which civ discovered the tiles. So you can have uprising near your town in squares that you have not yet revealed, but other civs have.
  • I'm having difficulties finding out what triggers transition from cavalry --> musketeers on land uprisings. Unlike sea spawns these do not happen regularly. But still on my last playthrough first musketeers I noticed spawned after I researched steel. However I doubt this is the cause.
 
'City destoyers' and 'pillage lovers' is not the same group. Every barbarian land unit, exept legions and knights, will auto pillage (even if YOU are Attila). But only cavalry and musketeers (from 'normal' barb units) will destroy cities. Charriots and cannons do pillage, but they also can capture cities. Almost all other land barbarian units are the similar to chariots and cannons in this regard, exept settlers, militia and phalanx. Even if you cannot meet them in normal game. You can, though, when you play as barbs, save default production in a captured cities and got some unique units this way. Maybe if unit attack is less than 3 it will destroy the city. Edit: yep, it's so. Custom units with attack less than 3 destroy cities too.

Source: my testing with JCivEd today and rare casual barb games long time ago.

Edit: I can say one other fun thing about them. SDI will not protect properly against barbrarian nuclear bomb. Message about protection appears, but pollution/population decrease will happen anyway.

Maybe there's also connection between 'glitch lost cities' (when city suddenly lost all his defenders and you should re-take it) and barbarians. I think they can LOOK into such cities and they cannot capture them, i.e. they will simple move units into such city, but I need more testing.
 
Last edited:
Don't barbarians get riflemen and tanks or is that only later civ games?
Never seen them do it. They just might be able to build them in a captured city, if it was building one as they took it,
I'm 99.999% sure that I do remember also seeing barb-Rifles in the late game on the CivDOS Earthmap, coming down from the northern Russian Forests that I usually never bothered Settling. Don't remember ever seeing barb-Tanks, though -- and that I'm pretty sure I would have remembered!
 
axx was pretty correct about sea spawn of barbarians! Let's see.

Some pseudo-code below.
Code:
var_A = (5-difficulty)*30;
var_B = game_turn;
var_C = game_turn/150+1;
IF var_C < 1 THEN var_C = 1;
IF var_C > 3 THEN var_C = 3;

IF var_A <= var_B
AND
IF game_turn+1 is multiple of 8 AND no civ discovered AUTOMOBILE tech before
THEN
try to set random X from 0 to 79 and random Y from 3 to 46 (so barb ships never spawn on 3 northernmost and 3 southernmost lines...)
WHILE (X,Y) has some unit //including barbarian units
or (X,Y) is not an ocean square
or size of ocean in (X,Y) is strictly less than 10;

IF var_C < 3
 unit = SAIL;
ELSE
 unit = FRIGATE;
spawn UNIT;
counter = 0;
WHILE counter <= var_C
{
 IF no civ discovered EXPLOSIVES before
  unit2 = LEGION;
 ELSE
  unit2 = KNIGHTS;
 if var_C == counter
  unit2 = DIPLOMAT;
 spawn UNIT2;
 set SENTRY flag of unit2 to 1;
counter = counter+1;
}

So, byte sequence in exe:
26 f6 06 24 05 07... 24 05 is a tech for stop sea barb spawn
26 f6 06 20 05 07... 20 05 tech for Knights
addresses in packed civ.exe (474.05 - 'new rules'): 0x2D19 - spawn, 0x2E03 - knights (don't forget to backup!)
addresses in packed civ.exe (475.01 - 'old rules'): 0x2D0B - spawn, 0x2D5F - knights

Tech list starts at 0x4b0 and every record is 2 bytes long. For example, the wheel is a tech number 0x21, so to stop barbs from spawning after the wheel (all in hex): 4b0+2*21 = 4f2. 04f2 in reverse byte order is f2 04. So, you need to change 24 05 to f2 04.

And about land spawn - it's much more complicated, and for now I only have some basic understanding. For example, chariots to cavalry is like cannons to musketeers, but because so early in the game your cities are much smaller and poorer, you usually don't see any.
 
Last edited:
  • Like
Reactions: axx
That's brilliant @tupi. I'm also quite sure a certain advance stops sea barb spawning, but in my multiple playthroughs I always forgot to write down some stuff like what year I researched my advances. Had to many other parameters to monitor and it slipped my mind.

I agree that land spawning is more complicated, TBH by the time I started figuring it out I was burned out by sea barbs logic and never fully commited to it. And when SWY went MIA I shifted my focus elsewhere.

Also I'll eventually write your revelations here.
 
Top Bottom