Basebound features several interconnected game systems that create the core gameplay loop. This document describes each system and how they interact.
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
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 placementBaseStructure- Individual blocks with healthBaseBoundary- Defines base territories
Networking: Block placements broadcast to all players via RPC.
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 controllerCurrencyPool- Player balance trackingTaxCollector- Automatic tax processing
Networking: Economy state updated every tick via RPC broadcast.
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 timersRaidController- Active raid stateWarrantManager- Warrant issuance and validation
Networking: Raid events broadcast to all clients; damage synchronized via RPC.
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 lifecycleContractGenerator- Dynamic contract creationRewardCalculator- Skill-based reward computation
Networking: Contract completion validated server-side; rewards broadcast via RPC.
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
- 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
When implementing a new game system:
- Create Component: Inherit from
Component(see architecture.md) - Implement Lifecycle: Use
OnFixedUpdate()for server logic - Add Networking: Use
[Rpc.Broadcast]for state changes - Update Documentation: Document in this file and architecture.md
- Add Tests: Test in minimal.scene
- 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
}
}- architecture.md - Component pattern and lifecycle
- networking.md - Multiplayer synchronization
- code-standards.md - Implementation standards