Reference

Scene file format (.tgscene)

The complete text format of a Trisgine scene, with the rules the parser actually enforces.

tgscene
configs:
	-ConfigName:param1,param2
ui:
	-<uidoc uuid>
update:
	-SystemName
input:
	-SystemName
render:
	-SystemName
entities:
	-EntityName:
		-ComponentName:value1,value2,value3
		-TagName

Syntax rules

  • Indentation is tabs. One tab before items of a block, two tabs before an entity's components.
  • Each item starts with -. A value list follows : and is comma-separated with no spaces. There's no trimming, no quoting and no escaping, except %2C for a literal comma in PostProcess.
  • A line without : is a tag (no value), for example -PlayerTag.
  • # lines are comments. They are dropped when the editor saves the scene.
  • Assets are referenced by 16-hex-digit UUID (from the asset's .mt sidecar), except scripts, which are referenced by path (-Script:Assets/Scripts/X.tgscript).
  • Entity names must be unique, and can't contain : , # or start with - (save skips such entities).
  • An unknown name, or the wrong number of values, logs a warning once and is otherwise ignored.

Blocks

BlockHolds
configs:scene-wide settings: Physics2D, AudioConfiguration, PostProcess, Msaa, Fog, Script (a default script), voxel terrain settings, …
ui:UUIDs of .uidoc canvases to load
uiscripts:-ElementName:Assets/Scripts/X.tgscript for UI elements
update:systems run every frame, in this order
input:input systems (e.g. FreeLookCamera)
render:rendering systems, in order
entities:the entities

Ordering that matters

  • DistanceToPlayerSquare before ScriptRun (otherwise scripts see a distance of 0 on the first frame).
  • ScriptRun before WorldMatrix.
  • AudioSystem after MoveByVelocity.
  • Sprite2DRendering after the sky systems.
  • ImpactAudio2D after Physics2DStep. Don't list Physics2DStep together with the older ApplyGravity2D / Collide2D / Integrate2D set.

3D template (first-person)

tgscene
configs:
update:
	-MoveByVelocity
	-RotateByAngularVelocity
	-DistanceToPlayerSquare
	-ScriptRun
	-WorldMatrix
input:
	-FreeLookCamera
render:
	-ViewMatrix
	-ShadowRendering
	-SortedSubmissionRendering
	-SkyboxRendering
entities:
	-Player:
		-PerspectiveCamera:60
		-Position:0,1.6,-10
		-Rotation:0
		-Rotation2D:0,0
		-Color:0.45,0.65,0.9
		-PlayerTag
		-PlayerInputTag
	-Sun:
		-DirectionalLight:0.472,-0.595,0.65
		-LightColor:1
	-Floor:
		-Material:EAF81A2663BA92E,7A11C0DE00000001
		-Primitive:Cube,20,0.2,20
		-Position:0,-0.1,0
		-Rotation:0
		-Scale:1

2D template

tgscene
configs:
	-Physics2D:0,-9.81,0.0041667,8
update:
	-MoveByVelocity2D
	-Physics2DStep
	-Sprite2DFlipbook
input:
render:
	-Sprite2DRendering
entities:
	-Camera2DMain:
		-Camera2D:18
		-Position2D:0,0
	-Floor:
		-Sprite:<textureUuid>
		-Position2D:0,-8
		-Scale2D:14,1
		-Collider2D:box,7,0.5
	-Ball:
		-Sprite:<textureUuid>
		-Position2D:0,3
		-Velocity2D:1,0
		-Collider2D:circle,0.5
		-PhysicsBody2D:1,0,0

Every component line is listed in the component reference, and every system in the system reference.