Scripting Basics
π Introducing T# (T-Sharp)
π οΈ What is T#?
T# is a custom programming language built for Terra Studio. At its core, T# is an interpreted language, meaning code is read and executed directly at runtime without needing a traditional compilation step.
π‘ Why an Interpreter?
We designed T# to be interpreted because:
Fast Development Cycles: Developers can instantly test and modify their code without waiting for builds or compilation.
Maximum Flexibility: Code can be changed, extended, or scripted dynamically inside Terra Studio environments.
Better for Creativity: Games, prototypes, and experiences can be tweaked and tuned live, unlocking faster iteration and experimentation.
Using an interpreter helps developers stay in the flow β write code, run it immediately, and see results without friction.
βοΈ How Does T# Work Under the Hood?
Hereβs a high-level overview of what happens when you run T# code:
Parsing The interpreter reads the T# source code line-by-line, breaking it into meaningful chunks like variables, functions, and classes.
Syntax Validation It checks the code structure to ensure it follows T#'s (C#-like) rules. If something's wrong (like a missing semicolon), it immediately throws an error.
Execution Once parsed and validated, each line or block of code is executed right away. Thereβs no intermediate
.exe
or separate build phase.Runtime Management The interpreter keeps track of variables, objects, and their states dynamically in memory while the application is running.
π Familiar to Unity C# Developers
T# is designed with Unity developers in mind. If you've written MonoBehaviour scripts or managed game states in Unity, picking up T# will feel second nature. Many of the core concepts translate directly.
Here are a few examples to show how T# mimics Unity C#:
β State Pattern (Unity-style):
In Unity C#, a common way to handle player behavior is using states:
T# Equivalent In T#, you'd define a state in a similar way using classes and method overrides β no need to learn a new paradigm.
β Unity Input + Game Logic:
In Unity C#:
T# Equivalent
T# keeps the logic syntax clean and nearly identical, just trimming some of the boilerplate.
With T#, Unity devs can leverage their existing skills while building inside Terra Studio β write your scripts, hook into game events, and keep the same coding rhythm you're used to. π
Last updated