Skip to main content
Reading time: ~15 minutes
CORP (Component-Oriented Replicated Programming) is a powerful game development framework for Roblox built with roblox-ts. It provides a Unity-like ECS architecture with GameObjects and Components, along with a built-in networking system inspired by Unityโ€™s Netcode for GameObjects.

๐Ÿš€ Quick Start

Get up and running in minutes:
  1. Install Required Tools
  2. Clone the CORP Template
    git clone https://github.com/MonoliskSoftware/CORP-TEMPLATE
    cd CORP-TEMPLATE
    git submodule update --init --recursive
    npm install
    
  3. Configure your game Update GAMEPACKS/MYGAME/metadata.ts:
    const metadata: Gamepacks.Config.Metadata = {
        name: "MyGameName",  // Change this
        // ... rest of config
    };
    
    Update GAMECONFIG/gameinfo.ts:
    const gameinfo: Unreal.Gameinfo = {
        rootPack: "MyGameName",  // Must match metadata name
        authority: Unreal.Authority.SERVER
    };
    
  4. Create your first component In GAMEPACKS/MYGAME/src/:
    import { Behavior } from "CORP/shared/componentization/behavior";
    
    export class HelloWorld extends Behavior {
        public onStart(): void {
            print("Hello, CORP!");
        }
        
        public willRemove(): void {}
        protected getSourceScript(): ModuleScript {
            return script as ModuleScript;
        }
    }
    
  5. Export your component In GAMEPACKS/MYGAME/exports/components.ts:
    const components: Config.Components = {
        mappings: {
            "hello_world": HelloWorld
        }
    };
    
  6. Start Development Terminal 1 - Start Rojo:
    rojo serve default.project.json
    
    Terminal 2 - Watch TypeScript:
    npx rbxtsc --watch
    
    Connect Roblox Studio to Rojo and press Play!
๐Ÿ‘‰ Full Getting Started Guide โ†’ | Unreal System Guide โ†’

๐Ÿ“š Documentation

Core Documentation

GuideDescription
Getting StartedInstallation, setup, and your first component
Roblox StudioEssential Roblox concepts for CORP developers
Core ConceptsGameObjects, Components, Behaviors, and lifecycle
NetworkingNetworkObjects, NetworkBehaviors, NetworkedVariables, and RPCs
Scene ManagementCreating, loading, and managing game scenes
Unreal SystemGamepacks, authority models, and modular game organization
MacrosInstance transformation and procedural generation
ScriptableObjectsData assets and configuration management
DecoratorsUsing @SerializeField, @RequiresComponent, @RPC, and more
Advanced TopicsSpawn management, observables, optimization, and patterns

Reference & Examples

GuideDescription
API ReferenceComplete API documentation for all classes and methods
ExamplesPractical examples and tutorials for common game features

โœจ Features

๐ŸŽฎ Unity-Style Architecture

Familiar GameObject and Component patterns for organized game development.
const player = new GameObject("Player");
player.addComponent(PlayerController);
player.addComponent(HealthSystem, { maxHealth: 100 });

๐ŸŒ Built-in Networking

Automatic replication with NetworkObjects and NetworkBehaviors.
@RequiresComponent(NetworkObject)
export class PlayerSync extends NetworkBehavior {
    public readonly position = new NetworkedVariable<Vector3>(Vector3.zero);
}

๐Ÿ“ก Type-Safe RPCs

Remote Procedure Calls with flexible configuration.
@RPC.Method({
    endpoints: [RPC.Endpoint.CLIENT_TO_SERVER],
    accessPolicy: RPC.AccessPolicy.OWNER
})
public attack(targetId: string): void {
    // Server validates and processes
}

๐Ÿ”„ Automatic State Sync

NetworkedVariables, Lists, Maps, and Sets synchronize automatically.
public readonly health = new NetworkedVariable<number>(100);
public readonly inventory = new NetworkedList<string>();
public readonly scores = new NetworkedMap<string, number>();

๐ŸŽฌ Scene Management

Load and manage game scenes with serialization support.
const scene: SceneSerialization.SceneDescription = {
    children: [
        {
            name: "Player",
            components: [
                { path: ["src", "components", "PlayerController"], data: {} }
            ],
            children: []
        }
    ]
};

๐ŸŽฏ Component Lifecycle

Predictable initialization and cleanup with lifecycle hooks.
export class MyComponent extends Behavior {
    public willStart(): void { /* Pre-init */ }
    public onStart(): void { /* Initialize */ }
    public onPropertiesApplied(): void { /* React to config */ }
    public willRemove(): void { /* Cleanup */ }
}

๐ŸŽ“ Learning Path

๐ŸŸข Beginner

  1. Getting Started - Step-by-step tutorial to create your first game
  2. Core Concepts - Understanding GameObjects and Components
  3. Unreal System - Understanding Gamepacks and project structure

๐ŸŸก Intermediate

  1. Scene Management - Advanced scene loading and organization
  2. Macros - Transform instances into GameObjects procedurally
  3. ScriptableObjects - Create reusable data assets
  4. Decorators - Use component decorators effectively
  5. Examples - Build player controllers, health systems, and weapons

๐Ÿ”ด Advanced

  1. Networking - Create multiplayer experiences
  2. Advanced Topics - Master advanced patterns and optimization
  3. API Reference - Complete API reference

๐Ÿ“– Common Use Cases

See Examples for complete tutorials on:
  • Simple Player Controller - Character movement and input
  • Health System - Networked health with damage and respawn
  • Weapon System - Shooting mechanics with server validation
  • Enemy AI - Pathfinding and target tracking
  • Inventory System - Item management and UI
  • Game Manager - Match flow and win conditions

๐Ÿ”‘ Key Concepts

GameObjects

Entities in your game world that contain Components.
const enemy = new GameObject("Enemy");
enemy.setParent(parentObject);

Components

Define behavior and data for GameObjects.
export class MyComponent extends Component {
    public onStart(): void { /* Initialize */ }
    public willRemove(): void { /* Cleanup */ }
}

Behaviors

Components with serialization support.
export class MyBehavior extends Behavior {
    @SerializeField
    public configValue: number = 10;
}

NetworkObjects

Make GameObjects replicate across the network.
const netObj = player.addComponent(NetworkObject);
netObj.spawn(); // Server only

NetworkBehaviors

Components that replicate their state.
@RequiresComponent(NetworkObject)
export class MyNetworkBehavior extends NetworkBehavior {
    public readonly syncedValue = new NetworkedVariable<number>(0);
}

๐Ÿ› ๏ธ Architecture Overview

CORP Framework
โ”œโ”€โ”€ Core
โ”‚   โ”œโ”€โ”€ GameObject - Entity container
โ”‚   โ”œโ”€โ”€ Component - Base behavior class
โ”‚   โ””โ”€โ”€ Behavior - Serializable component
โ”‚
โ”œโ”€โ”€ Networking
โ”‚   โ”œโ”€โ”€ NetworkObject - Replication root
โ”‚   โ”œโ”€โ”€ NetworkBehavior - Networked component
โ”‚   โ”œโ”€โ”€ NetworkedVariable - Synced state
โ”‚   โ””โ”€โ”€ RPC - Remote procedure calls
โ”‚
โ”œโ”€โ”€ Scene Management
โ”‚   โ”œโ”€โ”€ SceneManager - Scene lifecycle
โ”‚   โ”œโ”€โ”€ Scene - Scene container
โ”‚   โ””โ”€โ”€ SceneSerialization - Scene format
โ”‚
โ””โ”€โ”€ Utilities
    โ”œโ”€โ”€ Signal - Event system
    โ”œโ”€โ”€ Collector - Resource cleanup
    โ””โ”€โ”€ Identification - ID generation

๐ŸŽฏ Best Practices

โœ… Do

  • Use Behavior for most components (serialization support)
  • Initialize in onStart(), not the constructor
  • Use @RequiresComponent for dependencies
  • Let server make authoritative decisions
  • Use batched replication when possible
  • Clean up resources with collector

โŒ Avoid

  • Accessing components in constructor
  • Modifying NetworkedVariables on client
  • Using instantaneous replication for frequent updates
  • Forgetting to call super() in constructors
  • Serializing runtime state (use configuration instead)

๐Ÿ’ก Quick Reference

Common Imports

// Core
import { CORP } from "CORP/shared/CORP";
import { GameObject } from "CORP/shared/componentization/game-object";
import { Behavior } from "CORP/shared/componentization/behavior";

// Networking
import { NetworkObject } from "CORP/shared/networking/network-object";
import { NetworkBehavior } from "CORP/shared/networking/network-behavior";
import { NetworkedVariable } from "CORP/shared/observables/networked-observables/networked-variable";
import { RPC } from "CORP/shared/networking/RPC";

// Decorators
import { SerializeField } from "CORP/shared/serialization/serialize-field";
import RequiresComponent from "CORP/shared/componentization/decorators/requires-component";

Component Template

import { Behavior } from "CORP/shared/componentization/behavior";
import { GameObject } from "CORP/shared/componentization/game-object";
import { SerializeField } from "CORP/shared/serialization/serialize-field";

export class MyComponent extends Behavior {
    @SerializeField
    public configValue: number = 10;

    public constructor(gameObject: GameObject) {
        super(gameObject);
    }

    public onStart(): void {
        // Initialize
    }

    public willRemove(): void {
        // Cleanup
    }

    protected getSourceScript(): ModuleScript {
        return script as ModuleScript;
    }
}

NetworkBehavior Template

import { NetworkBehavior } from "CORP/shared/networking/network-behavior";
import { NetworkObject } from "CORP/shared/networking/network-object";
import RequiresComponent from "CORP/shared/componentization/decorators/requires-component";
import { NetworkedVariable } from "CORP/shared/observables/networked-observables/networked-variable";
import { RPC } from "CORP/shared/networking/RPC";

@RequiresComponent(NetworkObject)
export class MyNetworkBehavior extends NetworkBehavior {
    public readonly syncedValue = new NetworkedVariable<number>(0);

    public onStart(): void {
        // Initialize
    }

    @RPC.Method({
        endpoints: [RPC.Endpoint.CLIENT_TO_SERVER],
        accessPolicy: RPC.AccessPolicy.OWNER
    })
    public myRPC(): void {
        // Server logic
    }

    public willRemove(): void {
        // Cleanup
    }

    protected getSourceScript(): ModuleScript {
        return script as ModuleScript;
    }
}

๐Ÿค Contributing

We welcome contributions! Check out the main repository for contribution guidelines.

๐Ÿ“„ License

See the main repository for license information.
Ready to build amazing games with CORP! ๐Ÿš€ Start with the Getting Started Tutorial or explore Examples to see CORP in action.