NOC W10 – Oceanic Autonomy

Link: https://editor.p5js.org/King-Raphael/sketches/lE4_WFASe
1. Introduction
“Oceanic Autonomy” is an interactive simulation that brings an underwater ecosystem to life through autonomous agents. Predators (sharks) hunt prey (schools of fish), which wander and flock in response to threats and obstacles (coral). Ambient elements such as underwater light rays, rising bubbles, and particle bursts deepen immersion, creating a dynamic visual and behavioral narrative. I use this project to explore steering behaviors, procedural graphics, and environmental effects within p5.js, and finally blending algorithmic rigor with aesthetic design to simulate a living ocean scene.
2. Work Process
- Conceptualization & Planning: I first made my mind and defined core agents: Prey, Predator, Obstacle, Bubbles, and ParticleExplosions. Then I mapped their behaviors, mainly including seek, flee, wander, wrap-around, and simple avoidance. After that I sketched visual style: silhouette shark, colorful fish, textured coral, and volumetric light.
- Base Architecture & Physics
- Created a
CreatureES6 base class encapsulating position, velocity, acceleration, force application, and boundary wrapping. - Extended subclasses:
- Prey: wander + flee and single-agent avoidance
- Predator: seek nearest prey, “eat” on contact, spawn particles
- Obstacle: multi-layer Perlin-noise coral
- Bubble & ParticleExplosion: simple lifespan-based visuals
- Created a
- Aesthetic Enhancements
- Underwater Light Rays: static beam parameters with subtle oscillating tilt via
blendMode(SCREEN) - Bubbles: random spawn, upward drift, and then fade-out
- Coral: layered noise shapes for depth and texture
- Agent Styling: flipped and scaled shark silhouette with dynamic dorsal fin and mouth animation; fish colored from a palette for variety.
- Underwater Light Rays: static beam parameters with subtle oscillating tilt via
- Iteration & Optimization: I balanced the object counts (prey, particles) to maintain a high fps and simplified collision checks by flagging and splicing finished agents.

3. Reflections & Lessons Learned
As we learned in class, utilize Inheritance and Polymorphism is really important. Those two ideas of coding can greatly help us reduce the complexity of the structure and have a better OOP system. Building a robust base “Creature” class greatly simplified behavior extensions and code maintenance.
For the performance, capping particle counts and generating static geometry upfront kept frame rates high, crucial for real-time feel. Meanwhile, small visual flourishes (light tilt, bubble motion, fin wag) significantly increased immersion while procedural textures adding organic richness. Frequent testing and parameter tuning (speeds, forces, opacities) are always a key part to achieving balanced, lifelike motion.

