Skip to content

Quest Webs & Emergent Opportunities

Chapter 42 — Quest Webs & Emergent Opportunities

Section titled “Chapter 42 — Quest Webs & Emergent Opportunities”

The simulation creates rich conditions — pressure, scarcity, faction goals, NPC obligations, district drift, companion dynamics. Quest Webs turn those conditions into structured things the player can intentionally pursue: contracts, bounties, favors, supply runs, investigations, escorts, recovery missions, and faction jobs.

These are not authored quest trees. The world offers work because it needs things. An NPC with a bargain goal and favorable trust offers a contract. A district in supply crisis spawns a supply run. A faction under pressure posts a bounty. Every opportunity traces back to a specific world condition.


KindTriggerExample
contractNPC bargain goal + favorable trust”Deliver this shipment to the docks”
favor-requestNPC obligation (player owes NPC)“You owe me — handle this quietly”
bountyBounty-issued pressure”Bring in the deserter”
supply-runDistrict supply < 20”The clinic needs medicine”
recoveryDistrict instability > 60”Restore order to the market quarter”
escortCompanion personal goal”Help me reach the shrine”
investigationDistrict instability > 60”Find who’s been poisoning the well”
faction-jobAllied faction + low alert”The guild needs a representative at the summit”

All 8 kinds work in every genre. Genre flavor comes from tags, not separate kinds.


[available] → accept → [accepted] → complete/fail/abandon/betray → [resolved]
↓ ↓
decline timer expires
↓ ↓
[declined] [expired]
StatusDescription
availableOffered to the player, can be accepted or declined
acceptedPlayer committed, timer counting down
completedSuccessfully resolved
failedAttempted but failed
expiredTimer ran out
declinedPlayer chose not to take it
abandonedPlayer walked away after accepting
betrayedPlayer turned against the quest-giver

Opportunities have a visibility progression:

LevelMeaning
hiddenExists in the simulation but not yet surfaced
rumoredPlayer may have heard whispers
knownPlayer knows about it but hasn’t been offered
offeredDirectly offered, can be accepted

Visibility escalates over turns. Hidden opportunities become rumored, then known, then offered. NPC-spawned opportunities start at offered.


Every 3 ticks, the engine evaluates whether a new opportunity should spawn. Seven independent rules generate candidates:

RuleSourceOutput
ScarcityDistrict supply < 20supply-run
NPC goalsNPC bargain/recruit + favorable trustcontract, favor-request
ObligationsPlayer-owes-NPC, magnitude >= 4favor-request
Pressure-linkedActive bounty/supply-crisis/summonsbounty, supply-run, faction-job
FactionAllied faction + alertLevel < 50faction-job
CompanionCompanion with personalGoal setfavor-request (personal-ask tag)
DistrictInstability > 60recovery, investigation

Each candidate is scored:

score = (urgency × 0.3 + feasibility × 0.25 + reward × 0.25 + relevance × 0.2) × 100

The highest-scoring candidate spawns. Ties broken by urgency.

  • Capacity: Max 5 active opportunities at once
  • Interval: Min 3 turns between spawns
  • Evaluation window: Only runs when tick % 3 === 0

TypeFieldsExample
reputationfactionId, delta+10 with Merchant Guild
leveragecurrency, delta+3 influence
materialscategory, amount+5 medicine
economy-shiftdistrictId, category, deltaComponents +15 in docks
obligationnpcId, direction, kind, magnitudeNPC owes player a favor
itemitemId, descriptionUnique reward item
rumorclaim, valencePositive rumor about the player
TypeFieldsExample
heatdelta+10 heat
reputationfactionId, delta-5 with rival faction
alertfactionId, delta+15 alert on local faction
combatdifficulty, descriptionAmbush during delivery
obligationnpcId, direction, kind, magnitudePlayer owes NPC on failure

Resolution produces typed OpportunityFalloutEffect effects — 14 variants mirroring the engine’s effect vocabulary:

EffectTrigger
reputationMost resolutions
leverageCompleted bounties, faction jobs
materialsCompleted supply runs
economy-shiftSupply-run completion (supplies up)
rumorCompletion, abandonment, betrayal
obligationContract completion creates NPC-owes-player; failure escalates player-owes-NPC
spawn-pressureAbandoned contract → investigation-opened; failed faction-job → faction-summons
spawn-opportunityCompleted contracts can chain into new opportunities
heatAbandonment, betrayal
alertDeclined faction-jobs, betrayal
npc-relationshipTrust changes on completion/betrayal
companion-moraleFailed escort → morale hit
milestone-tagCompleted bounties and investigation
title-triggerCompleting enough contracts
KindCompletedAbandonedBetrayed
contract+rep, +favor, positive rumor-rep, negative rumor, +heat, investigation pressurelarge -rep, fearsome rumor, heat spike, NPC revenge obligation
bounty+rep, +blackmail, fearsome rumor, milestone-rep
supply-run+economy-shift, +rep, +legitimacymild -rep
faction-joblarge +rep, +influence, faction rumor-rep, +alertlarge -rep, heat, spawn pressure
favor-requestobligation cleared, +trustmagnitude increases, -trust
escort+trust, +companion-morale-trust, -companion-morale

NPCs become quest-givers through existing systems — no new NPC fields needed:

  • NPC with bargain goal + favorable trust → offers contracts
  • NPC with player-owes-npc obligation (magnitude >= 4) → requests favors
  • NPC bargain action from npc-agency tick → can spawn spawn-opportunity effects

Quest-giver NPCs reference active opportunities in dialogue:

  • Ask about progress
  • Grow impatient near deadlines
  • Express gratitude on completion
  • React with anger or fear on abandonment/betrayal

Bidirectional linkage between pressures and opportunities:

Pressures → Opportunities:

  • bounty-issued → bounty opportunity
  • supply-crisis → supply-run opportunity
  • faction-summons → faction-job opportunity

Opportunities → Pressures (on failure):

  • Abandoned contract → investigation-opened pressure
  • Failed faction-job → faction-summons pressure

The move advisor detects available high-value opportunities as a situation: 'opportunity' state, boosting urgency for leverage actions that align with accepted opportunities.


The strategic map includes an activeOpportunitySummary section listing active and available opportunities by kind, source, and deadline.


When opportunities are active, the narrator receives opportunityContext — a compact string describing the player’s current commitments. System prompt rules:

  • Active contracts create ambient awareness in narration
  • NPC quest-givers subtly reference deadlines
  • Completed contracts echo in the world

InputAction
accept job/contract/bounty/missionAccept an available opportunity
decline job/contract/offerDecline an available opportunity
abandon job/contract/missionWalk away from an accepted opportunity
betray job/contract/clientTurn against the quest-giver
complete/deliver/turn in job/bountyComplete an accepted opportunity
CommandDescription
/jobsList available opportunities with kind, source, rewards, deadline
/contractsAlias for /jobs
/contract <id>Detailed view: description, objective, rewards, risks, linked pressures/NPCs
/acceptedList accepted opportunities with progress hints

The OPPORTUNITIES & CONTRACTS section appears in the session summary when opportunity activity occurred:

──────────────────────────────────────────────────────────────
OPPORTUNITIES & CONTRACTS
──────────────────────────────────────────────────────────────
accepted: Deliver Medicine — Supply run from Dr. Mora
completed: Clear the Dock Rats — Bounty from Merchant Guild (+10 rep)
expired: Guard the Shipment — Contract from harbor master

Opportunity events are recorded in the campaign journal:

EventSignificance
opportunity-accepted0.4
opportunity-completed0.7
opportunity-failed0.6
opportunity-abandoned0.5
opportunity-betrayed0.7
opportunity-expired0.3

  1. Opportunity state lives on GameSession as activeOpportunities: OpportunityState[], serialized to SavedSession. Not in profile.custom (too flat) or world.quests (that’s authored-quest infrastructure). Follows the partyState, districtEconomies, npcObligations pattern.
  2. 8 opportunity kinds, universal. Genre flavor via tags, not separate kinds.
  3. Rewards use discriminated union mirroring FalloutEffect / LeverageEffect.
  4. NPCs become quest-givers through existing goal system. No new NPC fields.
  5. Scoring formula follows move-advisor pattern.
  6. Max 5 active, evaluated every 3 turns. Keeps cognitive load manageable.
  7. Bidirectional pressure linkage. Pressures spawn opportunities; failed opportunities spawn pressures.
  8. Pure functions throughout — all opportunity logic is deterministic, no LLM calls.
  9. ~15 token narration budget — opportunity context costs negligible tokens.