Currency

The Currency System provides a value-type hierarchy for representing in-game monetary values. The abstract Currency record defines core value storage and arithmetic, while concrete implementations like Coin add denomination-specific logic (gold/silver/copper).

Architecture

spinner

Data Flow

spinner

Key Concepts

Concept
Description

Currency

Abstract record storing a single int value. Base class for all currency types.

Coin

Concrete record decomposing the int into gold (10000), silver (100), copper (1) denominations.

CoinDrawer

Odin editor drawer rendering Coin as three inline int fields with colored coin icons.

Denomination Table

Denomination
Multiplier
Example

Gold

10,000

2g = 20,000

Silver

100

50s = 5,000

Copper

1

75c = 75

Example: 2g 50s 75c = 2 * 10000 + 50 * 100 + 75 = 25,075

Quick Start

Creating Coin Values

Modifying Values

Classes

Class
Description

Abstract base record for all currency types

Gold/silver/copper denomination implementation

Odin Inspector drawer for Coin fields

Last updated