60 FPS

Configuration

Statistics

Performance

Population

Velocity Distribution

Direction Analysis

Fluid Dynamics

Spatial Distribution

Technical Information

Algorithm Overview

This simulation implements multi-species boids with fluid dynamics integration using data-oriented design principles.

Core Boids Rules

for each boid:
    separation = steer_away_from_neighbors(separation_radius)
    alignment = steer_toward_average_heading(alignment_radius)  
    cohesion = steer_toward_average_position(cohesion_radius)
    
    steering_force = separation + alignment + cohesion
    steering_force = limit(steering_force, max_force)
    
    velocity += steering_force
    velocity = limit(velocity, max_speed)
    position += velocity

Fluid Dynamics Integration

The new Fluid Viscosity Rule simulates realistic fluid interactions:

fluid_force = Vector2(0, 0)
for each nearby_boid:
    relative_velocity = boid.velocity - nearby_boid.velocity
    distance = magnitude(boid.position - nearby_boid.position)
    viscous_force = relative_velocity * viscosity / (distance + 1)
    fluid_force -= viscous_force

current_force = sample_fluid_field(boid.position) * current_strength
total_force = fluid_force + current_force

boid.velocity += total_force * dt

Optimization Techniques

Help & Documentation

Project Description

An advanced multi-species boids simulation featuring fluid dynamics integration. This system demonstrates emergent flocking behavior enhanced by realistic physical forces including viscosity, current fields, and inter-species interactions.

Fluid Viscosity Rule

The innovative fluid viscosity rule simulates drag forces between boids, creating realistic schooling behavior where faster-moving boids experience resistance from slower neighbors, while underwater currents provide environmental flow patterns.

Configuration Parameters

URL Parameters

All configuration can be set via URL parameters:

?hue=180&speciesCount=3&boidCount=150&maxSpeed=2.5
&header=My Simulation&subheader=Custom Setup
&debug=true&showQuadtree=false

Interactive Controls

Technical Specifications

Change Log

Comprehensive Prompt Log

Let's write an beautiful, interactive, highly-configurable and informative multi-species boids simulation.

Let's use a data-oriented design.

Really juice the visuals. I want it to be beautiful, sleek, colorful, vibrant, and dynamic. The user's input on the canvas should be unique, dramatic, visually striking and to strongly affect the boids.

In this simulation, the boids are interacting with another simulation inspired by nature. For example, the boids may be swimming in a ripple pool, caught in air currents, experiencing viscosity (local drag with other boids), leaving trails of smoke, etc. Choose a secondary simulation that is beautiful and interacts well with boids. 

Let's write this as a single page in html, css, and javascript. Let's not use any external libraries.

Let's use a dark theme. Let's have a color selector with an optional url parameter "hue" that we use to generate a color scheme. I want the page to take any number of optional "header" and "subheader" url parameters for displaying as text on the canvas. I want the canvas to be full screen, with all configuration and stats behind toggle-able overlays. I want lots of slick animations, and for the action to begin as soon as the page loads. I want it to work well on both desktop and mobile. I want it display the frame rate.

I want all configuration available as optional url parameters. Whenever a configuration changes on the page, I want it to be updated in the url. I want an optional url parameter "debug" that shows all configuration values in the url and enables additional logging.

I want all overlays to start hidden.

I want all overlays to have a close button.

I want max steering force as one of the configurable options.

I want a quadtree and way to visualize it, enabled by default.

I want lots of charts and running graphs in the stats overlay, including a polar spiral chart with the mean and stdev direction that the boids are facing.

I want an comprehensive info overlay for a highly technical audience, including pseudocode and information about the new rule.

I want a help overlay that includes (but is not limited to) a description of this project, a description of the new rule, documentation for all configuration, specs, a detailed change log, and a comprehensive prompt log that includes this entire prompt.