CloverPlusPlus
Essential performance optimization and bugfix mod for CloverPit. Fixes high-deadline freezes, camera softlocks, and ticket integer overflows.
| Last updated | 5 hours ago |
| Total downloads | 4 |
| Total rating | 0 |
| Categories | Tweaks |
| Dependency string | CoderCo-CloverPlusPlus-1.0.1 |
| Dependants | 0 other packages depend on this package |
This mod requires the following mods to function
BepInEx-BepInExPack
BepInEx pack for Mono Unity games. Preconfigured and ready to use.
Preferred version: 5.4.2100README
CloverPlusPlus (Clover++)
Disclaimer:
This mod was developed with the assistance of artificial intelligence (Google Antigravity) through pair programming with the player. The codebase was built by decompiling the game, profiling critical performance bottlenecks, and creating targeted Harmony patches.
🍀 Overview
CloverPlusPlus is an essential performance, stability, and bugfix mod for CloverPit.
When surviving deep into high deadlines, setting up powerful charm synergies, or accumulating massive fortunes of coins and tickets, the vanilla game begins to suffer from severe performance degradation, engine freezes, and game-breaking softlocks.
CloverPlusPlus resolves these issues completely under the hood while keeping game balance, mechanics, and rules 100% vanilla:
- No freezes on colossal payouts: Eliminates 10–30 second game freezes when calculating and formatting astronomical coin gains.
- Clover tickets never reset to zero: Fixes a vanilla integer overflow bug where farming tickets past the 64-bit limit wrapped your balance into the negative and reset it to 0.
- Camera never diverges into the void: Ending a round at high transition speeds now reliably transitions to the ATM instead of flinging the camera outside the room and softlocking the game.
- Instant autosaves: Saves and store restocks no longer cause micro-stutters or frame drops.
- No background network spam: Silenced an aggressive background Twitch polling loop that was spamming hundreds of network requests per minute during singleplayer runs.
- 100% save file compatibility: Save file structure is completely untouched. Your existing saves remain 100% compatible, and Steam achievements continue to unlock normally.
📦 Installation
Automatic (Recommended)
- Install via Thunderstore Mod Manager or r2modman by clicking "Install with Mod Manager".
- The mod manager will automatically handle all dependencies (including BepInExPack).
- Launch the game through the mod manager.
Manual Installation
- Install BepInExPack (v5.4.2305 or newer) for Unity games.
- Download this mod and extract
CloverPlusPlus.dllinto:<CloverPit Directory>/BepInEx/plugins/ - Launch the game normally via Steam.
🛠️ Detailed Breakdown of Fixes
1. Instant Scientific Notation for Mega-Numbers (O(1))
- The Problem: Vanilla uses .NET's standard
BigInteger.ToString("E4"). For numbers reaching orders of magnitude like 10^1000 or 10^10000 in deep deadlines, converting the entire multi-limb integer into a decimal string takes billions of CPU cycles, completely freezing the game on every spin. - The Fix: Extracts the most significant bits directly from the integer's underlying byte representation and computes the exponent via logarithms in O(1) time. Numbers of any size (up to 10^80000) are formatted in fractions of a microsecond with a 64-slot direct-mapped cache.
2. 64-Bit Ticket Overflow Protection & Load Fix
- The Problem: Ticket balances and lifetime statistics are stored as signed 64-bit integers (
long). Once tickets exceed 9.22 × 10^18 (9.22 quintillion), signed integer overflow occurs: the value wraps to negative and is reset to 0. Additionally, the startup animation would slowly tick from 0 to billions over several minutes, and the ticket machine would play a phantom printing animation on every save load. - The Fix:
- Implements saturation clamping: balances and lifetime statistics cap at
long.MaxValueinstead of wrapping around. - Automatically recovers corrupted negative balances from earlier saves.
- Accelerates the ticket count-up animation so it always finishes in ~1 second, and synchronizes the ticket machine on load to eliminate phantom dispense animations.
- Implements saturation clamping: balances and lifetime statistics cap at
3. Camera Stability at High Transition Speeds
- The Problem: When playing at 2x–4x transition speed, Euler angle interpolation (
Mathf.Lerp) could diverge during abrupt delta-time spikes. The camera position would shoot out into the void, making the ATM unreachable and permanently softlocking the round. - The Fix: Clamps the maximum step per frame and installs a recovery failsafe: if the camera ever drifts out of bounds, it smoothly and safely snaps back to the intended viewport.
4. 25x Faster Autosave Encryption
- The Problem: Vanilla save encryption assembled strings via character-by-character string concatenation (
string += ...), creating tens of megabytes of garbage memory and triggering garbage collection stalls on every autosave. - The Fix: Performs the XOR encryption directly in-place within a reusable character buffer (
char[]) with zero heap allocations, making saving instantaneous and imperceptible.
5. Capsule Shop Restock Infinite Loop Safeguard
- The Problem: The shop restock procedure repeatedly picked random charms in a
do ... whileloop until finding an allowed charm. If all remaining unbought charms were forbidden for the current deadline stage, the loop had no exit condition and would spin forever at 100% CPU, freezing the game process. - The Fix: Adds an iteration counter limit that cleanly breaks out if the item pool is exhausted or fully restricted, preventing process hangs.
6. Spin Bet Cost & Menu Raycast Optimizations
- The Problem:
- Vanilla executed multi-limb BigInteger division on every frame to determine maximum buyable spins.
- Each 3D menu button in the room ran its own independent
Physics.RaycastNonAlloccall every frame (~30 physics queries per frame).
- The Fix:
- Replaces multi-limb division with an upward multiplication bound check and caches bet cost text.
- Caches the menu raycast result once per frame (
Time.frameCount), reducing 30 physics queries to 1.
7. Background Twitch Network Spam Elimination
- The Problem: An internal timer ran every 0.5 seconds, continuously requesting device OAuth tokens and logging out in an endless cycle, spamming hundreds of HTTP 400 errors into the game log in singleplayer.
- The Fix: Suppresses background polling when the player is logged out, ensuring network activity only occurs when the player explicitly opts into Twitch integration in the settings menu.
⚙️ Compatibility & Technical Info
- Target Game: CloverPit (Steam, Unity 6 Mono)
- Dependencies: BepInExPack (v5.4.x)
- Saves: 100% backward & forward compatible with vanilla saves.
- Achievements: Steam achievements continue to unlock normally.