HAPTIC FISHING / STUDY / LEVEL 2 OF 7

The math of
reeling in.

Once a fish is hooked, it is a tug of war. The rules describe it with just two numbers: tension (how tight the line is; 1 is dangerous) and progress (how close the fish is; 1 means landed). Every frame, each number changes at a rate that depends on only two things: are you holding reel, and is the fish surging.

Reeling, fish calmprogress rises fast, tension rises slowly
Reeling, fish surgingtension shoots up (about 3×), progress barely moves
Released, fish calmtension drops quickly, progress slips a little
Released, fish surgingtension drops, progress slips faster

Tension and progress over time

0.0 s
tensionprogress fish surgingyou are reeling tension = 1 (danger)
Controller: quiet

The fight

not started
Not started yet.
Tension has been at full for 0.00 s (over 0.35 s snaps the line)

The code running right now

fishingRules.js

The whole fight branch runs every frame. The shaded block is the branch; the highlighted lines are the part this frame actually takes: the if (reel) lines while you hold, the else lines when you let go.


      
Full files: fishingRules.js ↗ · how the scene uses these numbers: fishing.js ↗

Do the math: can this fish be landed in one pull?

GOLDEN KOI

A rate is "change per second". Multiplied by dt, it becomes the change in this frame (the same idea as the countdown timers in Level 1). Rates let you predict what will happen before you try:

Three things you should be able to explain

  1. Rate × dt. this.tension += rate * dt is the most common line in game code. Because the rate is written "per second", the result after one second is the same whether the headset runs at 72 or 90 frames per second.
  2. Why "reel, release, reel" wins. While reeling, tension keeps rising and reaches full in about a second. When released, tension falls by 0.9 per second, faster than it rose, while progress slips only a little. A short release is like taking a breath in a tug of war.
  3. clamp and over. clamp keeps tension between 0 and 1.15. over counts how long tension has stayed at full, and resets to 0 as soon as tension drops below 1. So only tension held at full continuously snaps the line.

Exercises: ① Tick "turn off surges", choose the golden koi, and hold reel without letting go. How many seconds until it snaps? Compare with the prediction in the table. ② Untick it and find a rhythm that lands the koi: let go whenever the orange surge band appears. ③ With surges off, set pull to 0 and work it out first: can you land the fish by holding non-stop before the line snaps? Hint: progress must go from 0.25 to 1; tension must go from 0.35 to 1 and then stay there 0.35 s. Compare the two times.