Developer Notes
- Steering and Boundary Avoidance: The fish navigate using a Craig Reynolds-style boundary steering algorithm. When approaching canvas edges, they smoothly adjust their direction relative to their proximity to the boundaries rather than making abrupt direction flips.
- Biological Variation: To simulate organic aquatic movement, each fish exhibits dynamic speed changes. A periodic sinewave driver creates distinct "thrusting" and "gliding" phases. Tail-fin wiggling slows down and softens during glides, capturing natural energy-conserving patterns.
- Cohesion and Separation: A lightweight separation force is calculated between the fish to minimize artificial overlapping and help them swim in organized, distinct patterns.
- Environment and Depth Layout: Procedural rocks and seaweed are divided into foreground and background rendering pipelines, creating a layered three-dimensional field of depth behind and around the autonomously swimming fish.