Punch Glitch

From Jak Speedruns Wiki
Jump to navigation Jump to search
Punch glitch occurring in Jak 3 during the tutorial.

Punch glitch is a bug that is exclusively encountered on the PlayStation 3 Jak and Daxter Collection. It would change Jak's punching direction seemingly at random and would cause frustration amongst casual players and speedrunners. For this reason, many speedrunners refused to run on PS3.

Demonstration

Technical

During the development of the PC port for Jak and Daxter: The Precursor Legacy, punch glitch began to occur. After looking more into it, the head project developer was able to isolate the cause.

The issue is the acos in logic-target.gc. In PCSX2/PS2 it can never quite return 0.0. But on PC it does, and it causes 0/0 instead of 0/very-small-number. This is used as the input to a slerp and it ends up setting the output quaternion to 0 0 0 0. Over the next 2 frames, this completely breaks the dir-targ and unknown-quaternion00 and the target/camera rotation matrix ends up being identity. This sudden change rotates jak's velocity so it is entirely in the global x direction.

My understanding is that this should only happen when the dir-targ aligns with jak's velocity exactly. It may only be catastrophic if the camera is also aligned so that pushing forward on the stick will move jak in this direction.

I don't think the location has anything to do with it. It's possible that it only happens on ground that's perfectly level but I don't know. Instead, I think it tends to happen in places where people are lined up well with the camera and punching in/out of the camera exactly.

- Water111

The following code was added to acos in trigonometry.gc to fix the problem:

(defun acos ((arg0 float))
  "Inverse cosine. Returns rotation units"
  (let ((result (- 16384.000000 (asin arg0))))
    (#when PC_PORT
      ;; to avoid punch glitch:
      ;; (note: it might be a better fix to change the global rounding mode,
      ;;  but it's not super clear to me that the mode picked by PCSX2 is
      ;;  more accurate than normal in all cases. So, we'll do this for now.)
      (when (= result 0.0)
        (set! result 0.00000000001)
        )
      )
    result
    )
  )

It is also believed that punch glitch can lead to the rare occurrence of the moon walk.

Discovery

Due to the frequency of the bug, it's impossible to determine who encountered it first.

Other Notes

Glitches, Bugs, Exploits, and Secrets
Jak and Daxter: The Precursor Legacy Audio Pause GlitchBoat PauseBridge BlastCheat ModeDark GlitchDebug ModeDeveloper PicturesDupe StateFlut Flut EscapeGame CrashGhost GlitchHard FishIdle DeloadLine GlitchMoon WalkOrb Duplication GlitchPause BufferPause Cutscene TriggerPunch GlitchStatue GlitchTexture CorruptionVoid OutWalking While TalkingZombie GlitchZoomer Escape
Jak II Cheat ModeDebug ModeDeveloper PicturesGame CrashGhost TownInvisibility GlitchInvulnerability GlitchLine GlitchOrb Duplication GlitchPause BufferPeacemaker StackingPunch GlitchStadium BugStatue GlitchZombie Glitch
Jak 3 Cheat ModeDebug ModeDeveloper PicturesGame CrashInvisibility GlitchInvulnerability GlitchLine GlitchOrb Duplication GlitchPeacemaker StackingPunch GlitchStatue GlitchZombie Glitch
Jak X: Combat Racing Autosave BugDebug ModeLine Glitch
Daxter Dream OrbPalace Vase OrbTeleporter Menu Storage
Jak and Daxter: The Lost Frontier Easter EggsScene Player Skip