Skip to content

Pirate Cove — Three.js pirate ship game with Gerstner-wave water physics and jungle isles#11

Draft
ilikevibecoding wants to merge 6 commits into
mainfrom
cursor/bc-5141c887-5614-48c7-a866-b531e45e205b-862c
Draft

Pirate Cove — Three.js pirate ship game with Gerstner-wave water physics and jungle isles#11
ilikevibecoding wants to merge 6 commits into
mainfrom
cursor/bc-5141c887-5614-48c7-a866-b531e45e205b-862c

Conversation

@ilikevibecoding

@ilikevibecoding ilikevibecoding commented Jun 10, 2026

Copy link
Copy Markdown
Owner

What this adds

A self-contained browser game at pirate-ship/ — captain a procedural pirate galleon around a tropical cove ringed by jungle islands. Built with Three.js 0.184 via CDN importmap: no build step, no binary assets — everything (ship, ocean, islands, jungle) is generated in code.

Water physics (the core)

  • One wave model, two consumers: src/waves.js defines a sum of Gerstner (trochoidal) waves — swells, mid waves, chop. The same list feeds the GPU ocean shader (vertex displacement + analytic normals) and the CPU physics, so the ship floats on exactly the surface that is rendered.
  • True height sampling: Gerstner waves displace horizontally, so height-at-(x,z) is solved by fixed-point inversion (mm-accurate, covered by tests).
  • 14 buoyancy probes across the hull → natural heave/pitch/roll; damping acts on velocity relative to the moving water surface (rides swells without jitter).
  • Sailing model: 4 sail settings, wind-alignment thrust, speed-dependent rudder, heel in turns and from beam wind, lateral keel drag, anchor, and soft grounding/beaching against the islands' shared terrain field.

Environment

  • Single radial ocean mesh (dense near ship → ~7 km horizon, one draw call), shader with depth-based turquoise shallows, crest foam, animated shore foam, fresnel sky reflection, sun glints.
  • 8 islands from one shared field (terrain mesh + collision + ocean shader mirror): ridged-noise relief with per-island character, biome vertex coloring (deep jungle, glades, dirt breaks, dry highlands, rocky crags, noisy beach transitions), instanced wind-swaying palms + broadleaf canopy trees + undergrowth + rocks with per-instance tint, clouds, gulls, wake ribbon, bow spray, wave-conforming contact shadow.
  • Solid watertight galleon hull (capped bow/transom, double-sided shell, sealed deck, seated cannons).

Controls

W/S sails · A/D rudder · Space anchor · R reset · H help · drag/scroll camera.

Performance

~29 draw calls / ~685 k triangles including the shadow pass, capped pixel ratio, one 2048 px shadow map, instancing everywhere, physics catch-up capped at 5 steps/frame (no death spiral on slow machines).

Testing

  • Node physics suite (pirate-ship/test/physics.test.mjs, 17 checks): wave-inversion accuracy < 1 cm, flotation stability over 60 s, acceleration to cruise, steering both directions, grounding without tunnelling, reset.
  • Headless Chrome (Playwright + SwiftShader): zero console errors, non-blank canvas, scripted drive (ship sails ~8 m/s, turns 5.8°/s with D held), screenshots below.
  • CDN delivery verified: game loads and runs from raw.githack directly off this branch.
Cruising the shallows along the jungle beach Anchored off a palm islet
Jungle arc with canopy trees and palms Solid hull close-up with seated cannons

Play it

Existing site content (phone app at the root) is untouched; the Unity project files are unrelated and unmodified.

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

cursoragent and others added 3 commits June 10, 2026 16:04
… tests

Co-authored-by: ilikevibecoding <ilikevibecoding@users.noreply.github.com>
…gle, effects, HUD

Co-authored-by: ilikevibecoding <ilikevibecoding@users.noreply.github.com>
… deploy to Pages

Co-authored-by: ilikevibecoding <ilikevibecoding@users.noreply.github.com>
@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
my-projects Ready Ready Preview, Comment Jun 10, 2026 6:59pm
my-projects-kf1f Ready Ready Preview, Comment Jun 10, 2026 6:59pm

…ot, seat cannons

Co-authored-by: ilikevibecoding <ilikevibecoding@users.noreply.github.com>
…py trees, denser jungle

Co-authored-by: ilikevibecoding <ilikevibecoding@users.noreply.github.com>
…py w/ ground AO, leafy shrubs, budget trim

Co-authored-by: ilikevibecoding <ilikevibecoding@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants