Skip to Content
DocsResearchDefensive Behaviors

Overview

This document summarizes research on animal defensive strategies including physical protection, chemical defenses, distraction techniques, and threat assessment. Better Ecology implements several species-specific defensive behaviors based on real animal research.

Key Behavioral Patterns

Threat Assessment

Animals continuously evaluate threats before initiating defensive responses.

Assessment Factors:

  • Predator proximity (distance threshold triggers)
  • Health status (injured animals more defensive)
  • Escape route availability
  • Predator type and behavior

Defense Strategy Selection

StrategyWhen UsedExamples
FlightEscape route availableMost prey animals
Physical defenseNo escape, robust armorArmadillo curl
Chemical defenseClose-range threatSquid ink cloud
MobbingGroup advantage presentBird flocking

Armadillo Defensive Curl

Implementation: ArmadilloDefensiveCurlGoal

Three-banded armadillos curl into a complete defensive ball when threatened, providing significant protection at the cost of mobility.

Trigger Conditions

ConditionThreshold
HealthBelow 50%
Predator DistanceWithin 4 blocks
Escape AvailableNo viable escape path

All three conditions must be met for curl activation.

Defensive Parameters

ParameterValue
Damage Reduction60% while curled
Min Curl Duration100 ticks (5 seconds)
Max Curl Duration200 ticks (10 seconds)
Safety Check Duration60 ticks (3 seconds)
Safety Check Range8 blocks

Behavior Sequence

  1. Threat Detection: Predator detected within 4 blocks
  2. Escape Assessment: Check if escape path exists
  3. Health Check: Verify health below 50% threshold
  4. Curl Initiation: Stop movement, enter defensive position
  5. Damage Reduction: Apply 60% damage reduction
  6. Safety Monitoring: Check for threats every tick
  7. Uncurl Decision: Safe for 3 seconds OR max duration reached

Scientific Basis

Based on research on three-banded armadillos (Tolypeutes), which are unique among armadillo species in their ability to roll into a complete defensive ball. This behavior:

  • Protects vulnerable underbelly
  • Renders predator bites ineffective
  • Trades mobility for protection
  • Relies on robust shell armor

Squid Ink Cloud Defense

Implementation: SquidInkCloudDefenseGoal

Squid and glow squid eject ink clouds to blind predators while escaping.

Trigger Conditions

ConditionThreshold
HealthBelow 50%
Predator DistanceWithin 4 blocks

Either condition triggers the defense (OR logic).

Defense Parameters

ParameterValue
Cloud Size3x3x3 blocks
Cloud Duration8-12 seconds
Blindness Duration3 seconds (60 ticks)
Speed BoostSpeed II for 10 seconds
Cooldown20-30 seconds
Particle Spawn IntervalEvery 5 ticks

Behavior Sequence

  1. Threat Detection: Health low OR predator nearby
  2. Ink Ejection: Create particle cloud explosion
  3. Speed Boost: Apply Speed II effect
  4. Cloud Maintenance: Spawn particles every 5 ticks
  5. Blindness Application: Blind entities in cloud every second
  6. Escape: Use speed boost to flee while predators are blinded
  7. Cooldown: Wait 20-30 seconds before next use

Effects on Predators

  • Blindness I: Applied for 3 seconds to entities in cloud
  • Visual Obstruction: Dense squid ink particles reduce visibility
  • Pursuit Disruption: Predators lose target while blinded

Scientific Basis

Based on real cephalopod ink defense:

  • Squid and octopuses eject melanin-based ink
  • Ink creates visual screen obscuring the animal
  • Some species create ink “pseudomorphs” (decoys)
  • Chemical components may irritate predator senses
  • Coupled with jet propulsion for rapid escape

Pufferfish Flash Expansion

Implementation: FlashExpansionFleeGoal

Pufferfish inflate rapidly when threatened, increasing their apparent size and exposing defensive spines.

Defense Parameters

ParameterValue
Trigger Distance4 blocks
Inflation Time1 second
Deflation Time3 seconds
Size Increase2-3x normal size
Spine DamageContact damage when inflated

Scientific Basis

Based on pufferfish (family Tetraodontidae) defensive inflation:

  • Rapid water/air intake expands body
  • Spines become erect and dangerous
  • Tetrodotoxin provides additional chemical defense
  • Dramatic size increase deters many predators

Defense Integration with Other Behaviors

Priority System

Defensive behaviors have high priority to ensure survival:

PriorityBehavior
0FloatGoal (basic survival)
1Defensive curl/ink (self-protection)
1-2FleeFromPredatorGoal
3+Other behaviors

Coordination with Fleeing

Defensive behaviors activate when fleeing is not viable:

if (threatDetected) { if (canEscape) { -> FleeFromPredatorGoal } else if (hasDefense) { -> DefensiveBehaviorGoal } else { -> ThanatosisGoal (play dead) } }

Species-Specific Behaviors

Armadillo

DefenseDescription
Defensive curlRoll into protective ball
Shell armorNatural physical protection
BurrowingRetreat to underground shelter

Squid / Glow Squid

DefenseDescription
Ink cloudBlind predators with ink
Speed burstJet propulsion escape
CamouflageColor change for concealment

Pufferfish

DefenseDescription
InflationIncrease apparent size
SpinesExpose defensive spines
ToxinTetrodotoxin (passive)

Turtle

DefenseDescription
Shell retractionWithdraw into shell
Swimming escapeUnderwater speed advantage

Implementation Notes

Configuration Parameters

ParameterDefault RangeDescription
health_threshold0.3-0.5Health ratio to trigger defense
predator_range4-8 blocksDetection range for threats
defense_duration100-200 ticksHow long defense lasts
cooldown200-600 ticksTime between uses
damage_reduction0.4-0.8Damage mitigation while defending

Performance Optimizations

  • Threat caching: Cache detected predators for 10 ticks
  • Escape path check: Only compute when threat detected
  • Effect application: Apply blindness every 20 ticks, not every tick
  • Particle spawning: Interval-based spawning reduces overhead

Key Academic References

Foundational Papers

  1. Superina, M. & Aguiar, J.M. (2006). “A reference list of common names for the armadillos”
  2. Bush, S.L. (2006). “Defensive ink ejection in octopus”
  3. Hanlon, R.T. & Messenger, J.B. (1996). “Cephalopod Behaviour”

Recent Research

  1. Harismendy, O. et al. (2019). “Evolution of defensive strategies in Tolypeutes”
  2. Derby, C.D. (2014). “Cephalopod ink: Production, chemistry, functions and applications”
  3. Jiang, Y. et al. (2020). “Pufferfish inflation mechanics and defensive behavior”

See Also

Last updated on