Files
institution/Wiki/gangs/Affiliations-and-Segregation.md
T
flan 3530100ed5 Aggregate the whole suite wiki onto the Institution page
Wiki/Home.md is the suite's front door; every layer's wiki now mirrors here
under Wiki/<layer>/ (core, contraband, justice, gangs, ward), so the whole
suite reads in one place with the index linking to the local pages. The
layer repos stay canonical -- Tools/sync-wiki.sh refreshes the aggregated
copy on demand. The README's main page points to it.
2026-07-15 20:30:38 +00:00

6.3 KiB
Raw Blame History

Affiliations and segregation

Gangs grow out of who pawns already are — and the counter-play is to keep the wrong pawns apart.

A gang in this mod is never invented from nowhere. It crystallises along the bonds a colony already contains: shared faction, shared faith, or real friendship. This page covers the formation rule — what SharesAffiliation checks and why the same room requirement matters — and then the segregation counter-play that turns those same bonds against the network.

The formation rule

On each 5000-tick check, the gang component walks the eligible crew (every spawned humanlike that currently meets the Nature × Nurture ≥ 0.9 join bar) and tries to pair each unaffiliated member with a mate:

mate = a pawn q in crew such that:
    q != p
    AND q.GetRoom() == p.GetRoom()        -- same room, right now
    AND SharesAffiliation(p, q)           -- a bond they already have
if mate exists: Enlist(p, mate)

Two conditions, both required: they must be in the same room at the moment of the check, and they must share an affiliation. A disposed pawn does not fall in with a stranger across the map; it falls in with someone it is standing next to and already connected to.

Enlist then binds them: if either already runs with a gang, the other joins that gang; otherwise a fresh gang id is minted. So gangs accrete — a new member pairing with an existing member is absorbed into the existing crew rather than starting a rival one.

What counts as an affiliation

SharesAffiliation(a, b) is true if ANY of:
    a.Faction != null  AND  a.Faction == b.Faction           -- same faction
    Ideology active  AND  a.Ideo == b.Ideo (both non-null)   -- same ideoligion
    a.relations.OpinionOf(b) >= 20                            -- a genuine friendship
Bond Condition Notes
Same faction a.Faction == b.Faction (non-null) your colonists share one; captured raiders share theirs
Same ideoligion a.Ideo == b.Ideo, only if the Ideology DLC is active guarded by ModsConfig.IdeologyActive
Friendship OpinionOf(b) >= 20 a real positive relationship, not mere acquaintance

The design intent, from the source:

Gangs grow out of who pawns ALREADY are, not out of nowhere — so a prisoner's gang on the outside is their old faction/friends, and rival factions run as rival gangs.

This is why the system feels coherent rather than arbitrary. A crew is a faction bloc, a congregation, or a friend group — social lines the colony already has. Gangs mesh with them instead of stamping random groupings over the top.

Rival factions become rival gangs

Follow the rule to its conclusion. Two captured raiders from different hostile factions each share an affiliation with their own side but not with each other. Housed in the same wing, each pairs up along its own faction line — and now you have two gangs. By the definition on the Rivalry and Fights page, members of two different gangs are automatically rivals, and rival-gang violence between them is booked as a crime.

So the affiliation rule and the rivalry rule are two ends of one idea: who bands together and who is opposed both derive from pre-existing loyalties. Mix hostile factions or clashing ideoligions in one room and you have not made one big gang — you have made two rival ones and lit the fuse between them. This is a housing decision with mechanical teeth.

Segregation: the counter-play

Here is where the formation rule and the network rule meet, and where the rest of the suite earns its keep. A gang can only do anything — resupply itself — if its members can reach each other. MoveWithin requires SameGang and, for two co-located pawns, a walkable path (CanReach(..., Touch, Danger.Deadly)). Break the path and you break the network:

MoveWithin(from, to):
    ...
    if from.Spawned && to.Spawned && !from.CanReach(to, Touch, Deadly):
        return false      -- kept apart: the segregation counter-play

The source calls this out as the intended answer to the whole mod:

The counter-play is the rest of the suite: Classification SEGREGATES rivals into different wings, and a network whose members cannot REACH each other is starved.

Classification lives in Institution: Justice. It grades pawns by risk and lets you sort them into separate, walled wings. Two gangmates graded into different wings, with no walkable route between them, fail the reach gate on every network pass. The gang still exists on the membership map — they are still the same crew, still rivals of the other crew — but it can no longer pass a shiv from a holder to a have-not. A network that cannot reach itself is a network that cannot supply itself.

This is the elegant part of the design: the very bonds that formed the gang (SharesAffiliation) tell you who to keep apart, and the reach requirement (CanReach) makes keeping them apart actually starve the supply chain. You do not disband a gang; you partition the graph until its edges carry nothing.

How to play it

  • Read affiliations before you house pawns. Same-faction and same-ideoligion prisoners will band together; hostile factions in one wing will form rival gangs and fight. Sort deliberately.
  • Segregate by Classification, not by hope. Putting rivals in "different areas" is not enough — the reach test cares about a walkable path. A shared corridor is a supply line. Use genuinely separate, walled wings.
  • Starve, don't chase. You will rarely delete a gang outright. The durable win is to keep its members unable to reach one another so the network dries up, while keeping mood and deterrence high so few pawns cross the join bar in the first place (see Joining).
  • Watch the outside valve. Segregation starves internal resupply; a bent warden can still inject new contraband from outside (see Networks and Smuggling). Partition the wing and clean up your wardens for a network that genuinely goes dark.

Part of the Institution suite — Core · Contraband · Justice · Gangs (this). Each mod stands alone; together they are one system. AI disclosure: developed with substantial assistance from Claude (Anthropic).