Skip to main content
Reading time: ~35 minutes
This guide covers advanced features and patterns in CORP for experienced developers.

Table of Contents

Spawn Management

The SpawnManager handles NetworkObject and NetworkBehavior spawning and synchronization.

Understanding Spawn Lifecycle

When a NetworkObject is added to a GameObject on the server:
  1. addComponent(NetworkObject) is called
  2. NetworkObject automatically spawns and generates a unique network ID
  3. GameObject is replicated to all clients
  4. All NetworkBehaviors are registered
  5. Clients reconstruct the GameObject and components
  6. onStart() is called on both server and clients
Note: You don’t need to manually call spawn() - NetworkObjects spawn automatically when added with addComponent(). Manual spawn() is only needed when using the low-level addComponentNoInit() method.

Working with SpawnManager

Dynamic Spawning Patterns

Spawn on Demand

Object Pooling

Observable System

CORP uses an observable system for networked state management.

NetworkedObservable Base Class

All networked collections inherit from NetworkedObservable:

Linking NetworkBehaviors

NetworkedVariables can reference NetworkBehaviors:

Custom Observable Events

Create custom events for observables:

Signals

CORP uses a powerful Signal system for event-driven programming. Signals provide type-safe, memory-efficient event handling.

Basic Signal Usage

Connecting to Signals

One-Time Connections

Custom Signals

Custom Serialization

Extending Behavior Serialization

Override serialization methods for custom types:

Scene Serialization Hooks

Performance Optimization

Batched Network Updates

Use batched replication (the default) for frequently changing values:
Note: BATCHED is the default replication behavior. It groups updates and sends them on HeartBeat for efficiency. Only use INSTANTANEOUS for critical updates that must be sent immediately.

Execution Order Optimization

Control component initialization order:

Lazy Component Initialization

Defer expensive initialization:

Advanced Networking Patterns

Request-Response Pattern

Broadcast Pattern

Ownership Transfer Pattern

Transfer ownership of NetworkObjects between players:
Note: The term “ownership” is used for NetworkObject ownership. “Authority” is reserved for the Unreal system’s authority model (client vs server authority).

Performance Namespace

CORP includes a Performance namespace with utilities for monitoring and optimization.

Using Performance Utilities

Debugging and Logging

Debug Utilities

CORP includes a debug system with log groups:

Network Debug Logging

Performance Profiling

Best Practices Summary

1. Use Appropriate Replication

  • Batched for frequent updates (position, rotation)
  • Instantaneous only for critical, infrequent updates

2. Optimize Component Lifecycle

  • Use executionOrder for dependencies
  • Defer expensive initialization
  • Clean up resources in willRemove()

3. Design for Network Authority

  • Server validates all inputs
  • Clients predict locally
  • Server corrects client state when needed

4. Pool Network Objects

  • Pre-spawn frequently used objects
  • Reuse instead of destroying
  • Reduces network overhead

5. Profile and Debug

  • Use log groups for debugging
  • Profile expensive operations
  • Monitor network bandwidth

Next Steps


Master advanced CORP features to build sophisticated games! 🎯