How does land barbarians work?

Smallpox vs. largepox, gen2 vs gen5, early war vs. peaceful alliances. Which is your favourite gaming style?
Post Reply
Sanguivorant
Posts: 33
Joined: Mon Apr 25, 2022 12:54 am

How does land barbarians work?

Post by Sanguivorant »

In my games sometimes they show up but very rarely. Even with hordes, they show up once, and then get wiped out eventually. Most barbarians come from the sea.

Which code is responsible for deciding where they spawn?
lucasdowman
Posts: 11
Joined: Mon Aug 04, 2025 8:15 am

Re: How does land barbarians work?

Post by lucasdowman »

From what I remember, barbarian spawning in Freeciv is handled by the server-side generator logic, which checks for empty tiles and distance from players. It would be interesting to know if sea tiles are actually treated as “more valid” spawn zones in practice.
Dino the Dinosore
Hardened
Posts: 223
Joined: Sun Dec 31, 2017 3:41 am

Re: How does land barbarians work?

Post by Dino the Dinosore »

The code that controls barbarian spawning is in the routine try_summon_barbarians() in file server/barbarian.c - it does both land and sea barbarians. The code comments say -

Code: Select all

  The barbarians are summoned at a randomly chosen place if:
  1. It's not closer than MIN_UNREST_DIST and not further than
     MAX_UNREST_DIST from the nearest city. City owner is called 'victim'
     here.
  2. The place or a neighboring tile must be empty to deploy the units.
  3. If it's the sea it shouldn't be far from the land. (questionable)
  4. Place must be known to the victim
  5. The uprising chance depends also on the victim empire size, its
     government (civil_war_chance) and barbarian difficulty level.
  6. The number of land units also depends slightly on victim's empire
     size and barbarian difficulty level.
  Q: The empire size is used so there are no uprisings in the beginning
     of the game (year is not good as it can be customized), but it seems
     a bit unjust if someone is always small. So maybe it should rather
     be an average number of cities (all cities/player num)? Depending
     on the victim government type is also questionable.
I find that it produces much fewer barbs than the old Sid Meyer Civ2, even with the "Barbarian appearance frequency" setting maxed out at raging hordes. Looking at the code there's a couple of places it could be modified to produce more. I might try playing with that and see if I can get it to produce more - I kind of liked the original Civ2.
Post Reply