How kidagine/darklings-fightinggame works
Project type and purpose
• This is a Unity 2D fighting game (“Darklings”) built with Unity 2021.3.24.
• It uses deterministic physics/animations, a rollback netcode (GGPO), replay/video streaming, UI/dialogue systems, AI opponents, and local/online multiplayer.
Top-level structure overview
• Root:
– Assets/ (game assets, code, plugins)
– Packages/ (manifest.json)
– ProjectSettings/ (Unity project config)
• Major subfolders under Assets/:
– _Project/… → all game-specific Scenes, Scripts, Prefabs, ScriptableObjects, Materials, Shaders, Sounds, UI, Simulation and Network code
– Plugins/ → third-party tools (ParrelSync for local testing, Sirenix Odin Inspector, Sprite Shaders Ultimate, jsLibrary)
– PlayFabEditorExtensions/ & PlayFabSDK/ → PlayFab integration for cloud data
– Pixel Arsenal/ → visual effect asset pack
– TextMesh Pro/, UIElementsSchema/, WebGLTemplates/ → UI and WebGL support
Key technology & patterns
• Unity Engine (URP) drives rendering, audio, input
• Deterministic simulation tick at 60 FPS (SimulationScripts)
• State machine pattern for character/game states (SimulationScripts/StateScripts)
• Rollback netcode using GGPO integration under NetworkScripts + STUN for NAT traversal
• ScriptableObject-based data (SciptableObjects) for easy tuning
• Editor-only tools: ParrelSync for multi-instance testing, Odin Inspector for better editor UI, PlayFabEditorExtensions
Components
A. Unity Editor & Build Pipeline
– Assets import & Asset Bundle builder
– Code compilation via asmdef files
– Continuous Integration (GitHub Actions activation.yml)
B. Runtime Game Client (Unity Player)
1. Input Layer
• Unity Input System → InputManager, NetworkInput
• ParrelSync (editor only) for multi-instance
2. Simulation & Physics
• Deterministic Physics (Physics2DSettings)
• SimulationScripts (GameSimulation, StateSimulation)
• Frame-locked tick at 60 FPS
3. State Machine & Rollback
• StateScripts for gameplay states
• GGPO netcode (GGPORunner, GGPOSession) + STUN client for NAT traversal
• Rollback buffer & InputBufferNetwork
4. Rendering & Audio
• URP rendering pipeline (URPProjectSettings)
• Sprite/Shaders (Sprite Shaders Ultimate, Pixel Arsenal)
• Audio mixer (AudioManager.asset) → SoundManager
5. UI & Video
• TextMeshPro UI, Canvas prefabs, DialogueSystem
• Streaming Video subsystem for command videos & replays
6. Game Services
• PlayFab SDK (Client, Data, Authentication) for analytics/leaderboards
C. External Services & Tools
– PlayFab cloud services
– Clumsy (optional network lag simulation)
– ParrelSync (local testing)
– GitHub (source, CI/CD)
Relationships & data flows
• Input → Simulation core → State changes → Renderer/Audio/UI
• Input & simulation states → Network layer (GGPO) ↔ peer client
• Simulation states → Replay recording & Video streaming
• ScriptableObjects → Simulation & UI for configuration
• PlayFab SDK ↔ PlayFab cloud for persistent data
Architectural patterns & principles
• Deterministic lockstep simulation + rollback => resilient netcode
• Separation of concerns: Input, Simulation, State Machine, Rendering, Audio, UI
• Data-driven design via ScriptableObjects & asmdef modularity
• Plugin-based extensibility (Odin Inspector, Sprite Shaders)