grimjim commited on
Commit
7b39fc8
·
1 Parent(s): 1460761

Revelation added

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py CHANGED
@@ -78,6 +78,17 @@ AMBIENT_NOISES = [
78
  "a rolling object crosses the floor where there is no object",
79
  ]
80
 
 
 
 
 
 
 
 
 
 
 
 
81
  DIRECTIONS = {
82
  "north": (0, 1),
83
  "n": (0, 1),
@@ -235,8 +246,11 @@ def apply_turn(state: dict[str, Any], user_input: str) -> dict[str, Any]:
235
  encounter_chance = min(0.45, max(0.03, (100 - state["sanity"]) / 260))
236
  entity_present = rng.random() < encounter_chance
237
  pressure = rng.choice(ENTITY_PRESSURES) if entity_present else None
 
238
  if entity_present:
239
  base_loss += rng.choice([2, 3, 4])
 
 
240
 
241
  state["sanity"] = max(0, min(100, state["sanity"] - base_loss))
242
  state["last_event"] = (
@@ -252,6 +266,7 @@ def apply_turn(state: dict[str, Any], user_input: str) -> dict[str, Any]:
252
  "encounter_hint": pressure["hint"] if pressure else "none",
253
  "encounter_mode": pressure["name"] if pressure else "none",
254
  "encounter_instruction": pressure["instruction"] if pressure else "none",
 
255
  "ambient_noise": ambient_noise,
256
  "sanity_loss": base_loss,
257
  "zone": zone_profile(state["x"], state["y"]),
@@ -281,6 +296,7 @@ Hidden state:
281
  - Entity encounter: {turn["encounter_hint"]}
282
  - Encounter mode: {turn["encounter_mode"]}
283
  - Encounter narration note: {turn["encounter_instruction"]}
 
284
  - Ambient unexplained noise: {turn["ambient_noise"]}
285
  - Sanity erosion this turn: {turn["sanity_loss"]}
286
  - Prior event: {state["last_event"]}
@@ -290,6 +306,9 @@ Write 2-5 sentences in second person.
290
  Describe the immediate result of the action and the environment.
291
  If an entity encounter is not "none", imply danger using the encounter narration
292
  note. Do not repeat stock phrases like "it is watching" or "you are getting closer."
 
 
 
293
  If ambient unexplained noise is not "none", weave it into the scene as a small
294
  unsettling detail without making it the whole turn.
295
  If sanity is low, make perception less reliable without naming sanity.
 
78
  "a rolling object crosses the floor where there is no object",
79
  ]
80
 
81
+ REVELATIONS = [
82
+ "the player recognizes the hallway as a place they avoided thinking about for years",
83
+ "the player realizes the exit signs have been using their own handwriting",
84
+ "the player notices every room contains one object from a home they never returned to",
85
+ "the player understands the entity is not chasing them, but correcting their path",
86
+ "the player remembers choosing a door before the memory cuts out",
87
+ "the player sees that the map in their head has always had this place at its center",
88
+ "the player recognizes the buzzing as the sound that used to fill their childhood bedroom",
89
+ "the player realizes the corridor is arranging itself around a thing they refuse to name",
90
+ ]
91
+
92
  DIRECTIONS = {
93
  "north": (0, 1),
94
  "n": (0, 1),
 
246
  encounter_chance = min(0.45, max(0.03, (100 - state["sanity"]) / 260))
247
  entity_present = rng.random() < encounter_chance
248
  pressure = rng.choice(ENTITY_PRESSURES) if entity_present else None
249
+ revelation = rng.choice(REVELATIONS) if entity_present and rng.randint(1, 4) == 1 else "none"
250
  if entity_present:
251
  base_loss += rng.choice([2, 3, 4])
252
+ if revelation != "none":
253
+ base_loss += 1
254
 
255
  state["sanity"] = max(0, min(100, state["sanity"] - base_loss))
256
  state["last_event"] = (
 
266
  "encounter_hint": pressure["hint"] if pressure else "none",
267
  "encounter_mode": pressure["name"] if pressure else "none",
268
  "encounter_instruction": pressure["instruction"] if pressure else "none",
269
+ "revelation": revelation,
270
  "ambient_noise": ambient_noise,
271
  "sanity_loss": base_loss,
272
  "zone": zone_profile(state["x"], state["y"]),
 
296
  - Entity encounter: {turn["encounter_hint"]}
297
  - Encounter mode: {turn["encounter_mode"]}
298
  - Encounter narration note: {turn["encounter_instruction"]}
299
+ - Psychological revelation: {turn["revelation"]}
300
  - Ambient unexplained noise: {turn["ambient_noise"]}
301
  - Sanity erosion this turn: {turn["sanity_loss"]}
302
  - Prior event: {state["last_event"]}
 
306
  Describe the immediate result of the action and the environment.
307
  If an entity encounter is not "none", imply danger using the encounter narration
308
  note. Do not repeat stock phrases like "it is watching" or "you are getting closer."
309
+ If psychological revelation is not "none", make it the emotional turn of the
310
+ scene: reveal it obliquely as a realization, memory, or pattern. Do not fully
311
+ explain it.
312
  If ambient unexplained noise is not "none", weave it into the scene as a small
313
  unsettling detail without making it the whole turn.
314
  If sanity is low, make perception less reliable without naming sanity.