Exterior Space

Trace System [Draft]

Dynamics of the space

Todo

This page is not the final version.

The trace system is defined as a two-fold data structure:

  • state is required and records the current condition of a space
  • history is optional and preserves past events
interface Trace {
    history?: Story[] //optional
    state: Mark[] //required
}

History

The history records a list of Story entries with the following data structure:

interface Story {
    time: number        // required, when the action happened
    subject: string     // required, the entity that performed the action
    verb: Interaction   // required, the action performed
    object: string      // optional, the entity that received the action
    extra: unknown      // optional
}

Each entry describes that at time, the subject performed the verb on the object, and extra is used to store any additional information.

Without the Interaction system, verb is a Boolean value: true for visiting and false for leaving, and object can only be the address of the space.

In Exterior Space, time uses a timestamp in milliseconds since January 1, 1970 UTC, consistent with the result of Date.now() in TypeScript. Both subject and object are addresses of users or assets, and verb corresponds to interaction functions defined in the Interaction system.

State

A state is a list of Mark entries with the following data structure:

interface Mark {
    entity: number   // required, the entity that has a state
    phase: Enum      // required, the state
    extra: unknown   // optional
}

Each entry describes that entity has a state defined by phase, and extra is used to store any additional information.

phase is an Enum object that uses numbers to represent different states. These states can be processed as input or output by interaction functions. If the Interaction system is not used, the implementation is required to process the built-in phase states directly.

In Exterior Space, entity is the address of a user or an asset, and phase is an enum value. Exterior Space does not use extra for Trace state.

Run-time Trace: Subtrace Module

Subtrace is a Trace object that stores run-time trace data in the implementation. It is used to separate long-term history and state information from short-term history and state information.

For example, recording the on/off state of a lamp or a record player (for background music setting) can be handled directly by the trace system. However, recording the run-time state of a mini-game inside a space is typically more suitable for the subtrace module, especially when the cost of frequently updating the main Trace object is considerable.

Exterior Space uses the subtract module, and extra is used in the state for the subtract module.

On this page