ConsistentShots
Make your shots controllably deterministic
About this mod Author’s original text
Consistent Shots
In short, using the scroll wheel to aim will make your shot consistent. This fundamentally changes how the game is
played since you can memorize the positions of shots on certain boards and reproduce them consistently, but I believe
it's for the better.
With this mod you can set up the general position for a shot such as at the edge of a peg, snap it into place with the
scroll wheel, then every time you fire that shot it will follow the same bounce.
How it works
For a confusing video
see this message on the Peglin
discord server.
Essentially, in the vanilla game, when you're aiming to the right and scroll up to adjust the shot the following might
happen in the code:
| Player Action | Aim Direction (degrees) | Notes |
|---------------------------------|-------------------------|--------------------------------------------------------------------|
| Start the battle | 270 | this is why, even in vanilla, firing straight down is consistent |
| Aim to the right with the mouse | 330.023016 | Aiming with the mouse will almost always have some decimal places |
| Scroll Up | 330.056123 | Add ~0.05 degrees to the aimer but not exactly |
| Scroll Down | 330.010012 | Subtracts ~0.05 degrees, again accumulating floating point errors |
| Scroll Up | 330.051297 | These last 2 just showcase that the aimer continues to be "random" |
| Scroll Down | 330.001154 | |
These numbers are fabricated for this example, but it's essentially what happens in the game. Even though the
prediction indicator in the game might appear to be in the exact same position you can see that the angle the game
uses to fire the shots changes every so slightly even if you only move the aimer back and forth.
Now we can compare with this mod enabled:
| Player Action | Aim Direction (degrees) | Notes |
|---------------------------------|-------------------------|-------------------------------------------------|
| Start the battle | 270 | same initial rotation as in vanilla |
| Aim to the right with the mouse | 330.023016 | Aiming with the mouse doesn't snap to any angle |
| Scroll Up | 330.050000 | Snap up to the next increment of 0.05 |
| Scroll Down | 330.000000 | Snap down to the previous increment of 0.05. |
| Scroll Up | 330.050000 | Snap up to the same value from before |
| Scroll Down | 330.000000 | And snap back down again |
The rounding of the aimer rotation is the primary factor in the outcome of the shot. If you fire a shot while aiming
at 330.050000 it will behave exactly the same every time as long as it hits the same pegs. So you can see
Primary features
- Angle Snapping
- Using the slow aim (scroll wheel by default) will snap in a configurable increment (0.05 degrees by default)
rather than the default behavior which can accumulate floating point errors and vary depending on your input
device.
- Quantize Aim Vector
- rounds vector components to 0. This should only happen when incrementing the aimer to point in one of the four
cardinal directions which is generally only noticeable when moving back to the starting aim direction
(270 degrees, straight down).
- Deterministic long peg removal
- The timer for removing a long peg (the rectangular slide ones like the horns in the minotaur fight) is tied to the
physics step instead of the framerate to avoid variations due to framerate and timescale.
Note
Astute players will notice that this behaviour was an optional experimental feature in
the TestingFloor mod. I've moved
that code into a standalone mod and allowed you to configure the exact snapping angle.
Install & use Install: follow the bundled instructions
- Unzip the archive from playbuff and read the bundled readme / instructions first.
- Most mods rely on the game's mod loader — the usual route is a community mod manager (such as r2modman): pick this game, install, and it handles the loader and dependencies.
- For a manual install, put the mod files into the matching Mod / plugins folder inside the game directory.
- Launch the game to confirm it loaded; mods with listed dependencies need those installed as well.
Install locations vary a lot between mods — the bundled readme is the most reliable guide.
Install these first, or the mod will not work: