Skip to content

Latest commit

 

History

History
146 lines (107 loc) · 4.13 KB

File metadata and controls

146 lines (107 loc) · 4.13 KB

Gameplay Systems

Basebound features several interconnected game systems that create the core gameplay loop. This document describes each system and how they interact.

Overview

graph TB
    A["Server Tick<br/>50/sec"] --> B["Physics Update<br/>OnFixedUpdate"]
    B --> C["Check Raid Timer"]
    C --> D["Update Economy"]
    D --> E["Process Contracts"]
    E --> F["Broadcast to<br/>All Clients"]
    F --> A
    
    style A fill:#4a90e2
    style B fill:#50c878
    style C fill:#f39c12
    style D fill:#9b59b6
    style E fill:#e74c3c
    style F fill:#1abc9c
Loading

Game Systems

Base Building System

Purpose: Allow players to construct and defend bases with strategic placement.

Features:

  • Modular block placement
  • Cost system (currency-based)
  • Placement validation (collision, accessibility)
  • Destruction mechanics for raids

Key Components (to implement):

  • BaseBuilder - Handles block placement
  • BaseStructure - Individual blocks with health
  • BaseBoundary - Defines base territories

Networking: Block placements broadcast to all players via RPC.

Economy System

Purpose: Active-idle progression through currency accumulation.

Features:

  • Currency generation (passive & active)
  • Transaction ledger
  • Taxation system
  • Balance persistence

Key Components (to implement):

  • EconomyManager - Main economy controller
  • CurrencyPool - Player balance tracking
  • TaxCollector - Automatic tax processing

Networking: Economy state updated every tick via RPC broadcast.

Raid System

Purpose: Timed PvP raids on bases with warrant mechanics.

Features:

  • Raid scheduling (timed events)
  • Warrant system (raid authorization)
  • Base vulnerability windows
  • Reward distribution

Key Components (to implement):

  • RaidScheduler - Manages raid timers
  • RaidController - Active raid state
  • WarrantManager - Warrant issuance and validation

Networking: Raid events broadcast to all clients; damage synchronized via RPC.

Contract System

Purpose: Skill-first dynamic objectives with deterministic rewards.

Features:

  • Contract generation (varied difficulty)
  • Skill-based completion mechanics
  • Deterministic reward calculation
  • Time limits and bonuses

Key Components (to implement):

  • ContractManager - Contract lifecycle
  • ContractGenerator - Dynamic contract creation
  • RewardCalculator - Skill-based reward computation

Networking: Contract completion validated server-side; rewards broadcast via RPC.

Low-Population Optimizations

Basebound is designed to be friendly on low-population servers:

  • Passive Economy: Economy progresses even with few players
  • Scaled Events: Raid frequency and intensity adjusts with player count
  • Accessible Contracts: Contracts available for solo play
  • Cooperative Options: Events that reward cooperation over pure PvP

Server Tick Rate

  • Rate: 50 ticks per second (20ms per tick)
  • Physics: OnFixedUpdate called every tick
  • Networking: State synchronized every tick for consistency
  • Raycasts: Physics queries most accurate in OnFixedUpdate

Adding New Systems

When implementing a new game system:

  1. Create Component: Inherit from Component (see architecture.md)
  2. Implement Lifecycle: Use OnFixedUpdate() for server logic
  3. Add Networking: Use [Rpc.Broadcast] for state changes
  4. Update Documentation: Document in this file and architecture.md
  5. Add Tests: Test in minimal.scene
  6. Follow Standards: See code-standards.md

Example System:

public sealed class MyGameSystem : Component
{
    protected override void OnFixedUpdate()
    {
        if (IsProxy) return; // Server-only logic
        
        ProcessLogic();
        BroadcastUpdate();
    }
    
    [Rpc.Broadcast]
    public void BroadcastUpdate()
    {
        // All clients receive update
    }
}

Related Documentation