Skip to content

TediShopov/SystemDesignInterview

Repository files navigation

Introduction

This file helps you navigate and understand the source code of system I have developed. For more background on the projects and their systems, see the project page. Use Quick Navigation to jump to sections. Within each section, files are listed by importance, each with a one-line summary and a direct source link.
Brief glossaries and context notes clarify naming and intent.

Quick Navigation


Toot The Lute

Legend

  • Crotchet — Seconds per beat: Crotchet = 60 / BPM. Converts beat lengths to seconds.
  • Beat — Musical event with a Length (in beats); real-time length is Length * Crotchet.
  • Reference Target — Transform where the player should “hit” the beat (timing line).
  • Input Offset — Calibration to align input with audio timing.
  • Visual Offset — Calibration to align visuals with audio timing.

Beat/Rhythm System

Related files live in Assets/Scripts/BeatSystem.

  • BeatmapTrack.cs — Orchestrates the on-screen track; spawns/recycles beats from the active beatmap; evaluates player timing; maps audio time to track position.
  • BeatObject.cs — Visual/interactive unit for a single beat; tracks state (Approaching/Successful/Unsuccessful); raises resolution events; updates post-resolution effects.
  • Conductor.cs — Time authority; reads the Wwise playhead and publishes SongPosition (seconds); exposes Play/Resume/Pause/Stop Wwise events.

Referenced types (context): Beatmap (flattened beats; holds Conductor), Beat (timing/length), BeatmapSource (Wwise events), InputCalibration (audio/visual offsets).

Beat-Triggered Interactables

Related files live in Assets/Scripts/Interactables.


RatKing

Inventory System

Related files live in Ratking/Assets/Scripts/Inventory.

  • Inventory.cs — Core inventory data and rules: item list, placement validation, gold totals, persistence events.
  • IPlayerInventory.cs — Interface for inventory access: grid size, item list, placement/selection API, update events.
  • InventoryGridView.cs — Grid UI/controller: builds cells, previews placement, handles pick/place input, updates labels.
  • InventoryObject.cs — UI for a single item: tracks occupied cells, centers/sizes sprite on the grid, bridges to collectibles.
  • InventoryCell.cs — Visual cell widget; stores default colors; flips between default/valid/invalid during placement.

Throwing & Projectile Simulation System (Exit Point from Inventory)

  • Thrower.cs — Bridges inventory to world: simulates/throws selected item, predicts trajectory/sound, raises OnThrow event.

Collecting (Entry Point to Inventory)

  • Collectible.cs — Physical item with inventory metadata; handles breakage threshold; emits impact sounds.

Rollback Netcode Fighting Game

Rollback System

How buffers work (live vs. rollback shadows):

  • Live fighter buffers — Each fighter has a FighterBufferMono that creates/owns an InputBuffer in Awake(), copies inspector settings (delay/history), and assigns it to FighterController.InputBuffer.
    • Local fighter: CollectInputFromKeyboard = true; FixedUpdate() captures keyboard each fixed tick; enqueues stamped InputFrame (now + DelayInput).
    • Remote fighter: net layer fills buffer with received InputFrames (stamp, checksum, inputs).
  • Rollback shadow buffers — Each fighter has a paired RB clone with its own InputBuffer (e.g., PlayerRBBuffer, EnemyRBBuffer). After live enqueue/consume, the same frame is appended to the shadow buffer, maintaining a trailing window of DelayInput + rollbackWindow frames. Late inputs trigger RollbackEnqueue to replace predicted frames and re-predict following frames.
  • During rollbackRestore.Rollback(...)
    1. Swaps live fighters with their RB clones (saved gameplay state).
    2. Builds a temporary rollback buffer by concatenating the shadow’s buffer with the live buffer’s recent frames to cover the timeline from rollback point to “now.”
    3. Calls FighterController.Resimulate(...) to replay deterministically, then returns control to live objects.

Related files

  • InputBuffer.cs — Defines InputFrame (byte-packed inputs, frame stamp, checksum, predicted flag) and the InputBuffer (delay, prediction, rollback replacement, pressed-keys history).
  • FighterBufferMono.cs — Mono bridge capturing local input each fixed frame; enqueues with configured delay; raises events.
  • Restore.cs — Resimulates N frames from the rollback shadow state; spawns/destroys projectiles to match authoritative state.
  • FighterController.cs — Deterministic fighter logic (FixedMath.NET): movement, jump, facing, block/crouch; consumes stamped (or predicted) InputFrames and updates animator/render state.

Other notable features: P2P TCP (Nagle disabled), clock sync, deterministic gameplay (FixedMath.NET) with uncapped rendering, lightweight lobbies & chat, checksum-based desync detection.


Destructible Terrain — DX11 Computer Graphics Project

This system raycasts a heightfield to find an impact point, extracts a peak patch around that hit, cuts it against a plane to create a closed solid, shatters the solid into chunks via multiple procedural plane cuts, and spawns Bullet rigid bodies that blast outward. Inside/outside surfaces use different shaders. A CPU-writable “destroyed mask” texture is copied to an SRV; terrain generation samples this mask so rebuilds reflect the removed region.

Terrain generation & extraction

  • Terrain.h · Terrain.cpp — fBM/extra-noise terrain, destroyed-mask sampling, BFS peak extraction (extractPeakTerrainSubregion), mesh building.

Procedural cutting/shattering

Gameplay glue (raycast → extract → cut/close → shatter → physics)

Rendering & mask update

Utilities

Other notable features: Procedural Terrain (fBM), Procedural Destruction, Procedural Gerstner Waves, Compute Shader Buoyancy (Bullet3D integration), Screen-Space Reflections + DDA, Parallel-Split Shadow Maps.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published