← Back to Docs

Unreal Engine Integration

Add Compuon to your Unreal Engine project. Native wrappers link the Compuon core into your game binary.

Installation

Copy the Compuon core into your game module's ThirdParty directory:

Source/YourGame/ThirdParty/compuon-core/
  include/
    compuon/
      compuon.h
      CompuonTypes.h        // FCompuonInt, FCompuonFloat, UCompuonSubsystem
  lib/
    Win64/
      compuon.lib

Add to your Build.cs:

string CompuonPath = Path.Combine(ModuleDirectory, "ThirdParty", "compuon-core");
PublicIncludePaths.Add(Path.Combine(CompuonPath, "include"));
PublicDefinitions.Add("COMPUON_STATIC");
PublicAdditionalLibraries.Add(Path.Combine(CompuonPath, "lib", "Win64", "compuon.lib"));

Compuon Types

Compuon provides Unreal-friendly wrappers around Compuon<T>:

#include "CompuonTypes.h"

// Integer values (health, ammo, score, gold)
FCompuonInt Health = FCompuonInt::Make(100);
FCompuonInt Ammo = FCompuonInt::Make(30);
FCompuonInt Score = FCompuonInt::Make(0);

// Float values (speed, position components)
FCompuonFloat MoveSpeed = FCompuonFloat::Make(600.0f);
FCompuonFloat JumpHeight = FCompuonFloat::Make(420.0f);
FCompuonInt DamageTaken = FCompuonInt::Make(12);

Health -= DamageTaken;             // Tier 0: ~200ns
Ammo -= FCompuonInt::Make(1);      // Tier 0: ~200ns
Score.ScalarMul(2);                // Tier 0: ~200ns

bool bDead = Health <= FCompuonInt::Make(0);

UCompuonSubsystem

The subsystem initializes with the game module. It handles:

  • + Automatic initialization on module start
  • + frame_tick() called every frame
  • + WebSocket connection to the integrity server
  • + Key rotation sync (automatic)
  • + Spot-check response handling
// Usually no manual access is needed.
UCompuonSubsystem* Compuon =
    GetWorld()->GetSubsystem<UCompuonSubsystem>();

// The subsystem forwards compuon_frame_tick() every frame.
check(Compuon != nullptr);

Example: Protected PlayerState

// MyPlayerState.h
#pragma once
#include "CompuonTypes.h"
#include "GameFramework/PlayerState.h"
#include "MyPlayerState.generated.h"

UCLASS()
class AMyPlayerState : public APlayerState
{
    GENERATED_BODY()
public:
    FCompuonInt Health = FCompuonInt::Make(100);
    FCompuonInt Armor = FCompuonInt::Make(0);
    FCompuonInt Ammo = FCompuonInt::Make(30);
    FCompuonFloat MoveSpeed = FCompuonFloat::Make(600.0f);

    void TakeDamage(int32 RawDamage)
    {
        const int32 AbsorbedValue = FMath::Min(Armor.Val(), RawDamage);
        const FCompuonInt Absorbed = FCompuonInt::Make(AbsorbedValue);

        Armor -= Absorbed;
        Health -= FCompuonInt::Make(RawDamage - AbsorbedValue);

        if (Health <= FCompuonInt::Make(0)) Die();
    }
};

Blueprint Considerations

Compuon is C++ only by design. Compuon types should not be exposed to Blueprints, as Blueprint variables are trivially inspectable in memory. Keep protected variables in C++ classes and expose only derived/display values to BP via getter functions.

// Expose read-only display value to Blueprints:
UFUNCTION(BlueprintPure, Category = "Stats")
int32 GetHealthDisplay() const
{
    return Health.Val();
}

// Keep the actual FCompuonInt in C++ only.

Build & Shipping

Compuon compiles inline into your game binary. In a shipping build:

  • + No separate DLL — everything is in the game executable
  • + No export symbols — functions are inlined
  • + Internals are unique per build (automatic)
  • + Compuon-related strings are stripped from the binary