1 character gameplay state json store
forgejo-actions edited this page 2026-07-11 12:38:13 +00:00

Character Gameplay State JSON Store

The character gameplay state store persists authoritative gameplay progress that does not belong in the normalized inventory, currency, equipment, appearance, or location tables.

How It Works

The login database owns the character_gameplay_state table. Game-server gameplay authority loads and saves AuthoritativeGameplayState as JSONB through the persistence store. Missing rows, NULL, and empty JSON are treated as default gameplay state so older characters can activate safely.

Transactional saves are available when gameplay state must commit with related economy or command effects.

How To Use It

Store quest progress, dialogue state, and gameplay flags here when the data is naturally part of the authoritative gameplay state object. Use dedicated tables for inventory grants, currency, equipment, appearance, and other systems with their own idempotency or query requirements.

When a command changes gameplay state and durable side effects, save state in the same transaction as those side effects.

Invariants

New JSON fields must be backward compatible with older rows. Defaults must preserve old character behavior. Decode failures should surface as persistence errors, not silent resets. Transactional writes should be used when duplicate requests could otherwise split state from rewards.

Debugging

If progress disappears after reconnect, inspect the JSONB row, decode errors, and the command audit outcome. If state changed but rewards did not, check whether the save path bypassed the transactional write used by economy or command replay.