Help us shape the future of Go! Take the 2026 Go Developer Survey

worldsource

package
v0.0.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 7 Imported by: 0

README

World authoring semantics

worldsource defines typed room, prefab, port, content and material authoring semantics. It has no YAML implementation dependency: YAML tags describe field names, and Validate checks typed values. Public compilers own text parsing, presence and unknown-field checks, diagnostics, prefab expansion and convex decomposition. They must enforce compiled-world bounds again after expansion. Runtime format types have no JSON tags or custom JSON methods; source YAML vocabulary and TOML asset controls remain explicit and independently checked.

The Karty CLI generates local YAML editor schemas with karty schema. Run it from a game project to include that level's material, texture and prefab choices, or from this repository root to generate the shared base referenced by the standalone source fixture. The generated .karty/schemas directory is ignored; format validation and builds do not require the CLI or a YAML parser here.

Source version Added semantics
1 Rooms, prefabs and ordinary connections
2 Typed actors and instance tags
3 Directed and transformed connections
4 Root authored lighting
5 Material UV mapping
6 Static solids, root/prefab contents and room-free prefabs
7 Top/bottom wall bands and secondary colour textures
8 Reusable actor and material animations
9 Environment presets, sky ceilings and horizon boundaries
10 GPU sprite particle presets and transformed emitters

Versions 1–10 remain supported. Optional fields must respect their version gates; omitting new fields preserves older encodings. See the compiled world contract for output validation and lighting bounds. Root lighting remains in global coordinates and is never transformed by a prefab.

The unreleased SDK 0.0.11 candidate separates the 4,096 authored-source bound (worldsource.MaxLights) from the 50 live direct-light budget (world.MaxRuntimeLights). Offline build policy may automatically select every fixed light without a nonzero linked emission pulse; motion and pulsing sources remain runtime lights. Authoring and compiled validation accept the complete source set, while producers check the remaining live budget when packaging a world. An unbaked preview still uses the runtime limit.

Environment and outdoor geometry, source version 9

Source v9 adds an optional root environment and room/edge sky markers:

version: 9
environment:
  preset: fantasy
  palette: violet # optional; omitted means the preset's default sky
  sun: # optional; omission uses the preset direction
    azimuth: 135
    elevation: 40
rooms:
  - id: courtyard
    sky: true
    # Ordinary finite geometry and material fields remain required.

preset is daylight, space, cartoon or fantasy. palette is omitted, default, violet or twilight; it changes sky colors without changing light colors or intensity. A supplied sun requires both finite angles in degrees: azimuth [0,360) measured from +X toward +Y, and elevation [0,90] above the XY plane. Environment belongs to the root, with no prefab transform. A preset alone supplies bounded sky, sun and outdoor fill defaults.

Optional time_of_day supplies finite hours [0,24) (midnight 0, sunrise 6, noon 12, sunset 18); optional cloud_amount supplies finite coverage [0,1]. Omitted time preserves fixed sun defaults or explicit angles; providing both time and sun is rejected. Omitted clouds resolve to 0.35; explicit zero is clear. Compilers preserve pointer presence for these optional controls. The engine live setter can subsequently override the clock/clouds for every camera in a mounted world while retaining authored preset/palette choices.

Room sky: true turns its ceiling into an environment opening. The room retains its finite ceiling for spatial bounds and portal confinement. Edge sky: true turns an opaque boundary into a horizon opening, while preserving confinement; it requires a sky room and cannot be a connection or exported port endpoint, including through nested prefab ports. Ordinary walls, floors, roofs and static solids keep their physical behavior. Sky rooms in prefabs require the root environment. Outdoor rooms remain ordinary connected playable geometry.

Source v1–8 reject all environment/sky fields, including explicitly supplied environment: null and sky: false. Text parsers reject null, unknown fields, missing sun angles and bad scalar types; typed SDK validation checks the values and complete graph. Compilers preserve sky markers through expansion and convex decomposition, add the compiled version-1 environment payload and declare world/environment@1 with world/sectors@1. See the compiled decision.

Material mapping, version 1

SDK 0.0.8 provides world/material-mapping@1. Authoring source v5 supports optional root uv, room floor_uv, ceiling_uv, wall_uv, and edge uv. Source v1–4 reject those fields; omission preserves their previous encodings and compiler behavior. Source v5 defaults to triplanar mapping with world anchoring, one world unit per repeat, zero offset and zero rotation. Controls inherit field by field from root to room to edge; nil numeric pointers and empty mode/anchor strings inherit. Explicit rotation_degrees: 0 overrides an inherited rotation.

mode accepts triplanar, planar, wrap; anchor accepts world, top, bottom. scale: {x: ..., y: ...} gives positive world units per repeat in [0.001, 1,000,000]. offset is in repeats, with finite components bounded to ±1,000,000. rotation_degrees is finite and bounded to ±1,000,000. Wrap and vertical top/bottom anchors apply to walls: top uses ceiling(x,y)-z, bottom uses z-floor(x,y). Explicit floor/ceiling wrap or top/bottom anchors are invalid. Inherited root wrap falls back to planar on floors/ceilings; inherited wall anchors do not move horizontal surfaces. The compiler resolves inheritance, projection axes, scale, offset, rotation, anchoring and prefab transforms.

See compiled mapping for the resolved affine projections and capability requirements.

Solids and loose contents, version 1

Source v6 adds optional solids and contents to root documents and prefabs. Detail-only, sprite-only and nested room-free prefabs expand into existing rooms without creating sectors. Older source versions reject these fields. Omission preserves existing encoded bytes. The source solid count is at most 1,024 across root solids and prefab definitions; compilers enforce it again after expansion.

Source material names resolve through packaged textures. Nested prefab scale, yaw, translation and material overrides apply to solids and loose sprites. The compiler assigns loose contents to the first containing compiled sector in stable order, including shared boundaries and elevation. Source caps inherit horizontal root mapping defaults; source side_uv is restricted to shared planar/world X/Z mapping. Per-edge wrap and varying side triplanar weights are not expressible by a single SideUV and are rejected. Mapped solids require the existing world/material-mapping@1 marker/capability; hosts also require world/static-solids@1. No new guest command or level envelope version is added.

See compiled solids for exact geometry, material and collision bounds.

Wall bands and secondary colour, source version 7

Source v7 adds wall_bands to rooms and bands to directed authored edges. Each contains optional enabled, top and bottom. Each horizontal band accepts texture, enabled, height, repeat_width and offset: {x, y}. Textures resolve through the ordinary level texture catalog; the same texture can be reused by both bands. Enabled resolved bands require a texture and height. Repeat width defaults to 1 world unit and offset to zero. Alpha is band coverage; transparent pixels reveal the underlying opaque wall.

Rooms also supply floor_secondary, ceiling_secondary, wall_secondary, and edges may override secondary. A secondary references one opaque texture, optional enabled, strength in [0,1], and existing uv settings. Its colour modulates the main in linear space; neutral sRGB (188,188,188) preserves the main colour. It does not replace normal, height or AO channels.

All optional fields inherit field by field after prefab expansion; explicit enabled: false disables an inherited setting. Builders apply material substitution independently to top, bottom and secondary references. MergeBandSettings returns independent nested band records, preserving input values. Dimensions and repeats use world units and must be finite in [0.001,1000000]; offsets retain ±1000000 bounds. Source versions 1–6 reject these fields; omission preserves their existing serialized shape. Typed SDK validation checks versions and partial controls; public text parsers must additionally reject explicit null and unknown fields and validate the complete resolved settings and resource references.

Horizontal bands follow visible solid-span floor and ceiling profiles with fixed vertical thickness. Opposing envelopes on a short span crop at a proportional boundary, retaining requested texture density. The builder compiles the complete nonoverlapping wall partition, mappings, material IDs and coverage classes. There are no vertical-band or frame-sheet authoring fields. The source-v7 simplification revises the unreleased SDK 0.0.10 candidate; released source versions and compiled world/material-layer formats are unchanged. See the compiled contract.

Source v8 reusable animations

Source v8 adds optional top-level animations: {version: 1, presets: [...], materials: [...]} and actor.animation: {preset: name, phase_seconds: 0}. Presets are level-wide and referenced by name, including inside prefabs. Material bindings use declared texture names; flipbook frames are lists of declared texture names. The compiler resolves every frame to a nonzero level texture ID. Material bindings apply wherever the material occurs; an explicit actor binding supplies its own preset and phase. Preset coordinates stay actor-local through prefab expansion, so placement scale and orientation carry motion along with the actor.

The initial catalogue is flipbook, liquid, spin, and oscillate. See the compiled contract for parameters, bounds and timing. Source v1–v7 reject animations and retain existing wire behavior. Frames are separate complete textures, which the world material atlas packs into ordinary slots; they are not arbitrary authored atlas rectangles. Flipbook frames must have equal processed dimensions. Presets cannot be nested or reference other presets, and frame materials cannot select another material animation.

Liquid presets may also specify surface_amplitude (0–0.25 world metres), opacity (0–1, omitted means 1), and pixel_size (integer 0–32). These fields are liquid-only; explicit nulls are rejected by the source YAML adapter. Compilation owns an independent copy of an explicit opacity value.

GPU sprite particles, source version 10

Candidate SDK 0.0.11 adds root particles: {version: 1, presets: [...], emitters: [...]} and room/prefab particle_emitters arrays. Presets name level textures; emitter positions, yaw and uniform scale follow prefab transforms. Source v1–9 rejects particle fields, including explicit null. Optional fields should be omitted; text decoders also reject null inside the particle block and require explicitly authored zero-valued fields such as seed, position, curve age and burst time.

Compilers resolve all frames, require square matching frame dimensions, reserve complete birth schedule groups for overlapping lifetimes, compute conservative GPU motion bounds, and confine every emitter to one compiled convex sector. Room-local emitters remain in sectors owned by their expanded room. An emitter-only prefab is valid without unrelated geometry or marker contents. Optional scale omission or zero defaults to one; omitted vector components remain zero. They stage the separate @world/particles resource and declare world/particles@1 alongside world/sectors@1. See the version-1 particle contract for exact fields, units, lifecycle rules and resource bounds.

Documentation

Overview

Package worldsource defines the high-level, separately versioned room and prefab schema consumed by public world compilers. It intentionally has no YAML implementation dependency; tags describe the stable field vocabulary.

Index

Constants

View Source
const (
	LegacyVersion        = uint16(1)
	ActorVersion         = uint16(2)
	PortalVersion        = uint16(3)
	LightingVersion      = uint16(4)
	MappingVersion       = uint16(5)
	SolidsVersion        = uint16(6)
	MaterialsVersion     = uint16(7)
	AnimationsVersion    = uint16(8)
	EnvironmentVersion   = uint16(9)
	ParticlesVersion     = uint16(10)
	Version              = ParticlesVersion
	MaxRooms             = 1024
	MaxPrefabs           = 256
	MaxInstances         = 4096
	MaxConnections       = 8192
	MaxPorts             = 4096
	MaxEdges             = 8192
	MaxEdgesPerRoom      = 256
	MaxContents          = 4096
	MaxLights            = sdkworld.MaxLights
	MinLightRadius       = sdkworld.MinLightRadius
	MaxMaterialOverrides = 256
	MaxIdentifierBytes   = 128
	MaxTags              = 8
	MaxTagBytes          = 64
	MaxCoordinate        = 1_000_000.0
	MinEdgeLength        = 1e-6
	MinClearance         = 1e-6
)
View Source
const MinUVScale = 0.001

Variables

View Source
var (
	ErrVersion     = errors.New("world source version is unsupported")
	ErrBounds      = errors.New("world source exceeds a declared bound")
	ErrIdentity    = errors.New("world source identity is invalid")
	ErrGeometry    = errors.New("world source geometry is invalid")
	ErrReference   = errors.New("world source reference is invalid")
	ErrConnection  = errors.New("world source connection is invalid")
	ErrContent     = errors.New("world source content is invalid")
	ErrUVMapping   = errors.New("world source UV mapping is invalid")
	ErrLighting    = errors.New("world source lighting is invalid")
	ErrEnvironment = errors.New("world source environment is invalid")
	ErrPrefabCycle = errors.New("world source prefab cycle is invalid")
)

Functions

func CompileAnimationPreset added in v0.0.11

func CompileAnimationPreset(p AnimationPreset, textures map[string]uint32) (sdkworld.AnimationPreset, error)

CompileAnimationPreset converts one authored preset using the level's declared texture IDs. All frames must resolve, including frames used only in animations.

func CompileParticlePreset added in v0.0.12

func CompileParticlePreset(p ParticlePreset, textures map[string]uint32) (worldparticles.Preset, error)

CompileParticlePreset resolves every named frame, including particle-only textures. Source and runtime share complete analytical configuration validation.

func Validate

func Validate(document *Document) error

Validate checks the complete source graph without expanding prefabs or decomposing rooms. Those compiler operations retain their own post-expansion bounds and diagnostics.

func ValidateBandSettings added in v0.0.10

func ValidateBandSettings(b *BandSettings) error

func ValidateSecondarySettings added in v0.0.10

func ValidateSecondarySettings(s *SecondarySettings) error

func ValidateUVSettings added in v0.0.8

func ValidateUVSettings(settings *UVSettings) error

ValidateUVSettings checks typed authored controls without resolving inheritance.

Types

type Actor added in v0.0.6

type Actor struct {
	YawDegrees   float64           `yaml:"yaw_degrees"`
	PitchDegrees float64           `yaml:"pitch_degrees"`
	RollDegrees  float64           `yaml:"roll_degrees"`
	Scale        Vec3              `yaml:"scale"`
	Sprite       *Sprite           `yaml:"sprite,omitempty"`
	Tags         []string          `yaml:"tags,omitempty"`
	Animation    *AnimationBinding `yaml:"animation,omitempty"`
}

type AmbientCube added in v0.0.8

type AmbientCube struct {
	PositiveX Vec3 `yaml:"positive_x"`
	NegativeX Vec3 `yaml:"negative_x"`
	PositiveY Vec3 `yaml:"positive_y"`
	NegativeY Vec3 `yaml:"negative_y"`
	PositiveZ Vec3 `yaml:"positive_z"`
	NegativeZ Vec3 `yaml:"negative_z"`
}

AmbientCube supplies six world-space directional ambient colors. It replaces Ambient when present; squared unit-normal components weight each selected face. Colors are finite linear RGB intensities in [0,1].

type AnimationBinding added in v0.0.11

type AnimationBinding struct {
	Preset       string  `yaml:"preset"`
	PhaseSeconds float64 `yaml:"phase_seconds,omitempty"`
}

type AnimationPreset added in v0.0.11

type AnimationPreset struct {
	Name             string   `yaml:"name"`
	Kind             string   `yaml:"kind"`
	Frames           []string `yaml:"frames,omitempty"`
	FPS              float64  `yaml:"fps,omitempty"`
	IntervalSeconds  float64  `yaml:"interval_seconds,omitempty"`
	Flow             Vec2     `yaml:"flow,omitempty"`
	Amplitude        float64  `yaml:"amplitude,omitempty"`
	SurfaceAmplitude float64  `yaml:"surface_amplitude,omitempty"`
	Opacity          *float64 `yaml:"opacity,omitempty"`
	PixelSize        uint32   `yaml:"pixel_size,omitempty"`
	Frequency        float64  `yaml:"frequency,omitempty"`
	Speed            float64  `yaml:"speed,omitempty"`
	Axis             Vec3     `yaml:"axis,omitempty"`
	Pivot            Vec3     `yaml:"pivot,omitempty"`
	Offset           Vec3     `yaml:"offset,omitempty"`
	PeriodSeconds    float64  `yaml:"period_seconds,omitempty"`
}

type Animations added in v0.0.11

type Animations struct {
	Version   uint32              `yaml:"version"`
	Presets   []AnimationPreset   `yaml:"presets"`
	Materials []MaterialAnimation `yaml:"materials,omitempty"`
}

type BandSettings added in v0.0.10

type BandSettings struct {
	Enabled *bool                   `yaml:"enabled,omitempty"`
	Top     *HorizontalBandSettings `yaml:"top,omitempty"`
	Bottom  *HorizontalBandSettings `yaml:"bottom,omitempty"`
}

BandSettings adds optional horizontal trim textures to visible wall spans. Builders resolve texture references, coverage and UVs before packaging.

func MergeBandSettings added in v0.0.10

func MergeBandSettings(base, override *BandSettings) *BandSettings

MergeBandSettings applies non-omitted edge fields over a room default. The returned records are independent; nested pointer values remain immutable inputs.

type Connection

type Connection struct {
	ID           string          `yaml:"id"`
	A            Endpoint        `yaml:"a"`
	B            Endpoint        `yaml:"b"`
	Direction    PortalDirection `yaml:"direction,omitempty"`
	NonEuclidean bool            `yaml:"non_euclidean,omitempty"`
}

Connection links two aperture endpoints. Direction defaults to both for compatibility. Each endpoint may own one outgoing link and may be the target of any number of links. NonEuclidean permits equal-length edges at different positions or orientations.

type Content

type Content struct {
	ID       string `yaml:"id"`
	Kind     string `yaml:"kind"`
	Position Vec3   `yaml:"position"`
	Actor    *Actor `yaml:"actor,omitempty"`
}

type Document

type Document struct {
	Version     uint16       `yaml:"version"`
	Rooms       []Room       `yaml:"rooms"`
	Prefabs     []Prefab     `yaml:"prefabs"`
	Instances   []Instance   `yaml:"instances"`
	Connections []Connection `yaml:"connections"`
	// Lighting is available in source v4 and later, in global world coordinates.
	// It is not part of any room, prefab or instance transform.
	Lighting    *Lighting    `yaml:"lighting,omitempty"`
	UV          *UVSettings  `yaml:"uv,omitempty"`
	Solids      []Solid      `yaml:"solids,omitempty"`
	Contents    []Content    `yaml:"contents,omitempty"`
	Animations  *Animations  `yaml:"animations,omitempty"`
	Environment *Environment `yaml:"environment,omitempty"`
	Particles   *Particles   `yaml:"particles,omitempty"`
}

type Edge

type Edge struct {
	ID        string             `yaml:"id"`
	Start     Vec2               `yaml:"start"`
	End       Vec2               `yaml:"end"`
	Material  string             `yaml:"material"`
	UV        *UVSettings        `yaml:"uv,omitempty"`
	Bands     *BandSettings      `yaml:"bands,omitempty"`
	Secondary *SecondarySettings `yaml:"secondary,omitempty"`
	// Sky opens a finite boundary visually, while retaining player confinement.
	// It requires a sky room and cannot be a connection or port endpoint.
	Sky bool `yaml:"sky,omitempty"`
}

Edge is one named, directed CCW boundary edge.

type Endpoint

type Endpoint struct {
	Room     string `yaml:"room"`
	Edge     string `yaml:"edge"`
	Instance string `yaml:"instance"`
	Port     string `yaml:"port"`
}

Endpoint selects either a room edge in the current scope or a named port on an instance in that scope. Exactly one pair must be populated.

type Environment added in v0.0.12

type Environment struct {
	Preset      sdkworld.EnvironmentPreset  `yaml:"preset"`
	Palette     sdkworld.EnvironmentPalette `yaml:"palette,omitempty"`
	Sun         *sdkworld.EnvironmentSun    `yaml:"sun,omitempty"`
	TimeOfDay   *float64                    `yaml:"time_of_day,omitempty"`
	CloudAmount *float64                    `yaml:"cloud_amount,omitempty"`
}

Environment authors world/environment@1 in source v9 and later. A preset alone supplies sky and lighting defaults. Angles are explicit when Sun is present; omission uses the preset direction. Environment is global and never transformed by a prefab instance.

type HorizontalBandSettings added in v0.0.10

type HorizontalBandSettings struct {
	Enabled     *bool    `yaml:"enabled,omitempty"`
	Texture     string   `yaml:"texture,omitempty"`
	Height      *float64 `yaml:"height,omitempty"`
	RepeatWidth *float64 `yaml:"repeat_width,omitempty"`
	Offset      *Vec2    `yaml:"offset,omitempty"`
}

func MergeHorizontalBandSettings added in v0.0.10

func MergeHorizontalBandSettings(base, override *HorizontalBandSettings) *HorizontalBandSettings

type Instance

type Instance struct {
	ID        string             `yaml:"id"`
	Prefab    string             `yaml:"prefab"`
	Transform Transform          `yaml:"transform"`
	Materials []MaterialOverride `yaml:"materials"`
	// Tags replaces the actor tags of every content in this prefab instance.
	// An empty list preserves the prefab-authored tags.
	Tags []string `yaml:"tags,omitempty"`
}

type LightMotion added in v0.0.8

type LightMotion struct {
	Version       uint32  `yaml:"version"`
	Offset        Vec3    `yaml:"offset"`
	PeriodSeconds float64 `yaml:"period_seconds"`
}

LightMotion authors the bounded version-1 runtime light path.

type Lighting added in v0.0.8

type Lighting struct {
	Version     uint32       `yaml:"version"`
	Ambient     Vec3         `yaml:"ambient"`
	Lights      []PointLight `yaml:"lights"`
	AmbientCube *AmbientCube `yaml:"ambient_cube,omitempty"`
	Actors      bool         `yaml:"actors,omitempty"`
}

Lighting authors the world/lighting@1 payload. Version is the nested payload version (sdkworld.LightingVersion, 1), not the source document version. Ambient and Color use linear RGB intensities in [0,1]. Lights retain authored order and global positions; prefab-local lights are not supported.

type MaterialAnimation added in v0.0.11

type MaterialAnimation struct {
	Material     string  `yaml:"material"`
	Preset       string  `yaml:"preset"`
	PhaseSeconds float64 `yaml:"phase_seconds,omitempty"`
}

type MaterialOverride

type MaterialOverride struct {
	From string `yaml:"from"`
	To   string `yaml:"to"`
}

type ParticleEmitter added in v0.0.12

type ParticleEmitter struct {
	ID         string                  `yaml:"id"`
	Preset     string                  `yaml:"preset"`
	Position   Vec3                    `yaml:"position"`
	YawDegrees float64                 `yaml:"yaw_degrees,omitempty"`
	Scale      float64                 `yaml:"scale,omitempty"`
	Seed       uint32                  `yaml:"seed"`
	Playback   worldparticles.Playback `yaml:"playback"`
}

type ParticlePreset added in v0.0.12

type ParticlePreset struct {
	Name                 string                     `yaml:"name"`
	Capacity             uint32                     `yaml:"capacity"`
	Emission             worldparticles.Emission    `yaml:"emission"`
	LifetimeSeconds      worldparticles.Range       `yaml:"lifetime_seconds"`
	Spawn                ParticleSpawn              `yaml:"spawn"`
	VelocityMin          Vec3                       `yaml:"velocity_min,omitempty"`
	VelocityMax          Vec3                       `yaml:"velocity_max,omitempty"`
	Acceleration         Vec3                       `yaml:"acceleration,omitempty"`
	Drag                 float64                    `yaml:"drag,omitempty"`
	Sprite               ParticleSprite             `yaml:"sprite"`
	SizeOverLife         []worldparticles.ScalarKey `yaml:"size_over_life"`
	ColorOverLife        []worldparticles.ColorKey  `yaml:"color_over_life"`
	RotationDegrees      worldparticles.Range       `yaml:"rotation_degrees,omitempty"`
	RotationSpeedDegrees worldparticles.Range       `yaml:"rotation_speed_degrees,omitempty"`
}

type ParticleSpawn added in v0.0.12

type ParticleSpawn struct {
	Shape      string `yaml:"shape"`
	HalfExtent Vec3   `yaml:"half_extent,omitempty"`
}

type ParticleSprite added in v0.0.12

type ParticleSprite struct {
	Frames   []string `yaml:"frames"`
	FPS      float64  `yaml:"fps,omitempty"`
	Playback string   `yaml:"playback"`
	Facing   string   `yaml:"facing"`
	Blend    string   `yaml:"blend"`
}

type Particles added in v0.0.12

type Particles struct {
	Version  uint16            `yaml:"version"`
	Presets  []ParticlePreset  `yaml:"presets"`
	Emitters []ParticleEmitter `yaml:"emitters,omitempty"`
}

type Plane

type Plane struct {
	A float64 `yaml:"a"`
	B float64 `yaml:"b"`
	C float64 `yaml:"c"`
}

Plane describes elevation z=A*x+B*y+C in source coordinates.

type PointLight added in v0.0.8

type PointLight struct {
	ID       string       `yaml:"id"`
	Position Vec3         `yaml:"position"`
	Color    Vec3         `yaml:"color"`
	Radius   float64      `yaml:"radius"`
	Motion   *LightMotion `yaml:"motion,omitempty"`
}

PointLight has the same bounds and semantics as sdkworld.PointLight.

type Port

type Port struct {
	ID       string   `yaml:"id"`
	Endpoint Endpoint `yaml:"endpoint"`
}

Port exposes one otherwise unconnected prefab endpoint to its instances.

type PortalDirection added in v0.0.7

type PortalDirection string
const (
	PortalBoth PortalDirection = "both"
	PortalAToB PortalDirection = "a-to-b"
	PortalBToA PortalDirection = "b-to-a"
)

type Prefab

type Prefab struct {
	ID               string            `yaml:"id"`
	Rooms            []Room            `yaml:"rooms"`
	Instances        []Instance        `yaml:"instances"`
	Connections      []Connection      `yaml:"connections"`
	Ports            []Port            `yaml:"ports"`
	Solids           []Solid           `yaml:"solids,omitempty"`
	Contents         []Content         `yaml:"contents,omitempty"`
	ParticleEmitters []ParticleEmitter `yaml:"particle_emitters,omitempty"`
}

type Room

type Room struct {
	ID               string             `yaml:"id"`
	Boundary         []Edge             `yaml:"boundary"`
	Floor            Plane              `yaml:"floor"`
	Ceiling          Plane              `yaml:"ceiling"`
	FloorMaterial    string             `yaml:"floor_material"`
	CeilingMaterial  string             `yaml:"ceiling_material"`
	Contents         []Content          `yaml:"contents"`
	FloorUV          *UVSettings        `yaml:"floor_uv,omitempty"`
	CeilingUV        *UVSettings        `yaml:"ceiling_uv,omitempty"`
	WallUV           *UVSettings        `yaml:"wall_uv,omitempty"`
	WallBands        *BandSettings      `yaml:"wall_bands,omitempty"`
	FloorSecondary   *SecondarySettings `yaml:"floor_secondary,omitempty"`
	CeilingSecondary *SecondarySettings `yaml:"ceiling_secondary,omitempty"`
	WallSecondary    *SecondarySettings `yaml:"wall_secondary,omitempty"`
	Sky              bool               `yaml:"sky,omitempty"`
	ParticleEmitters []ParticleEmitter  `yaml:"particle_emitters,omitempty"`
}

Room may be concave. The compiler decomposes it into convex sectors after prefab expansion and connection resolution.

type SecondarySettings added in v0.0.10

type SecondarySettings struct {
	Enabled  *bool       `yaml:"enabled,omitempty"`
	Texture  string      `yaml:"texture,omitempty"`
	Strength *float64    `yaml:"strength,omitempty"`
	UV       *UVSettings `yaml:"uv,omitempty"`
}

SecondarySettings describes one colour-only detail image in source v7. Nil fields inherit room settings; Enabled=false disables the resolved layer.

type Solid added in v0.0.8

type Solid struct {
	ID             string      `yaml:"id"`
	Footprint      []Vec2      `yaml:"footprint"`
	Bottom         Plane       `yaml:"bottom"`
	Top            Plane       `yaml:"top"`
	SideMaterial   string      `yaml:"side_material"`
	TopMaterial    string      `yaml:"top_material"`
	BottomMaterial string      `yaml:"bottom_material"`
	SideUV         *UVSettings `yaml:"side_uv,omitempty"`
	TopUV          *UVSettings `yaml:"top_uv,omitempty"`
	BottomUV       *UVSettings `yaml:"bottom_uv,omitempty"`
	Collision      bool        `yaml:"collision,omitempty"`
}

Solid is an extrusion independent of room decomposition. Root records use global coordinates; prefab records receive nested instance transforms. Optional UV controls inherit root horizontal defaults for caps; sides accept only an explicit planar/world mapping in version 6.

type Sprite added in v0.0.6

type Sprite struct {
	Texture string  `yaml:"texture"`
	Facing  string  `yaml:"facing"`
	Alpha   string  `yaml:"alpha"`
	Width   float64 `yaml:"width"`
	Height  float64 `yaml:"height"`
	OriginX float64 `yaml:"origin_x"`
	OriginY float64 `yaml:"origin_y"`
}

type Transform

type Transform struct {
	Translation Vec3    `yaml:"translation"`
	YawDegrees  float64 `yaml:"yaw_degrees"`
	Scale       float64 `yaml:"scale"`
}

Transform applies uniform scale, Z-axis yaw in degrees and translation. Scale zero means the schema default of one.

type UVAnchor added in v0.0.8

type UVAnchor string
const (
	UVWorld  UVAnchor = "world"
	UVTop    UVAnchor = "top"
	UVBottom UVAnchor = "bottom"
)

type UVMode added in v0.0.8

type UVMode string
const (
	UVTriplanar UVMode = "triplanar"
	UVPlanar    UVMode = "planar"
	UVWrap      UVMode = "wrap"
)

type UVSettings added in v0.0.8

type UVSettings struct {
	Mode            UVMode   `yaml:"mode,omitempty"`
	Anchor          UVAnchor `yaml:"anchor,omitempty"`
	Scale           *Vec2    `yaml:"scale,omitempty"`
	Offset          *Vec2    `yaml:"offset,omitempty"`
	RotationDegrees *float64 `yaml:"rotation_degrees,omitempty"`
}

UVSettings contains editor/compiler projection controls available in source v5. Empty Mode/Anchor and nil numeric fields inherit root -> room -> edge. Defaults are triplanar/world, scale (1,1), offset (0,0), rotation 0 degrees. Scale uses world units per repeat; Offset uses texture repeats. Rotation's pointer preserves an explicit zero override. Hosts receive only baked planes.

type Vec2

type Vec2 struct {
	X float64 `yaml:"x"`
	Y float64 `yaml:"y"`
}

type Vec3

type Vec3 struct {
	X float64 `yaml:"x"`
	Y float64 `yaml:"y"`
	Z float64 `yaml:"z"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL