Skip to main content

Overview

Frostbite uses specialized reference types to point to different kinds of assets and resources. These lightweight structures provide type-safe ways to reference resources, files, and type definitions.

ResourceRef

Represents a reference to a resource by its unique 64-bit identifier.

Structure

Properties

ResourceRef
Static instance representing a null/zero resource reference

Constructor

ulong
required
The 64-bit resource identifier

Implicit Conversions

ResourceRef supports seamless conversion to and from ulong.

Methods

Equals

Compares resource references for equality. Supports comparison with both ResourceRef and ulong types.

GetHashCode

Generates hash code using FNV-1a algorithm.

ToString

Returns the resource ID as a hexadecimal string.
Example:

Operators

Usage Example


FileRef

Represents a reference to a file path within the Frostbite virtual file system.

Structure

Constructor

string
required
The file path string

Implicit Conversions

FileRef supports seamless conversion to and from string.

Methods

ToString

Returns a formatted string with the file path.
Example:

Usage Example


TypeRef

Represents a reference to a type definition, identified by either name or GUID.

Structure

Properties

string
The name of the referenced type
Guid
The GUID of the referenced type

Constructors

TypeRef()

Creates an empty type reference.

TypeRef(string)

Creates a type reference from a type name.
string
required
The name of the type

TypeRef(Guid)

Creates a type reference from a type GUID and looks up the name.
Guid
required
The GUID of the type

Implicit Conversions

Methods

IsNull

Checks if the type reference is empty.
Returns: true if the type name is null or empty.

ToString

Returns a formatted string with the type name.
Example:

Usage Examples

Type Filtering

Type Validation

Working with TypeLibrary

Comparison Table

Best Practices

ResourceRef

  • Use ResourceRef.Zero to check for null/invalid references
  • Store as hex strings when serializing to text formats
  • Resource IDs are game-specific and not portable between titles

FileRef

  • File paths are relative to the game’s virtual file system
  • Use forward slashes for path separators
  • Paths are case-insensitive on most platforms

TypeRef

  • Use GUID-based constructors when working with serialized data
  • Use name-based constructors for runtime type lookups
  • Always check IsNull() before using the reference
  • TypeLibrary must be initialized before GUID lookups work