Position

Position represents the location of an object within a universe.

An object can reside in one of the following categories:

  • Void: The object exists in void space.
  • Space: The object is located within a specified space.
  • Object: The object is in relation to another object.
  • World: The object has entered a world.
  • Outer-verse: The object has jumped outside the current universe.

These categories are called domains, and further specific locations within a domain are referred to as coordinates.

Representation

The Position structure is defined as follows:

#![allow(unused)]
fn main() {
pub struct Position {
    domain: u64,
    coord: u64,
}
}

Field Descriptions

  • domain: A 64-bit identifier representing a domain. It is constructed from a category (u8) and an index (u56), where domain_id = u64(domain_cat) << 56 | u64(domain_idx).
  • coord: A 64-bit value representing the specific coordinates within the domain.

Encoding

The Position structure can be encoded into a u128:

#![allow(unused)]
fn main() {
(u128(position.domain) << 64) | u128(position.coord)
}

Written Format

A Position is typically written as ([domain_cat]domain_idx, coord). If the coord is zero, it can be omitted.

  • domain_cat: A lowercase letter representing the domain category:
    • 'b' for space or void,
    • 's' for object,
    • 'w' for world,
    • 'u' for outer-verse.
    • The letter 'b' can be omitted.
  • domain_idx: The decimal value of the domain index.
  • coord: Can be represented in decimal, hexadecimal, or as colon-separated values.

Examples:

  • (0,): The object is in the void.
  • (100, x:y): The object is in space 100, at coordinates (x,y).
  • (s17, 1): The object is related to object 17 at coordinate 1.
  • (w17,): The object is in world 17.
  • (u8453,): The object is in universe 8453, the Base universe.