Skip to content

Bogie666/Bees

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ AI-Powered Bee Hive Simulation

An interactive, visually stunning bee hive simulation powered by artificial intelligence. Watch as intelligent bees forage for resources, communicate through waggle dances, and grow their colony.

Bee Hive Simulation JavaScript License

๐ŸŒŸ Features

Intelligent Bee Behaviors

  • Four Bee Roles: Queen, Foragers, Scouts, and Nurses with unique AI behaviors
  • Smart Foraging: Bees use memory to remember flower locations
  • Waggle Dance Communication: Bees perform figure-8 dances to share flower locations with the colony
  • Pheromone Trails: Visual pheromone trails guide bees to resources
  • Energy Management: Bees consume energy and must return to the hive to refuel

Beautiful Visualizations

  • Dynamic Day/Night Cycle: Background and lighting change throughout the day
  • Honeycomb Pattern: Subtle hexagonal background pattern
  • Particle Effects: Colorful trails follow bees as they move
  • Animated Flowers: Flowers sway gently and regenerate resources
  • Glowing Hive: Central hive with atmospheric glow effect
  • Role-Based Colors: Each bee role has a distinct color scheme

Interactive Features

  • Click to Plant Flowers: Add flowers anywhere by clicking
  • Speed Control: Adjust simulation speed from 0.1x to 3.0x
  • Spawn Bees: Manually add worker bees to the colony
  • Pause/Resume: Control the simulation flow
  • Real-Time Stats: Track colony population, resources, and activity

AI-Powered Systems

  • Autonomous Exploration: Scout bees explore the environment for new resources
  • Knowledge Sharing: Bees learn flower locations from watching waggle dances
  • Resource Optimization: Foragers prioritize high-value flowers
  • Colony Growth: Colony automatically expands when resources are abundant
  • Role Distribution: Balanced distribution of worker roles for efficiency

๐ŸŽฎ How to Use

Getting Started

  1. Open index.html in any modern web browser
  2. Watch the bees come to life!

Controls

  • Click anywhere on canvas: Plant a flower
  • Add Random Flower button: Spawn flowers at random locations
  • Spawn Worker Bee button: Add a new bee (costs 50 food storage)
  • Pause/Resume button: Control simulation
  • Simulation Speed slider: Adjust speed (0.1x - 3.0x)
  • Flower Spawn Rate slider: Control automatic flower generation

Understanding the Simulation

Bee Roles

  • ๐Ÿ‘‘ Queen (Pink): Stays near the hive, essential for colony
  • ๐Ÿ Foragers (Gold): Collect pollen and nectar from flowers
  • ๐Ÿ” Scouts (Blue): Explore and discover new flower locations
  • ๐Ÿ’š Nurses (Green): Tend to the hive and maintain it

Bee Behaviors

  1. Foraging: Bees fly to flowers and collect resources
  2. Returning: Laden bees return to the hive to deposit resources
  3. Dancing: After a successful foraging trip, bees may perform a waggle dance
  4. Watching: Other bees watch dances to learn flower locations
  5. Exploring: Scouts venture out to find new resources

Resource Management

  • Honey: Converted from nectar
  • Pollen: Collected from flowers
  • Food Storage: Combined resources used for colony growth
  • Bees consume energy and must return to refuel
  • Colony grows automatically when storage exceeds 100 units

๐ŸŽจ Visual Features

Color Coding

  • Pink: Queen bee
  • Gold: Forager bees
  • Blue: Scout bees
  • Green: Nurse bees
  • Various colors: Flowers

Special Effects

  • Particle trails behind flying bees
  • Pheromone heat map showing resource trails
  • Animated waggle dances with figure-8 patterns
  • Dynamic lighting based on time of day
  • Hexagonal honeycomb background pattern

๐Ÿง  AI Implementation Details

Decision Making

Each bee uses a state machine with the following states:

  • idle: Resting or waiting for information
  • seeking: Flying to a known flower location
  • foraging: Collecting resources from a flower
  • returning: Flying back to the hive
  • dancing: Performing waggle dance
  • watching: Learning from another bee's dance
  • exploring: Searching for new resources (scouts only)

Memory System

  • Bees maintain a memory array of known flower locations
  • Scouts share discoveries with foragers through waggle dances
  • Memory is updated as flowers are depleted
  • Bees prioritize recently discovered, high-value flowers

Communication

The waggle dance is a realistic simulation of bee communication:

  • Duration indicates distance to flower
  • Angle indicates direction
  • Watching bees learn the flower location
  • Multiple bees can watch the same dance

๐Ÿ”ง Technical Details

Technologies

  • Pure JavaScript (ES6+)
  • HTML5 Canvas for rendering
  • CSS3 for UI styling
  • No external dependencies

Performance

  • Optimized for smooth 60 FPS
  • Efficient particle system
  • Supports 200+ bees simultaneously
  • Dynamic entity cleanup

Browser Compatibility

  • Chrome/Edge (recommended)
  • Firefox
  • Safari
  • Any modern browser with Canvas support

๐Ÿ“Š Stats Explained

  • Total Bees: Current colony population
  • Honey: Total honey collected
  • Pollen: Total pollen collected
  • Flowers: Active flowers in the environment
  • Active Dances: Ongoing waggle dances
  • Time: Current time of day
  • Food Storage: Available resources (shown as percentage)

๐ŸŽฏ Tips for Best Experience

  1. Start Small: Let the initial colony establish before adding too many bees
  2. Plant Strategically: Cluster flowers in areas for more efficient foraging
  3. Watch the Dances: Observe how bees share information
  4. Adjust Speed: Slow down to see details, speed up for colony growth
  5. Manage Resources: Balance bee spawning with food storage

๐Ÿš€ Future Enhancements

Potential additions:

  • Predators and threats
  • Seasonal changes
  • Multiple hives with competition
  • Bee genetics and evolution
  • Sound effects and music
  • Save/load simulation state
  • Advanced statistics and graphs
  • Mobile touch controls

๐Ÿ“ License

MIT License - Feel free to use and modify!

๐Ÿ™ Acknowledgments

Inspired by real bee behavior and collective intelligence systems.


Enjoy watching your bee colony thrive! ๐Ÿ๐ŸŒธ

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors