Prompt:
Create “Corsair Bay,” a polished, playable 3D naval battle game using Three.js and WebGL. Deliver a self-contained HTML file with procedural geometry, materials, textures, and sound. It must run directly in a modern browser.
ART DIRECTION
A sunlit maritime scene with turquoise water, warm wooden ships, cream-colored sails, brass details, and atmospheric distance haze. Aim for a cohesive, detailed indie game aesthetic. No fortress, blocky placeholder ships, or dark fantasy styling.
SHIPS
Build one player-controlled sailing ship and three AI opponents. Include shaped hulls, individual hull planks, decks, railings, cannons, masts, yards, rigging, animated sails, flags, and stern details.
Model the interiors properly: structural ribs, beams, lower decks, barrels, and crates. Damaged ships must reveal believable interiors rather than empty shells. All parts should connect convincingly.
OCEAN
Create a continuous animated ocean with layered waves, matching surface normals, Fresnel reflections, fine ripples, depth-based color, and restrained foam.
Ships should pitch and roll with the waves. Add bow spray, stern wakes, projectile splashes, and floating debris. Foam must follow the water surface.
Avoid rectangular water cutouts, holes around hulls, flickering overlapping surfaces, and reflections of submerged wreckage appearing above the water.
GAMEPLAY
W/S: increase or decrease sail power.
A/D: steer with inertia.
Q/E: fire port or starboard broadsides.
Space: fire toward the nearest suitable target.
Drag to orbit the camera; scroll to zoom.
Include pause, restart, fullscreen, sound controls, and touch controls.
Fire individual cannonballs in a staggered broadside. Use projectile trajectories, collision detection, reload timers, and visible muzzle smoke.
DESTRUCTION
Hits should detach nearby hull planks and damaged deck sections. Severe damage should break masts. Debris should tumble, splash, float briefly, and eventually disappear.
Ships should list and sink progressively, not vanish instantly. Include victory and defeat states.
AUDIO
Use layered Web Audio sound effects for cannon fire, hull impacts, wood cracks, mast breaks, splashes, reloading, readiness signals, steering, sail movement, collisions, and sinking.
Add subtle sea, wind, and hull ambience. Apply stereo positioning, distance attenuation, sound variations, and controlled mixing. Precompute reusable sound buffers to avoid combat stutters. Provide volume control and explicit audio activation. Pause, mute, and restart must handle every active sound correctly.
INTERFACE AND PERFORMANCE
Keep the interface compact: ship health, speed, heading, enemies sunk, and broadside reload indicators.
Reuse geometry and materials, pool particles, cap simultaneous audio voices, and avoid unnecessary allocations during combat.
TESTING
Verify steering, projectile hits, progressive damage, sinking, restart, pause, and audio controls. Inspect intact and destroyed ships from multiple angles. Check the water around moving hulls and wreckage carefully.
Deliver the working game, not a video or static render.