I have created a complete, realistic 2D Billiards web application featuring realistic ball physics, cue aiming, spin control, and multiple game modes.
What Was Built:
-
Sub-Stepping Vector Physics Engine:
- Elastic Ball Collisions: Accurate momentum transfer and conservation of energy.
- Cushion Rebounds & Jaws: Angled pocket mouth jaws and cushion restitution.
- 12x Sub-Stepping Loop: Eliminates high-speed ball tunneling.
- Pocket Gravity Vacuum: Smooth suction gravity pull when balls near pocket openings with drop animations.
-
Cue Stick & Aiming System:
- Aiming: Pointer drag aiming, keyboard controls, and fine-tune nudge buttons (
-1.0°, -0.2°, +0.2°, +1.0°).
- Shot Trajectory & Ghost Ball: Predicts cue ball trajectory, ghost impact target ball position, target deflection line, and bank cushion reflection angles.
- Cue Thrust Animation: Pulls back based on power and thrusts forward upon shot release.
-
Power Control System:
- Power Bar: Power meter (0% to 100%) with color gradients.
- Spacebar Charge: Press & hold SPACE to charge shot power and release to strike.
-
Cue Ball English & Spin Effects:
- Interactive English Dial: Set contact point on cue ball for Topspin (Follow), Backspin (Draw), and Left/Right Sidespin.
- Spin Physics: Topspin continues momentum forward after impact, Backspin draws cue ball backward, and Sidespin alters cushion bounce deflection angles.
-
Audio Engine (Web Audio API Synthesizer):
- Procedural audio effects for cue strike, ball-ball clack, cushion thud, pocket drop clunk, chalking, and victory fanfare.
-
Game Modes & Rules:
- 8-Ball Pool: Standard rules with open table break, Solids vs. Stripes assignment, legal target ball rules, fouls, Ball-in-Hand drag placement, and 8-ball victory condition.
- Single Player vs Smart AI: AI opponent with 3 difficulty levels (Easy, Medium, Master Hustler) that calculates cuts, lines of sight, and power with realistic shot delays.
- Pass & Play Local 2-Player: Head-to-head local multiplayer.
- 9-Ball Pool: Racked diamond, lowest-number target ball rule.
- Trick Shot Challenges: Curated puzzle levels (Bank shots, combinations, needle threading) with star ratings.
- Practice / Free Play: Unlimited shots and re-racks.
-
Visual Customization & Polishing:
- Custom felt themes (Tournament Emerald, Royal Blue, Velvet Crimson, Midnight Slate).
- Cue stick finishes (Canadian Maple, Carbon Fiber Stealth, Golden Sovereign).
- Ball shelf tray showing pocketed balls, foul banners, and celebratory victory confetti modal.
Files built: index.html, src/types/game.ts, src/utils/sound.ts, src/utils/physics.ts, src/utils/ai.ts, src/utils/challenges.ts, src/utils/themes.ts, src/components/EnglishSelector.tsx, src/components/PowerSlider.tsx, src/components/TableCanvas.tsx, src/components/ScoreBoard.tsx, src/components/ControlsOverlay.tsx, src/components/CustomizationModal.tsx, src/components/GameOverModal.tsx, src/components/TrickShotsModal.tsx, src/components/RulesModal.tsx, src/App.tsx