# Golf

![Golf icon](pwa-192x192.png "Golf")

Nine holes beside the lake. Up to eight friends play mini golf together on the shared screen, each with their own third-person course view and putter on a phone.

![The shared lakeside course, player scores and standard QR invitation](screenshot-viewer.png "Golf shared screen")

## Join the green

1. Launch **Golf** from the Arcade section of Viewer Control, or [open the shared screen](./).
2. Scan its standard RCWeb QR panel. The invitation opens [Golf Control](../golf-c/) in the same room. Existing room controllers move to Golf Control automatically.
3. Enter your name under **Player & scores**. The first connected player is the captain and can **Start the round**. The shared screen also has a Start button.

For phones on your Wi-Fi, open the viewer using the server's LAN address. A QR code containing `localhost` points to the phone itself and cannot reach the server. Keep the viewer open and visible while playing.

## Take a putt

- **Aim:** drag sideways over your 3D view, move the aim slider, or tap minus/plus for one-degree adjustments. A dotted line shows the intended direction.
- **Power:** choose 1–100%. Gentle putts have finer control near the bottom of the range.
- **Accuracy:** the marker sweeps continuously across the timing bar. Tap **PUTT** at the centre to hit straight. Missing left or right bends the initial direction to that side; powerful shots magnify the error. There is no random error added to a shot.
- **View course:** inspect the whole hole, then return to your golfer.

Your golfer takes a bent-knee stance and rocks the shoulders, arms and putter together. Higher power produces a longer backswing and follow-through. Coloured markings rotate with the ball as it rolls and bounces, the camera follows it, and the golfer walks into position for the next putt. Wait for your own ball to settle. Everyone else can keep playing. Mouse controls and left/right arrow keys also work; Space takes a putt when the player menu is closed.

Everyone starts each hole at the same tee and takes turns there. Balls close enough for golfers or clubs to overlap also share a local queue. Waiting golfers stand apart nearby and leave small coloured ground markers in place of their balls. The controller names the active golfer and disables putting until your golfer has stepped into position. A short putt or water return goes behind golfers already waiting at that spot. Players elsewhere keep playing simultaneously.

![The golfer, aim, power and moving accuracy controls on a portrait phone](screenshot-phone.png "Golf phone controls")

## Scoring

Lowest total strokes wins. All players share the current hole and advance together after a five-second score pause. Balls do not collide with other players. Golfers sharing a ball position wait nearby and take turns, including at the common starting tee.

Sink a putt to send a burst of confetti up from the cup. It flutters down and settles around the hole on both the shared screen and phones.

After finishing, your golfer walks around obstacles and steps over the low boundary wall to the spectator terrace. Eight spaced places, a bench and flower planters give everyone room to watch. Your phone switches to a view back across the green while the remaining golfers play.

Water or leaving the course adds one penalty stroke and returns the ball to its previous safe position. Sandy patches slow the ball more than the green. The maximum is ten strokes per hole. A ball still moving after 35 seconds is visibly recovered to prevent an indefinite wait.

Players can join during a round. Earlier holes remain unplayed and their round is marked **partial**, with an asterisk beside their name. Only completed nine-hole rounds enter the final winner calculation; equal totals share the win. A player disconnected for twelve seconds is marked away. Their unfinished hole stays unplayed if the others move on. Their place and recorded scores are reserved for reconnecting. When everyone is away the round pauses.

Refresh the phone to recover its player in the same browser tab. Names use the shared `rcwebName` preference. The viewer saves the round locally, including accepted shots. When a viewer becomes the main display, including after a refresh or host takeover, it resets existing Golf controllers in place and redirects other room controllers to Golf Control. Phones keep their connections and rejoin with their saved identities and scores; aim, power and camera controls reset. Joining retries automatically until the viewer registers the player. Starting a round does not reset controllers already in Golf Control. Saved rounds expire after eight hours. Storage failures are reported on screen. Returning to **Back to apps** moves only that phone, in the same room.

## The course

1. **First Green — par 2:** learn power and timing on an open green.
2. **Bank Holiday — par 3:** turn an L-shaped corner using the cushions.
3. **Twin Hills — par 3:** judge two crests and the downhill roll.
4. **Stone Garden — par 3:** choose a line through the rocks.
5. **Mill Run — par 3:** time rotating sails or use the right-hand passage.
6. **Lakeside Bridge — par 3:** cross the narrow bridge or follow the safe shore.
7. **Cascade Jump — par 3:** carry the stream and control the landing.
8. **The Bowl — par 3:** use the sloped green to curve towards the cup.
9. **Clubhouse Challenge — par 4:** descend past angled walls to the final flag.

## Browser support

Golf uses classic ES5 scripts, conservative CSS, and a dependency-free **WebGL 1** renderer. It does not require WebGL 2, JavaScript modules, textures, downloaded models, or external libraries. A browser with functioning WebGL 1 is required; graphics failures show a message rather than a blank screen.

Older Tizen / smart-TV browsers automatically use reduced resolution, simpler character curves and no antialiasing. Add `&lean=1` to a room URL to select this mode manually. Rendering normally targets 30 frames per second, rising to 60 while aiming on capable phones. During your shot and the following camera movement, the phone renders every available animation frame in both normal and reduced-detail modes. Ball physics uses fixed 1/120-second steps, independent of rendering. Performance on a particular older display must be checked on that hardware.

## How the room works

The oldest connected Golf viewer is authoritative. It validates shots, deduplicates sequence numbers, runs physics, and sends state snapshots. Phones interpolate snapshots and capture accuracy locally at the moment of the tap. Additional viewers mirror the same round and can take over from their latest snapshot if the host disappears. Controller input is disabled while fresh state is unavailable.

## Design references

The original course layouts draw on the variety of straight, banked, raised and obstacle holes discussed by [Minigolfnews](https://newsarchiv.minigolfsport.com/index.php?aliasid=63&id=89&p=blogdetail), and the emphasis on playable layouts and clear sightlines described in [Edward Felix's Walkabout design case study](https://edwardfelix.com/walkabout-mini-golf/).

The putting animation draws on [Titleist's instruction on quiet hands and a steady body](https://www.titleist.com/videos/instruction/stabilize-your-putting-quiet-hands-and-steady-body) and [the PGA's advice on putting alignment and tempo](https://www.pga.com/story/four-tips-to-help-you-make-more-putts).
