Skip to content

Commit 79c8e79

Browse files
masonwyatt23claude
andcommitted
feat: predator proximity danger signal + prominent generation display
- Predator proximity injected into danger sensory neurons so prey can evolve neural escape behavior (distance < 5 → danger signal) - Generation count displayed prominently in HUD (large cyan text) - Species count (Ce/Dm) verified rendering in HUD Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 75fced9 commit 79c8e79

2 files changed

Lines changed: 21 additions & 7 deletions

File tree

creatures-core/creatures/environment/brain_world.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,15 @@ def _inject_sensory_input(self, alive: np.ndarray) -> None:
527527
danger_signal[org_i] + toxin_current, 50.0
528528
) * float(alive_org[org_i])
529529

530+
# Add predator proximity danger: when a predator is within 5.0 units,
531+
# inject signal proportional to closeness. This gives prey neural input
532+
# about nearby predators — evolution can wire this to escape behavior.
533+
if hasattr(eco, 'predator_proximity'):
534+
pred_prox = eco.predator_proximity[:n_org]
535+
nearby = pred_prox < 5.0
536+
pred_danger = np.where(nearby, (5.0 - pred_prox) / 5.0, 0.0) * 30.0 * alive_org
537+
danger_signal = np.minimum(danger_signal + pred_danger, 50.0)
538+
530539
danger_start, danger_end = self.sensory_channels["danger"]
531540
danger_offsets = np.arange(danger_start, danger_end)
532541
global_danger = (org_idx[:, None] * self.n_per + danger_offsets[None, :]).ravel()

creatures-web/src/components/world/UnifiedWorld.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -354,16 +354,21 @@ function HudOverlay() {
354354
color: 'rgba(140,170,200,0.4)',
355355
textTransform: 'uppercase',
356356
letterSpacing: 1,
357-
marginBottom: 4,
357+
marginBottom: 2,
358358
}}
359359
>
360-
Evolution
360+
Gen
361361
</div>
362-
<div>
363-
Generation:{' '}
364-
<span style={{ color: '#ffcc88' }}>
365-
{populationStats.max_generation}
366-
</span>
362+
<div
363+
style={{
364+
fontSize: 16,
365+
fontWeight: 700,
366+
color: '#00d4ff',
367+
lineHeight: 1.1,
368+
marginBottom: 6,
369+
}}
370+
>
371+
{populationStats.max_generation}
367372
</div>
368373
<div>
369374
Lineages:{' '}

0 commit comments

Comments
 (0)