Skip to main content

GraphObject & GraphInstance

This page explains the GraphObject and GraphInstance concepts in Master Combat Core Framework, and how they work together at edit-time and runtime.


What is a GraphObject?

A GraphObject* is a design-time asset that defines combat logic using nodes.

Think of a GraphObject as a blueprint:

  • It contains nodes, connections, and configuration
  • It does not execute logic by itself
  • It is reusable across multiple situations

Typical Graph useage include:

  • Damage Graphs
  • Buff / Debuff Graphs
  • Attribute Modification Graphs
  • Conditional Logic Graphs

A Graph answers the question:

“What should happen?”


What is a GraphInstance?

A GraphInstance is the runtime execution of a GraphObject, which:

  • Holds runtime state
  • Resolves dynamic entities (Dealer, Target, Instance)
  • Evaluates conditions
  • Executes actions
  • Manages temporary data

A GraphInstance answers the question:

“What is happening right now?”


GraphObject vs GraphInstance

ConceptGraphObjectGraphInstance
LifetimeAsset (persistent)Runtime (temporary)
EditableYes (Editor)No
StateNoneFull runtime state
Entity BindingNoYes
ExecutionNoYes

You can think of it like this:

GraphObject = Class
GraphInstance = Object


How a GraphInstance Works

Internally, the instance:

  1. Manage all GraphObject across projects as shared assets.
  2. Create small runtime data for each instance.
  3. Run the runtime data through shared GraphObject and get results.

During the process:

  • Minimal memory is taken.
  • Zero GC allocation.
  • Cache nodes result per instance, skip repeat calculation.
  • Minimal Dictionary look up, create direct referencing on initialization.
  • Cache Entity/Attribute/OverTimeEffect referencing.

Entity Resolution in GraphInstance

GraphInstance resolve entity references at runtime.

Supported entity sources:

  • Player
  • Dealer
  • Target
  • Specified UID
  • Instance Entity

This allows the same Graph to be reused for:

  • Player attacks
  • Enemy attacks
  • Projectiles
  • Temporary combat objects

Example:

instance.SetDealerEntity(attackerEntity);
instance.SetTargetEntity(victimEntity);

Instance Entity

Each GraphInstance can own a temporary Instance Entity.

This is useful for:

  • Projectiles
  • Traps
  • Missiles
  • Temporary buffs
  • Runtime attribute storage

The Instance Entity:

  • Exists only during the GraphInstance lifetime
  • Can hold attributes
  • Can be modified by graph logic
  • Is automatically cleaned up

Why This Separation Matters

Separating GraphObject and GraphInstance gives you:

  • High performance
  • Zero runtime asset mutation
  • Safe parallel executions
  • Fully data-driven combat logic
  • Massive reusability

One GraphObject can be executed hundreds of times per frame, each with its own isolated GraphInstance.