# furpz/tt_camerafpsunlocker architecture

> Architecture diagram of the GitHub repository furpz/tt_camerafpsunlocker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/furpz/tt_camerafpsunlocker
- Repository: https://github.com/furpz/tt_camerafpsunlocker

## Overview

1. **Repository type**
   - This is a **single-game mod** written in C# and built as a class-library assembly (`CameraFPSUnlocker.csproj` / `TT_CameraFPSUnlocker.slnx`).
   - There is no standalone app or service here; the code is meant to be loaded into the game at runtime.

2. **Primary goal**
   - The mod’s purpose is to make the camera feel smooth at **60 Hz+** by aligning camera behavior with the game’s actual render/update rate instead of being constrained by fixed physics timing.
   - The README also calls out a second effect: preventing projectile/self-collision issues introduced by interpolation.

3. **Main runtime boundary**
   - The important architectural boundary is **game engine vs. mod patches**.
   - The game owns the simulation loop and physics; this mod injects behavior into existing game methods rather than replacing the game architecture.

4. **Bootstrap / entry layer**
   - `CameraFPSUnlockerMod.cs` and `KickStart.cs` are the likely initialization layer.
   - This is where the mod is probably registered, Harmony patching is started, and any runtime setup is performed before gameplay logic is altered.

5. **Configuration**
   - `ModSettings.cs` is the settings boundary.
   - Any user-facing toggles or tuning values would live here, separating mod behavior from patch logic so the patch code stays focused on interception and behavior changes.

6. **Camera subsystem**
   - `Patches/CameraPatches.cs` is the core camera-related modification point.
   - Per the README, the mod effectively moves camera logic from `FixedUpdate` to `Update`, which changes the timing model from physics-driven to frame-driven and is the main reason the camera appears smoother.

7. **Physics / interpolation subsystem**
   - The mod also enables **rigidbody interpolation** on the tech/player vehicle entity.
   - This is a rendering-smoothing layer on top of the physics system, helping the camera and vehicle motion look continuous between fixed physics steps.

8. **Firing / projectile compensation**
   - `Patches/FiringPatch.cs` handles a side effect of interpolation: moving or shooting can cause projectiles to collide with the player’s own tech.
   - The patch offsets projectile origins by one physics frame ahead of the tech, compensating for the interpolated render position versus the actual physics position.

9. **Data flow**
   - Game loop events (`Update` / `FixedUpdate`) and firing logic flow into Harmony patches.
   - Those patches alter camera timing, interpolation settings, and projectile spawn position, then hand control back to the original game systems.

10. **Technology footprint**
   - The mod is a **Harmony-based C# Unity game mod**.
   - The architecture is lightweight: no database, no network service, no asset pipeline, and no persistence layer beyond whatever the game/mod loader provides.

11. **What to diagram**
   - For an architecture diagram, show:
     - the **game engine** as the host,
     - a **mod bootstrap layer**,
     - **camera timing patching**,
     - **physics interpolation**, and
     - **projectile origin compensation** as a separate corrective path.
   - The key idea is that the mod modifies **runtime behavior at method boundaries**, not by adding new standalone subsystems.

Main entry points: [`Patches/CameraPatches.cs`](https://github.com/furpz/tt_camerafpsunlocker/blob/master/Patches/CameraPatches.cs) (Camera patch), [`Patches/FiringPatch.cs`](https://github.com/furpz/tt_camerafpsunlocker/blob/master/Patches/FiringPatch.cs) (Firing patch), [`CameraFPSUnlockerMod.cs`](https://github.com/furpz/tt_camerafpsunlocker/blob/master/CameraFPSUnlockerMod.cs) (Mod entry), [`ModSettings.cs`](https://github.com/furpz/tt_camerafpsunlocker/blob/master/ModSettings.cs) (Settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_host["Game Host"]
  node_game_engine["Game engine<br/>Unity host"]
  node_gameplay_systems["Game systems<br/>original gameplay"]
end

subgraph group_bootstrap["Bootstrap"]
  node_mod_entry["Mod entry<br/>bootstrap"]
  node_kickstart["KickStart<br/>init hook<br/>[KickStart.cs]"]
  node_harmony{{"Harmony<br/>patch runtime"}}
end

subgraph group_camera["Camera"]
  node_camera_patch["Camera patch<br/>camera timing<br/>[CameraPatches.cs]"]
  node_update_loop(("Update loop<br/>frame timing"))
  node_render_motion(("Smooth motion<br/>visual result"))
end

subgraph group_physics["Physics"]
  node_fixed_loop(("FixedUpdate<br/>physics timing"))
  node_rigidbody_interp["Interpolation<br/>render smoothing"]
  node_tech_entity[("Tech entity<br/>vehicle body")]
end

subgraph group_firing["Firing"]
  node_firing_patch["Firing patch<br/>projectile fix<br/>[FiringPatch.cs]"]
  node_projectile_spawn(("Projectile spawn<br/>origin offset"))
  node_projectile_hit(("Projectile hit<br/>collision outcome"))
end

subgraph group_config["Config"]
  node_settings["Settings<br/>mod config<br/>[ModSettings.cs]"]
end

node_game_engine -->|"loads"| node_mod_entry
node_mod_entry -->|"starts"| node_kickstart
node_mod_entry -->|"installs"| node_harmony
node_kickstart -->|"reads"| node_settings
node_harmony -->|"patches"| node_camera_patch
node_harmony -->|"patches"| node_firing_patch
node_gameplay_systems -->|"runs"| node_update_loop
node_gameplay_systems -->|"runs"| node_fixed_loop
node_update_loop -->|"routes"| node_camera_patch
node_fixed_loop -->|"feeds"| node_rigidbody_interp
node_tech_entity -->|"applies"| node_rigidbody_interp
node_rigidbody_interp -->|"smooths"| node_render_motion
node_camera_patch -->|"improves"| node_render_motion
node_gameplay_systems -->|"emits"| node_firing_patch
node_firing_patch -->|"offsets"| node_projectile_spawn
node_projectile_spawn -->|"prevents"| node_projectile_hit
node_settings -->|"configures"| node_camera_patch
node_settings -->|"configures"| node_firing_patch
node_gameplay_systems -->|"contains"| node_tech_entity

click node_mod_entry "https://github.com/furpz/tt_camerafpsunlocker/blob/master/CameraFPSUnlockerMod.cs"
click node_kickstart "https://github.com/furpz/tt_camerafpsunlocker/blob/master/KickStart.cs"
click node_settings "https://github.com/furpz/tt_camerafpsunlocker/blob/master/ModSettings.cs"
click node_camera_patch "https://github.com/furpz/tt_camerafpsunlocker/blob/master/Patches/CameraPatches.cs"
click node_firing_patch "https://github.com/furpz/tt_camerafpsunlocker/blob/master/Patches/FiringPatch.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_game_engine,node_gameplay_systems toneBlue
class node_mod_entry,node_kickstart,node_harmony toneAmber
class node_camera_patch,node_update_loop,node_render_motion toneMint
class node_fixed_loop,node_rigidbody_interp,node_tech_entity toneRose
class node_firing_patch,node_projectile_spawn,node_projectile_hit toneIndigo
class node_settings toneTeal
```

## Components

### Game Host

The Unity game that loads and runs the mod at runtime.

- **Game engine**: Unity host · The base game runtime that owns simulation, rendering, and method boundaries.
- **Game systems**: original gameplay · The game's original camera, physics, and firing logic that the mod patches in place.

### Bootstrap

Mod entry and initialization layer.

- [Mod entry](https://github.com/furpz/tt_camerafpsunlocker/blob/master/CameraFPSUnlockerMod.cs): bootstrap · Top-level mod initialization that prepares the runtime patching flow. · `CameraFPSUnlockerMod.cs`
- [KickStart](https://github.com/furpz/tt_camerafpsunlocker/blob/master/KickStart.cs): init hook · Secondary startup hook used to wire the mod into the game lifecycle. · `KickStart.cs`
- **Harmony**: patch runtime · Method interception layer that applies runtime behavior changes to the game.

### Camera

Camera timing and smoothing behavior.

- [Camera patch](https://github.com/furpz/tt_camerafpsunlocker/blob/master/Patches/CameraPatches.cs): camera timing · Moves camera behavior toward frame-driven updates to feel smooth at higher refresh rates. · `Patches/CameraPatches.cs`
- **Update loop**: frame timing · Per-frame game update boundary used by the camera patch.
- **Smooth motion**: visual result · The perceived continuous camera and vehicle motion shown to the player.

### Physics

Render-smoothing around the game's fixed physics.

- **FixedUpdate**: physics timing · Physics-timed update boundary the mod works around.
- **Interpolation**: render smoothing · Enables rigidbody interpolation to smooth visible motion between physics steps.
- **Tech entity**: vehicle body · The player vehicle or rigidbody that receives interpolation changes.

### Firing

Projectile spawn correction path.

- [Firing patch](https://github.com/furpz/tt_camerafpsunlocker/blob/master/Patches/FiringPatch.cs): projectile fix · Offsets projectile origin to compensate for interpolation-induced self-collision. · `Patches/FiringPatch.cs`
- **Projectile spawn**: origin offset · Projectile creation point adjusted forward by one physics frame.
- **Projectile hit**: collision outcome · Projectile collision behavior corrected so shots do not strike the moving tech immediately.

### Config

User-facing mod settings boundary.

- [Settings](https://github.com/furpz/tt_camerafpsunlocker/blob/master/ModSettings.cs): mod config · Central settings boundary for toggles and tuning values. · `ModSettings.cs`

## Connections

- Game engine → Mod entry: loads · The host loads the mod assembly and starts initialization.
- Mod entry → KickStart: starts · Entry code hands off startup work to the kickstart layer.
- Mod entry → Harmony: installs · Initialization enables Harmony patch application.
- KickStart → Settings: reads · Startup code consumes mod settings before applying behavior changes.
- Harmony → Camera patch: patches · Harmony intercepts camera-related game methods.
- Harmony → Firing patch: patches · Harmony intercepts projectile firing logic.
- Game systems → Update loop: runs · The game drives per-frame updates.
- Game systems → FixedUpdate: runs · The game also drives fixed-timestep physics updates.
- Update loop → Camera patch: routes · Camera behavior is shifted toward frame-driven timing.
- FixedUpdate → Interpolation: feeds · Interpolation bridges the fixed physics cadence to render-time motion.
- Tech entity → Interpolation: applies · The vehicle rigidbody is configured for interpolation.
- Interpolation → Smooth motion: smooths · Interpolation makes visible movement continuous between physics steps.
- Camera patch → Smooth motion: improves · The camera feels smoother at 60 Hz+ by following the frame update cadence.
- Game systems → Firing patch: emits · Original firing logic is redirected through the projectile compensation patch.
- Firing patch → Projectile spawn: offsets · The projectile origin is moved ahead to match the interpolated tech position.
- Projectile spawn → Projectile hit: prevents · The offset reduces self-collision and other interpolation-related shot issues.
- Settings → Camera patch: configures · Settings can tune how the camera patch behaves.
- Settings → Firing patch: configures · Settings can tune projectile compensation behavior.
- Game systems → Tech entity: contains · The original game owns the vehicle rigidbody that the mod enhances.
