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.
This commit is contained in:
flan
2026-07-15 20:30:38 +00:00
parent 25eb3a77db
commit 3530100ed5
31 changed files with 4574 additions and 6 deletions
+115
View File
@@ -0,0 +1,115 @@
# 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](Rivalry-and-Fights.md) 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](Joining.md)).
- **Watch the outside valve.** Segregation starves *internal* resupply; a bent warden can still inject
new contraband from outside (see [Networks and Smuggling](Networks-and-Smuggling.md)). 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).*
+89
View File
@@ -0,0 +1,89 @@
# Institution: Gangs
*Gangs as **contraband economies** — not mood. The social capstone of the **Institution** suite of
RimWorld 1.6 mods.*
---
## What Gangs is
Gangs turns the loose, disposed pawns in your colony — colonists, prisoners, slaves — into a
**network** that moves contraband. When disposition and circumstance line up, pawns who already share
a bond band together, and a member who holds a stash quietly resupplies a member who has none. A
search that turns up nothing on one prisoner has therefore *not* cleaned out the wing: the wing is a
supply chain, and you only searched one link.
That is the entire point, and it is a deliberately narrow one. Gangs does not do mood. It does not do
a "gang leader buff." It does the one thing nothing else in the ecosystem does — it makes contraband
**flow between pawns**, and then hands you the tools to cut the flow.
## The gap it fills (and the one it doesn't)
If you run **Prisoner Realism**, its *Ringleader* system already models a dominant prisoner spreading
unrest and mood contagion through a wing. That system is good, and Gangs does not touch it. Ringleader
owns *influence and mood*.
Gangs owns the thing Ringleader has no equivalent for: **the network as a logistics graph.** Contraband
physically changes hands along social lines. A stash on one pawn is a stash available to the whole
gang. The two systems are complementary — run both. Ringleader tells you *who stirs the pot*; Gangs
tells you *how the shivs get around*.
## Why it needs the whole suite
Gangs is the module built **last**, because it needs every other Institution mod already in place. It
is not a standalone feature; it is the suite working together, and it is honest about that in its
dependencies:
| It asks... | ...and the answer comes from |
|---|---|
| *Who is disposed enough to join?* | **Institution: Core** — `Nature × Nurture`, the shared propensity engine |
| *What do they move?* | **Institution: Contraband** — concealment, stashes, search, and the bent-warden supply route |
| *Where does a fight get booked, and how are rivals kept apart?* | **Institution: Justice** — the crime/deterrence loop, and Classification's segregation |
Remove any one of those and Gangs has nothing to stand on. It is the place where Core's spectrum,
Contraband's stashes, and Justice's policing all cash out at once.
## A healthy colony grows few gangs — or none
This is the thesis, and it is enforced in the numbers, not just the flavour. Membership is gated at
`Nature × Nurture ≥ 0.9` — a high bar on purpose. A disposed pawn who is **well-kept and
well-policed** does not band up: their nurture multiplier stays low, and deterrence pulls it lower
still. It takes a foul streak (nature) *and* a badly-run situation (nurture) at the same time.
So a gang problem is a **symptom**. It is the game telling you that a wing is mistreated, under-policed,
or both. The fix is never "fight the gang system" — it is to run a better prison. Feed them, give them
recreation, keep deterrence high, segregate rivals, and the networks starve on their own.
> A gang is a symptom of a badly-run colony, not furniture.
## The pages
- **[Joining](Joining.md)** — `WouldJoin = Nature × Nurture ≥ 0.9`: why the bar is high, why good
treatment and deterrence keep pawns *out*, and how the 5000-tick check works for every kind of pawn.
- **[Networks and Smuggling](Networks-and-Smuggling.md)** — `MoveWithin`: how a holder resupplies a
needy gangmate, the *same-gang + can-reach* rule, why this defeats a single search, and how a bent
warden refills a starved network from outside.
- **[Rivalry and Fights](Rivalry-and-Fights.md)** — `AreRivals` and `RecordFight`: how a gang fight is
booked as a crime through Justice, why inside-the-wire and out-on-the-street are the same offence,
and how it feeds deterrence.
- **[Affiliations and Segregation](Affiliations-and-Segregation.md)** — `SharesAffiliation` plus
*same room* as the formation rule, why rival factions become rival gangs, and how Classification's
segregation is the counter-play that starves a network which cannot reach itself.
## The suite
Part of the **Institution** suite of RimWorld 1.6 mods:
- **Institution: Core** — the propensity engine (`Nature × Nurture`), criminal records, secured context.
- **Institution: Contraband** — concealment, improvised shivs, tunnels, warden search and corruption.
- **Institution: Justice** — Classification, Deterrence, Discipline, Parole, Regime.
- **Institution: Gangs** — this mod: joining, networks/smuggling, rivalry/fights.
Sibling projects: **Foul Play** (the vessel/substance framework and the "Piss Nuke") and **Ward** (the
test harness and a ward/treatment prison mode).
Each mod stands alone as an install; together they form one system.
---
*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).*
+134
View File
@@ -0,0 +1,134 @@
# Joining a gang
*How Gangs decides who runs with a crew — and why a well-run colony keeps almost everyone out.*
Membership is not random, and it is not a mood event. A pawn joins a gang only when their **disposition
and their circumstances line up at once** — the same `Nature × Nurture` engine that drives every other
behaviour in the Institution suite. This page covers the exact test, why the bar is set where it is,
and how you keep pawns on the right side of it.
## The rule
```
WouldJoin(pawn) == Propensity.Nature(pawn) * Propensity.Nurture(pawn) >= JoinThreshold
JoinThreshold = 0.9
```
Two gates before the maths even runs:
| Guard | Effect |
|---|---|
| `pawn == null` | never joins |
| not `RaceProps.Humanlike` | never joins — animals and mechs are out |
Then it is one line: multiply the pawn's **Nature** by their **Nurture** and compare to **0.9**. There
is no dice roll here. `WouldJoin` is a deterministic threshold on the two propensity scores, so the
same pawn in the same situation always gives the same answer — join, or don't. (This is different from
Core's `Propensity.Would(...)`, which *is* a seeded random roll used for one-off acts like a piss
spree. Gang membership is a standing condition, so it uses the raw product.)
### The two halves
Both terms come from **Institution: Core** — see Core's own documentation for the full tables — but you
need the shape of them to understand the bar:
- **Nature** (`0..1`) is *who the pawn is*: a base of `0.05`, plus trait weights, clamped to `[0, 1]`.
Psychopath `+0.45`, Bloodlust `+0.35`, Kleptomaniac `+0.40`, Greedy `+0.25`, Abrasive `+0.15`;
and it goes **down** for Kind `−0.30` or Ascetic `−0.15`. This is fixed at pawn creation and barely
moves.
- **Nurture** (a multiplier, `~≥ 0.4`, base `1.0`) is *the situation you put them in*: a floored mood
multiplies it up hard (roughly `×2.5` under 0.20 mood, `×1.6` under 0.35), being held while
miserable adds more (`×1.4`), a hardened record (negative reform) raises it, and — critically —
**deterrence pulls it down** (`×Lerp(1.3, 0.7, deterrence)`, neutral `1.0` at baseline order, so a
high-deterrence colony scales nurture toward `0.7`). This is the half you control.
## Why the bar is high
`0.9` is a deliberately steep threshold. From the source, in its own words:
> A high bar, on purpose: gangs are a symptom of a badly-run colony, not furniture. A healthy Rimworld
> — content pawns, an orderly colony — grows few gangs, if any.
Because the two terms are **multiplied**, both have to be substantial for the product to clear `0.9`.
A nasty pawn in a happy, policed colony has a low nurture and stays out. A saintly pawn in a hellhole
has a near-zero nature and stays out. You only get a gang when a genuinely disposed pawn is *also*
neglected or unpoliced — foul streak **and** bad situation, together.
That is the design speaking through the arithmetic: a gang is never bad luck. It is feedback.
## Worked examples
All numbers below use Core's documented factors; the intermediate nurture figures are rounded to show
the shape of the decision.
| Pawn | Nature | Situation → Nurture | Product | Joins? |
|---|---|---|---|---|
| **Kind colonist**, ordinary life | `0.05 − 0.30 → 0.00` (clamped) | content, `≈ 1.0` | `0.00` | **No** — nature floors it |
| **Greedy prisoner**, content, policed | `0.30` | fed & high deterrence, `≈ 0.7` | `≈ 0.21` | **No** |
| **Greedy prisoner**, starved & neglected | `0.30` | mood floored + held, `≈ 3.5` | `≈ 1.05` | **Yes** |
| ...same pawn, but you raise deterrence | `0.30` | `× ≈ 0.7` → `≈ 2.45` | `≈ 0.74` | **No** — deterrence tipped them out |
| **Psychopath + Bloodlust**, mood floored | `≈ 0.85` | mood floored + held, `≈ 3.5` | `≈ 2.9` | **Yes** — nothing short of reform pulls this back |
The middle rows are the whole game of it. The **same greedy prisoner** joins or abstains purely on how
you run the wing. The Kind colonist and the near-maxed psychopath are the fixed poles: one essentially
cannot join, the other essentially always will if you neglect them. Everyone in between is a policy
choice.
The mod's own integration test asserts exactly these poles: a psychopath-plus-bloodlust pawn with a
floored mood returns `WouldJoin == true`, and a Kind colonist in ordinary circumstance returns
`WouldJoin == false`.
## It works for every pawn, everywhere
There is no "prisoners only" special case. The comment is explicit:
> Any pawn — colonist, prisoner, slave — can, wherever they are.
`WouldJoin` reads nothing about a pawn's secured status. A disposed **free colonist** can run with a
crew on the outside; a **prisoner** can run with theirs on the inside; a **slave** likewise. This is
what lets a gang span the wall — an outside member and an inside member of the same crew (see
[Networks and Smuggling](Networks-and-Smuggling.md)). Being held raises nurture (misery), but it is not
a requirement.
## The cadence: the 5000-tick check
Membership is re-evaluated on a fixed interval by the gang map component:
```
CheckInterval = 5000 ticks
MapComponentTick: run only when TicksGame % 5000 == 0
```
**5000 ticks** is about **2 in-game hours** (a RimWorld day is 60,000 ticks), or roughly **80 seconds**
of real time at normal (1×) speed. On each fire, the component:
1. Gathers `crew` — every spawned humanlike on the map for whom `WouldJoin` is currently true.
2. Pairs up unaffiliated members of `crew` who **share a room and a bond** into gangs (see
[Affiliations and Segregation](Affiliations-and-Segregation.md)).
3. Runs one round of network resupply inside each gang (see
[Networks and Smuggling](Networks-and-Smuggling.md)).
Because the check re-reads `WouldJoin` every time, membership is *live*: a pawn whose situation improves
past the point where the product drops back under `0.9` simply stops being eligible to form new bonds.
The bar is not a one-time gate at recruitment — it is a standing condition the colony is continuously
graded against.
## How to keep pawns out
You do not fight the gang system. You lower nurture, which lowers the product, which drops pawns below
`0.9`:
- **Feed them and give them recreation.** Mood is the biggest nurture multiplier by far. A wing above
0.35 mood loses the `×2.5`/`×1.6` spikes entirely.
- **Keep deterrence high** (Institution: Justice). Deterrence scales nurture down toward `0.7`; a
well-policed colony is *arithmetically* less gang-prone. This is the row in the table above where the
same greedy prisoner flips from *joins* to *abstains*.
- **Reform, don't just punish.** A hardened record (negative reform) *raises* nurture; discipline that
actually reforms (positive reform) lowers it. Harsh punishment that prisonizes a pawn makes the
gang problem worse, not better.
- **Accept the two poles.** A near-maxed psychopath will run with someone the moment you slip; a Kind
pawn essentially never will. Spend your attention on the middle.
---
*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).*
+120
View File
@@ -0,0 +1,120 @@
# Networks and smuggling
*The one thing nothing else models: contraband that flows **between** pawns. A gang is a supply chain.*
This is the core of the mod. Everything else — who joins, who fights, who is kept apart — exists to
serve or to break the network described here. A gang is not a mood aura; it is a **logistics graph**,
and its edges carry contraband.
## The move
The heart of it is one method, `MoveWithin(from, to)`: a gangmate who is holding a stash passes a piece
of it to a gangmate who has none. It returns `true` if something actually moved.
```
MoveWithin(from, to):
1. both non-null, and SameGang(from, to) -- else false
2. if both are Spawned: from must CanReach(to, -- the reach gate
PathEndMode.Touch, Danger.Deadly) -- else false
3. a Contraband tracker must exist on the map -- else false
4. 'from' must have at least one concealed item -- else false
5. take stash[0]:
tracker.Confiscate(from, item.def) -- leaves the supplier's hands
tracker.Conceal(to, item.def) -- arrives, hidden, in the customer's
return true
```
A few things worth reading carefully:
- **One item per move.** It takes `stash[0]` — the first concealed item on the supplier — and moves
exactly that. It is a redistribution, not a duplication: the item leaves `from` (`Confiscate`) and
arrives concealed on `to` (`Conceal`). The gang's total stash is unchanged; only *who holds it*
changes.
- **Same gang, always.** `SameGang` requires both pawns to hold the same non-zero gang id. There is no
smuggling to a stranger — the network only moves along membership.
- **The reach gate only applies to co-located pawns.** The `CanReach` check is guarded by
`from.Spawned && to.Spawned`. Two pawns both physically on the map must have a walkable path
(`Touch` range, willing to cross `Deadly` danger) between them. If a member is not spawned, the
reach check is skipped — which is what allows a gang to reach across the wall to a member who is off
the active map.
## Why this defeats a single search
Consider a wing of four gangmates and one shiv. You search Prisoner A and find nothing — clean. You
tick a box: *cell searched, no contraband.* But the shiv was on Prisoner C the whole time, and on the
next 5000-tick network pass it will move to whoever is out. Search C tomorrow and it may already be on
A again.
From the source comment, plainly:
> A gangmate holding a stash supplies one who has none, so a search that turns up nothing on one
> prisoner has not cleaned out the wing.
A single search is a snapshot of one node in a graph that reshuffles itself. This is the whole reason
contraband-as-a-network is worth modelling: **the unit of contraband is the wing, not the pawn.** To
clean it out you have to either search faster than it moves, or — far better — break the graph.
## The automatic resupply pass
You do not call `MoveWithin` by hand; the gang component does it on the 5000-tick check. After forming
gangs for the pass, it runs one resupply round **per gang**:
```
for each gang among the eligible crew:
holder = first member who IS hiding contraband
needy = first member who is NOT hiding contraband
if holder and needy both exist:
MoveWithin(holder, needy)
```
So on each interval, every gang that has both a haves-member and a have-not-member performs **one**
transfer, moving a single item from a holder to someone empty-handed. Over several ticks the effect is
that a gang tends to keep its members supplied and to spread a stash out — which is exactly what makes
a scattershot search miss it. (Only members who currently meet the join bar participate in this
automatic pass; the resupply loop draws from the same `crew` used for formation.)
## The cross-wall move
Because `WouldJoin` and `SameGang` care nothing about a pawn's secured status, a gang can have a
**free** member and a **held** member. If the free member is holding the stash, the network resupplies
*into* the prison — the outside man passes to the inside man. The mod's integration test builds exactly
this: a free psychopath colonist and a prisoner in one gang, the stash on the free member, and
`MoveWithin(free, prisoner)` succeeds — after which the prisoner is hiding contraband and the free
colonist is not. Your prison's contraband problem is not sealed inside your prison.
## Resupply from outside: the bent warden
`MoveWithin` only *redistributes* what a gang already has. So what happens when you finally search the
whole wing on the same day and strip every member clean — the graph has no more edges to carry? The
gang is starved. It stays starved until contraband **re-enters** from outside.
That external source is not part of Gangs; it is **Institution: Contraband's** corruption route. A
warden's honesty varies by personality (a Greedy warden has a price), and a bent warden can *smuggle
contraband in to a prisoner* — `Corruption.Smuggle(warden, prisoner, tracker)` plants a concealed item
directly. That single seeded item is then all the network needs: one holder, and the 5000-tick pass
spreads it back out across everyone who can reach.
So the two halves of the supply picture are:
| Mechanism | Owner | What it does |
|---|---|---|
| `MoveWithin` | **Gangs** | moves existing contraband *between* gangmates who can reach each other |
| `Corruption.Smuggle` | **Contraband** | injects *new* contraband from outside via a corruptible warden |
Cut both and a gang genuinely dries up. Cut only the redistribution and a bent warden re-seeds it; cut
only the warden and any stash you missed keeps circulating.
## How to break a network
- **Search the whole wing at once**, not one pawn at a time. A partial sweep is a snapshot the network
routes around.
- **Segregate rivals into different, unreachable wings** (Classification, in Institution: Justice). The
reach gate is the lever — a network whose members cannot walk to each other cannot pass anything.
This is the primary counter-play; see
[Affiliations and Segregation](Affiliations-and-Segregation.md).
- **Clean up your wardens.** If searches never seem to finish the job, you may have a Greedy warden
re-seeding the wing. Corruption is the resupply valve; personality is the fix.
---
*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).*
+116
View File
@@ -0,0 +1,116 @@
# Rivalry and fights
*Two gangs, one grudge. A gang fight is a **crime** — booked, attributed, and fed back into the colony's
climate of order.*
Gangs do not just supply themselves; they collide. Where the network is about who shares, rivalry is
about who is opposed — and, crucially, about turning gang violence into something the rest of the
suite can *see* and *police*.
## Who is a rival
```
AreRivals(a, b):
ga = GangOf(a); gb = GangOf(b)
return ga != 0 && gb != 0 && ga != gb
```
The definition is exactly as blunt as it reads: **two pawns in two different gangs are rivals.** Both
must actually be in a gang (a non-zero id), and the ids must differ. From the source:
> Two pawns of DIFFERENT gangs are rivals — inside the wire or out on the street.
Note what is *not* required. There is no separate "hostility" flag, no rival-declaration event, no
threshold to cross. The moment two crews exist, their members are rivals of one another. Rivalry is a
structural fact about the membership map, not a mood or a relationship value.
Two consequences fall straight out of that:
- **Non-members are nobody's rival.** A pawn with gang id `0` — everyone in a healthy colony — is never
a rival to anyone, because `AreRivals` requires both ids non-zero. No gangs, no rivalry.
- **Same gang, never rivals.** Members of one crew fail the `ga != gb` test. Within a gang there is no
rivalry to book; there is the network (see [Networks and Smuggling](Networks-and-Smuggling.md)).
Where do two *different* gangs come from in the first place? From the affiliations pawns already have —
rival factions and rival ideoligions form into separate crews. That is the subject of
[Affiliations and Segregation](Affiliations-and-Segregation.md); the short version is that gangs mesh
with the colony's existing social fault lines, so **rival factions run as rival gangs.**
## A fight is a crime
The payoff of tracking rivalry is `RecordFight`. When a rival-gang attack happens, it is not treated as
generic brawling — it is booked as a crime through the same Justice pipeline as any other offence.
```
RecordFight(attacker, victim):
if attacker == null || victim == null: return
if !AreRivals(attacker, victim): return -- only rival-gang violence counts
Justice.RecordCrime(attacker)
```
So the guard is precise: the two pawns must be **rivals** (different gangs) for anything to be recorded.
A scuffle between gangmates, or between two non-members, is not a *gang* fight and is not booked here.
When it *is* rival-gang violence, the whole event routes through one call — `Justice.RecordCrime`,
against the **attacker** — and that single call does three things at once (it lives in Institution:
Justice, but this is what Gangs is leaning on):
| Effect of `Justice.RecordCrime(attacker)` | Owner |
|---|---|
| `crimesCommitted` on the attacker's record goes up | Core's `CriminalRecord` |
| `lastCrimeTick` is stamped to now | Core's `CriminalRecord` |
| the colony's **deterrence** nudges **down** (a crime happened; order slipped) | Justice's `MapComponent_Deterrence` |
The mod's integration test confirms the loop end to end: it builds two rival gangs, records a fight,
and asserts both that the attacker and victim *are* rivals and that the attacker's `crimesCommitted`
went up as a result.
## Inside the wire and out on the street are the same offence
This is the design point the source is emphatic about:
> A gang fight is a CRIME — it goes on the attacker's record and moves the colony's climate through
> the same Justice loop as any other, so it can be investigated, attributed and policed. Rival-gang
> violence inside a prison and out on the street are the same offence.
There is no separate code path for a prison-yard shanking versus a colonists' brawl in the dining
room. `RecordFight` reads only `AreRivals` and calls `Justice.RecordCrime`. A free colonist who is a
gang member attacking a rival is booked identically to a prisoner doing the same in a cell block. The
gang system does not care which side of the wall the violence is on — only that it was between rivals.
This is what makes gang violence *legible* to the rest of the suite. A fight is not a one-off flavour
event that scrolls past in the log; it is a record entry with an attributed perpetrator and a timestamp,
which means it can be investigated, blamed on a specific pawn, and answered.
## How it feeds deterrence — and back into joining
Here is the loop that closes the whole suite:
1. A rival-gang fight fires `RecordFight` → `Justice.RecordCrime(attacker)`.
2. That nudges the colony's **deterrence down**. Order has visibly slipped.
3. Lower deterrence *raises* the nurture multiplier for **every** disposed pawn on the map
(deterrence scales nurture via `×Lerp(1.3, 0.7, deterrence)` — less deterrence, bigger multiplier).
4. Higher nurture pushes more pawns over the `Nature × Nurture ≥ 0.9` join bar (see
[Joining](Joining.md)).
5. More members → more rivals → more fights available to be booked.
Left unanswered, gang violence is self-reinforcing: each booked fight makes the next one likelier. The
brake is the other half of Justice — **punishment raises deterrence back up** (`RecordPunishment`
nudges it up), which lowers nurture, which drops borderline pawns back under the bar. The integration
test checks exactly this seesaw: a punishment raises the deterrence level, and a subsequent crime
lowers it again.
## How to play it
- **Respond to booked fights.** A gang fight is real feedback that deterrence has slipped. Punishing the
attributed attacker is not just retribution — it is the mechanical lever that pulls deterrence back
up and cools the whole map's propensity.
- **Don't manufacture two gangs where there was one.** Rivalry needs two different crews. Housing pawns
of hostile factions or clashing ideoligions together is what creates the second gang and the fights
between them — see the next page.
- **Read the record, not the moment.** Because every fight is attributed to a perpetrator, a thick
record of gang violence points you at *who* to segregate, discipline, or parole — the same tools the
rest of the suite already gives you.
---
*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).*