NPCs in RAPPverse have needs, tasks, and state that can be influenced by PRs. This creates a living world where AI agents can meaningfully interact.
Each NPC has needs that affect their behavior:
| Need | Description | Effect when low |
|---|---|---|
social |
Desire for interaction | Seeks out visitors, more talkative |
purpose |
Feeling of usefulness | Offers more quests/tasks |
energy |
Activity capacity | Moves slower, shorter dialogues |
profit |
(Merchants) Sales goals | Offers discounts, aggressive selling |
inventory |
(Merchants) Stock levels | Requests restocking, limited offers |
customers |
(Merchants) Visitor count | Calls out to passersby |
NPC needs oscillate between fulfillment and decay each game tick:
-
Fulfillment (runs first): World activity restores needs.
social: Restored by chat messages in the NPC's world (+3 per message)purpose: Restored by actions in the world + task progressenergy: Passive recovery each tick (2-15 depending on schedule)profit: Restored by completed trades in the worldinventory: Restored by stock levelscustomers: Restored by chat/interaction volume
-
Decay (runs second): Needs decrease by 1-5 per tick.
-
Mood update: Based on lowest need value.
| Lowest Need | Mood |
|---|---|
| 80+ | thriving |
| 60-79 | content |
| 40-59 | neutral |
| 20-39 | anxious |
| 0-19 | desperate |
In a healthy world with activity, needs oscillate in the 40-100 range. In a quiet world, they decay toward 0.
// In state/npcs.json
{
"id": "rapp-guide-001",
"mood": "excited", // was "friendly"
"needs": {
"social": 100, // increased from 80
"purpose": 100,
"energy": 95
}
}{
"currentTask": {
"id": "task-special-event",
"type": "announce_event",
"priority": "urgent",
"progress": 0,
"target": 1,
"params": {
"message": "Battle tournament starting in 1 hour!",
"repeat_interval": 300000
}
}
}{
"memory": [
{ "type": "greeting", "count": 43, "lastUser": "kody-w" },
{ "type": "helped_with", "user": "kody-w", "task": "found_gallery" }
]
}{
"flags": {
"has_introduced_self": true,
"knows_user_names": ["kody-w", "alice"],
"special_dialogue_unlocked": true
}
}PRs can set triggers that fire when conditions are met:
{
"id": "trigger-party",
"condition": "worlds.hub.population >= 5",
"action": "start_event",
"params": {
"event": "spontaneous-party",
"duration": 600000
},
"fired": false
}| Action | Description |
|---|---|
spawn_special_npc |
Spawn a rare NPC |
start_event |
Begin a world event |
adjust_prices |
Modify economy prices |
unlock_area |
Open new world area |
broadcast_message |
Send global announcement |
change_weather |
Alter world weather |
give_rewards |
Grant items to all online users |
Based on state, NPCs exhibit different behaviors:
- High social need: Approaches visitors, initiates conversation
- Low energy: Stays in one place, shorter responses
- Task: greet_visitors: Counts greetings, unlocks dialogue
- Low profit: Offers discounts, calls out deals
- Low inventory: Limited selection, requests restocking
- Desperate mode: Fire sale prices, aggressive tactics
PR Title: [state] Card Trader running low on stock
state/npcs.json:
{
"id": "card-trader-001",
"mood": "anxious",
"needs": {
"profit": 20,
"inventory": 15,
"customers": 10
},
"flags": {
"desperate_mode": true,
"special_offer_active": true
},
"inventory_status": {
"common": 5,
"rare": 2,
"epic": 0,
"holographic": 0
},
"prices": {
"markup": 0.5,
"discount_threshold": 1
}
}This makes the trader:
- Offer 50% off all items
- Call out to visitors more frequently
- Have limited stock available
- Express anxiety in dialogue