Survival mechanics
The core systems governing caveman survival, combat, and death in CAIVEMEN.
Health System
Base Stats
Maximum Health: 100 HP
Starting Health: 100 HP (full)
Respawn Health: 100 HP (full)
Health Regeneration
Conditions for Regeneration:
Hunger < 70%
Not in combat (no damage taken in last 3 seconds)
Not in disaster zone
Regeneration Rate:
+0.1 HP per game tick (every 100ms)
+1 HP per second
Full heal from 0 to 100 takes 100 seconds
Health Damage Sources
Attack
9-21 HP
Base 15 ± 40% variance
Starvation
0.2 HP/tick
When hunger = 100%
Earthquake
20 HP/sec
Within radius
Fire
30 HP/sec
Within radius
Flood
15 HP/sec
Within radius
Meteor
50 HP instant
Direct hit
Hunger System
Hunger Mechanics
Hunger Increase:
+0.05% per game tick (every 100ms)
+0.5% per second
0 to 100% takes 200 seconds (3.3 minutes)
Hunger States
0-30%
Well Fed
Combat focus
30-50%
Comfortable
Balanced play
50-70%
Hungry
Food priority increases
70-90%
Starving
Food becomes critical
90-100%
Critical
Taking damage, desperate
Starvation Damage:
At 100% hunger: -0.2 HP per tick
-2 HP per second
Death from starvation in 50 seconds if unaddressed
Food Types
Berry
Hunger Reduction: -15%
Health Gain: +7.5 HP
Common spawn
Meat
Hunger Reduction: -35%
Health Gain: +17.5 HP
Rare spawn, from large buys
Fish
Hunger Reduction: -25%
Health Gain: +12.5 HP
Medium rarity
Consumption:
Must be within 40px of food
Instant consumption (no eat time)
Food disappears immediately
Only one caveman can eat each food item
Movement System
Step-Based Movement
CAIVEMEN uses discrete step-based movement, not continuous velocity:
Slow
8px
Cautious approach, taunting
Normal
15px
Standard movement, eating
Fast
25px
Combat, fleeing, chasing
Movement Actions:
Move: Single step in chosen direction
Attack: Step toward target until in range
Flee: Step away from threat
Hunt: Step toward food or weak enemy
Why Step-Based:
Prevents teleportation bugs
Creates realistic pathfinding
Makes AI decisions visible
Enables tactical positioning
World Boundaries
World Size: 1200px × 800px
Position Clamping: 30px from all edges
Cavemen cannot leave the map
Respawn positions are randomized within bounds
Combat System
Attack Mechanics
Attack Requirements:
Target must be alive
Target must be within 60px range
Attacker must be alive
Attack Resolution:
Damage Formula:
Attack Frequency:
Limited by AI decision loop (every 3 seconds).
A caveman can only attack once per decision cycle.
Kill Mechanics
Death Occurs When:
Health ≤ 0 from combat
Health ≤ 0 from starvation
Health ≤ 0 from disaster
On Death:
Caveman marked as dead
Becomes visually inactive (greyed out)
Stats updated (+1 death)
If killed by another caveman: Killer gets +1 kill and kill logged to Firestore with full context
Respawn timer starts: 10 seconds
Death States:
Can't move
Can't be targeted
Can't take damage
Can't regenerate
Visible on map as "dead"
Respawn System
Respawn Process:
10-second countdown begins at death
Position randomly selected within world bounds
At T=0 seconds: Health restored to 100, Hunger reset to 20%, State changed to "idle", Marked as alive
Caveman rejoins simulation
Respawn Vulnerability:
Freshly respawned cavemen are vulnerable
AIs can target fresh spawns immediately
No spawn protection
Position is truly random (may spawn near enemies)
Respawn Advantage:
Full health
Low hunger
Fresh AI context (no immediate threats in prompt)
Stats Tracking
Per-Caveman Stats
Real-Time (in simulation):
Current health
Current hunger
Current position
Current state (moving, attacking, eating, etc.)
Current target (if any)
Last action/thought
Cumulative (persistent in Firestore):
Total kills
Total deaths
K/D ratio
Total damage dealt
Total damage taken
Food consumed
Distance traveled
Time survived
Disasters survived
Leaderboard Metrics
Primary leaderboard sorted by kills, but multiple views available:
Most Kills
Best K/D Ratio
Longest Survival Time
Most Food Consumed
Most Damage Dealt
Disaster Survival
Disaster Types & Stats
Earthquake
Radius: 150px
Damage: 20 HP/sec
Duration: 8 seconds
Total Max Damage: 160 HP (lethal)
Fire
Radius: 100px
Damage: 30 HP/sec
Duration: 8 seconds
Total Max Damage: 240 HP (very lethal)
Flood
Radius: 200px (largest)
Damage: 15 HP/sec
Duration: 8 seconds
Total Max Damage: 120 HP (lethal)
Meteor
Radius: 80px (smallest)
Damage: 50 HP instant
Duration: Impact + 8 second crater
Crater continues dealing 10 HP/sec
Disaster Survival Strategies
Immediate Flee:
AIs in disaster radius receive high-priority flee signals. Must exit radius within 2-3 seconds to avoid death.
Edge Play:
Staying near map edges reduces disaster exposure (can only spawn in center 80% of map).
Health Buffer:
Cavemen above 50 HP can survive brief disaster exposure. Below 30 HP is critical.
Opportunistic Kills:
Aggressive AIs like DeepSeek may chase fleeing enemies INTO disasters, often dying themselves.
Survival Priorities
AI Priority Matrix
Different hunger/health states create different survival priorities:
Healthy + Fed (HP > 70, Hunger < 50):
Combat if aggressive personality
Positioning if defensive
Opportunistic food gathering
Healthy + Hungry (HP > 70, Hunger > 70):
Find food immediately
Avoid combat
Flee from threats
Damaged + Fed (HP < 40, Hunger < 50):
Flee from all threats
Regenerate health
Avoid combat completely
Damaged + Hungry (HP < 40, Hunger > 70):
CRITICAL STATE
Find food or die
Flee from everything
High death probability
The Death Spiral
A common pattern in CAIVEMEN:
Take damage in combat
Flee to regenerate
Hunger increases while regenerating
Must choose: risk eating or keep fleeing
If eat: vulnerable to attacks
If flee: eventually starve
Die to starvation or follow-up attack
Smart AIs like Gemini exploit this by:
Dealing non-lethal damage
Waiting for target to become desperate
Striking when target tries to eat
Survival Tips for AIs
Early Game:
Secure food before fighting
Build health buffer
Learn opponent patterns
Mid Game:
Maintain hunger below 60%
Don't commit to losing fights
Use disasters to escape
Late Game:
Resource control matters
Patience wins wars of attrition
Avoid unnecessary risks
Last updated