8000
Skip to content

Latest commit

Β 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FerroNest

You don't give orders. You design signals.

A strategic ant colony management game where you control a collective mind through pheromone signals. Build tunnels, manage castes, defend against predators, and evolve your colony β€” all through emergent AI driven by chemical communication.

Play Now TypeScript Next.js License: MIT


Features

  • Pheromone Signal System β€” Paint chemical trails to guide your colony. No direct orders β€” design the signals, and the ants respond.
  • 7 Ant Castes β€” Queen, Worker, Scout, Soldier, Nurse, Builder, and Cultivator β€” each with unique AI, stats, and behaviors.
  • Colony Mind Abilities β€” Charge consciousness and unleash powerful abilities like Work Surge, Total Alarm, and Chemical Fury.
  • 10 Chamber Types β€” Build Queen Chambers, Barracks, Fungus Gardens, Pheromone Labs, and more, each with unique effects.
  • 8 Enemy Types β€” Defend against Spiders, Wasps, Centipedes, Antlions, Rival Ants, and more with distinct AI behaviors.
  • Dynamic Events β€” Rain, droughts, earthquakes, pesticide sprays, and flash floods challenge your colony.
  • Day/Night Cycle & Fog of War β€” Stars, moon, sun, and dynamic lighting affect surface visibility and ant behavior.
  • Evolution System β€” Choose from 5 branches: Military, Agricultural, Explorer, Subterranean, and Chemical.
  • Procedural Maps β€” Every game generates a unique underground world with clay, sand, stone veins, roots, and water.
  • Sound Effects β€” Web Audio API synthesized sounds for digging, combat, hatching, events, and ambient atmosphere.
  • Performance Optimized β€” Mutation-based simulation, viewport culling, noise caching, and throttled updates.
  • A* Pathfinding β€” Intelligent pathfinding with tunnel quality modifiers and 8-directional movement.

How to Play

Controls

Input Action
Left Click / Drag Use selected tool (excavate, build, mark pheromone)
Right Click / Drag Pan camera
Scroll Wheel Zoom in/out (toward cursor)
WASD / Arrow Keys Pan camera smoothly
Space Pause / Resume
1 / 2 / 3 Set game speed
P Toggle pheromone overlay
M Toggle minimap
F Toggle follow mode (queen / selected ant)
Esc Open settings panel

Game Flow

  1. Start with a Queen, 6 Workers, and 1 Scout in an underground chamber
  2. Excavate tunnels to expand your nest and reach the surface
  3. Mark pheromones to direct ants toward food, excavation, or defense
  4. Build chambers for specialized functions (brood, storage, barracks, etc.)
  5. Defend against predators and survive environmental events
  6. Evolve through 4 game phases: Survival > Expansion > Dominance > Empire

Game Mechanics

Pheromone System

Pheromones are the core mechanic. Instead of selecting and commanding individual ants, you paint pheromone signals on the map. Ants detect and follow these signals based on their caste AI:

Pheromone Color Effect
Collect Green Workers gather nearby resources
Excavate Orange Workers dig in marked area
Defend Red Soldiers rush to position
Evacuate Yellow All ants flee from area
Explore Blue Scouts investigate area
Attack Purple Soldiers go on offensive
Priority Red-Orange Marks high-priority zone
Home Brown Points toward queen chamber
Food Gold Marks food trail
Danger Bright Red Signals danger area

Pheromones decay over time, diffuse to adjacent cells, and consume pheromone resources. Pheromone Labs boost signal strength by 30%.

Ant Castes

Caste HP Speed Attack Role
Queen 250 0.25 8 Lays eggs, emits home pheromone
Worker 35 0.70 3 Gathers, excavates, delivers resources
Scout 22 1.40 2 Explores, finds food, fast movement
Soldier 100 0.45 18 Fights enemies, patrols
Nurse 28 0.55 1 Cares for brood, feeds larvae
Builder 45 0.55 5 Builds chambers, carries heavy loads
Cultivator 28 0.45 2 Tends fungus gardens

Each ant has a personality (Diligent, Brave, Curious, Cautious, Aggressive, Social) that modifies their behavior, and individual memory tracking food sources, danger locations, and visited chambers.

Colony Mind

The Colony Mind charges over time based on ant loyalty. Spend consciousness to activate powerful abilities:

Ability Cost Effect
Work Surge 20 Workers move 50% faster
Total Alarm 30 All soldiers rush to defend
Perfect Route 25 Optimal pathfinding for all ants
Last Stand 40 Workers block tunnels to protect queen
Evacuation 50 Emergency migration of queen and eggs
Chemical Fury 60 All ants attack with doubled ferocity

Passive bonuses at consciousness thresholds:

  • 25%: +5% work speed
  • 50%: +10% work speed, better pathfinding
  • 75%: +15% work speed, +10% soldier attack
  • 100%: All bonuses + 20% egg laying rate

Chambers

Chamber Cost Effect
Queen Chamber 5 Earth Queen lays eggs here
Brood Chamber 3 Earth, 1 Biomass Eggs develop 20% faster
Food Storage 2 Earth Food spoilage -50%
Fungus Garden 3 Earth, 3 Biomass Produces fungus over time
Barracks 4 Earth, 2 Biomass Soldiers +20% attack nearby
Pheromone Lab 3 Earth, 3 Biomass Pheromone strength +30%
Waste Chamber 2 Earth Contamination -60% nearby
Humidity Chamber 3 Earth, 1 Biomass Stabilizes humidity +40%
Nursery 2 Earth, 2 Biomass Brood survival +25%
Granary 2 Earth, 1 Biomass Sugar/nectar storage +50%

Environmental Systems

  • Day/Night Cycle β€” 8-phase sky transitions (dawn, noon, dusk, night) with underground light seepage and dawn fog
  • Fog of War β€” Only areas near ants are visible; unexplored regions are hidden
  • Temperature β€” Varies by depth; extreme temps damage brood
  • Humidity β€” Affects fungus growth and chamber conditions
  • Contamination β€” Builds up without waste chambers; damages brood
  • Water Levels β€” Rain and floods can flood tunnels; animated water with reflections
  • Tunnel Quality β€” Affects ant movement speed and fatigue

Enemies

Enemy HP Attack Behavior
Wolf Spider 70 14 Hunts ants, creates web zones
Ground Beetle 120 8 Territorial, patrols set routes
Centipede 90 12 Hunts in tunnels
Paper Wasp 45 22 Fast hit-and-run hunter
Rival Ant 35 7 Raids food stores in groups
Termite 50 6 Territorial, patrols in formation
Antlion 80 20 Ambush with pull-trap pits
Parasitic Mite 10 2 Wanders, weak but numerous

Random Events

Rain, Drought, Tunnel Collapse, Cold Snap, Heat Wave, Toxic Fungus, Pesticide Spray, Enemy Raid, Earthquake, and Flash Flood β€” each with varying severity, warning announcements, and event combos.


Audio System

The game features a synthesized audio system using the Web Audio API (no audio files needed):

Sound Effects: Dig, Build, Combat Hit, Combat Kill, Ant Hatch, Pheromone Mark, Event Warning, Event Start, Queen Damage, Button Click, Speed Change

Ambient Sounds: Underground Hum (deep drone), Rain (during rain/flood events), Surface Breeze (near surface)

All sounds are synthesized using oscillators, noise generators, and filters for a rich, responsive audio experience. Volume controls are available in the settings panel (Esc key).


Tech Stack


Getting Started

Prerequisites

Installation

# Clone the repository
git clone https://github.com/smouj/FerroNest.git
cd FerroNest

# Install dependencies
bun install

# Start development server
bun dev

Open http://localhost:3000 to start playing.

Build for Production

bun run build
bun start

Project Structure

FerroNest/
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── deploy.yml          # GitHub Pages deployment
β”œβ”€β”€ public/
β”‚   └── logo.svg                # Game logo
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ layout.tsx          # Root layout
β”‚   β”‚   β”œβ”€β”€ page.tsx            # Main game page with intro screen
β”‚   β”‚   β”œβ”€β”€ globals.css         # Global styles
β”‚   β”‚   └── api/
β”‚   β”‚       └── route.ts        # API routes
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ game/
β”‚   β”‚   β”‚   β”œβ”€β”€ GameCanvas.tsx  # Canvas renderer, camera, & input
β”‚   β”‚   β”‚   β”œβ”€β”€ HUD.tsx         # Heads-up display with selected ant panel
β”‚   β”‚   β”‚   β”œβ”€β”€ ToolBar.tsx     # Bottom toolbar with categorized tools
β”‚   β”‚   β”‚   β”œβ”€β”€ SettingsPanel.tsx # Settings overlay (Esc)
β”‚   β”‚   β”‚   └── FPSCounter.tsx  # Performance display
β”‚   β”‚   └── ui/                 # shadcn/ui components
β”‚   β”œβ”€β”€ game/
β”‚   β”‚   β”œβ”€β”€ engine.ts           # Core simulation engine (mutation-based)
β”‚   β”‚   β”œβ”€β”€ renderer.ts         # Canvas 2D renderer with noise cache
β”‚   β”‚   β”œβ”€β”€ audio.ts            # Web Audio API sound system
β”‚   β”‚   β”œβ”€β”€ store.ts            # Zustand game state store
β”‚   β”‚   β”œβ”€β”€ ui-store.ts         # Zustand UI settings store
β”‚   β”‚   β”œβ”€β”€ types.ts            # TypeScript type definitions
β”‚   β”‚   └── constants.ts        # Game balance & configuration
β”‚   β”œβ”€β”€ hooks/                  # Custom React hooks
β”‚   └── lib/                    # Utility functions
β”œβ”€β”€ next.config.ts              # Next.js configuration
β”œβ”€β”€ tailwind.config.ts          # Tailwind CSS configuration
β”œβ”€β”€ tsconfig.json               # TypeScript configuration
└── package.json                # Dependencies & scripts

Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Ideas for Contributions

  • New enemy types with unique AI
  • New chamber types and effects
  • New pheromone types
  • Biome system (desert, rainforest, tundra)
  • Statistics dashboard
  • Save/Load game state
  • Achievement system

License

This project is licensed under the MIT License β€” see the LICENSE file for details.


FerroNest β€” Where signals become strategy.

About

🐜 Strategic ant colony management game β€” You don't give orders. You design signals. Built with Next.js, Canvas 2D, and emergent AI.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0