---
title: Visual scripting
description: "Make a Tide game without writing code: a board of cards for the
  game's data and frames of nodes for what it does, in Unity, VS Code and
  JetBrains IDEs. A graph is Tide source, built with the game's .tide files, and
  any .tide file can become one."
source_url: https://tide-engine.dev/tools/visual-scripting
source_file: docs/tools/visual-scripting.md
source_revision: d46b7bc81b49e31e268bd62d158c040ec1c9ff21
source_worktree: modified
documentation_sha256: cff5cc1f43e9cab7c438614cde0e25d6b097b0171d16e0bfbecd7198624f4f9d
documentation_scope: Website source checkout; not matched to an installed Tide
  release. Check tide version and the project toolchain.
---

<a id="visual-scripting"></a>

# Visual scripting

A game's code can be graphs instead of text. A graph is a `.tidegraph` file, and the graph editor shows it as one board: a card for each piece of data (a component, an event, a constant) and a frame of nodes for each piece of code (a system, a function, an event handler). It is Tide, compiled as Tide is: the same networking, prediction and determinism, the same speed, on every platform. A game can be all graphs, all text, or both, and each uses what the other declares.

To try it without installing anything, open the [graph playground](https://tide-engine.dev/guide/graph-playground.md): a small game made with graphs only, which you edit and play in your browser.

<a id="making-a-graph"></a>

## Making a graph

In Unity, with Tide's package:

- **Assets > Create > Tide > Graph** makes an empty one. Double-click it to open the graph editor.
- **Assets > Convert to Tide Graph** on a `.tide` file makes a graph of it, beside it: the same declarations and code, with its comments, laid out to read.

In VS Code and JetBrains IDEs, with Tide's extension or plugin ([Editors](https://tide-engine.dev/tools/editors.md)):

- A new file named `something.tidegraph` opens as an empty board.
- **Convert to Tide Graph** on a `.tide` file, in the file tree or the editor's menu, makes a graph of it and opens it. It asks whether the `.tide` file goes.

From the command line, `tide graph` does the same:

```sh
tide graph enemy.tide --replace    # enemy.tide becomes enemy.tidegraph
tide graph --text enemy.tidegraph  # the Tide a graph stands for
```

Without `--replace` the game has both files, which declare the same things twice: remove one.

<a id="starting"></a>

## Starting

An empty board asks **What do you want to make?** and offers the usual first things, each with what it is for: a component, an event, a function, a system, an event handler. **More…** has the rest.

Later, **+ Add**, or a right click on an empty part of the board, opens the same choices as a menu with a search box: **Data** (what the game keeps), **Behaviour** (what the game does) and **More**. Type a few letters and press Enter to take the first match. What you add appears where you asked, or as near it as there's room (nothing is put on top of anything), with its name being typed.

The board has two panels, as Unreal's Blueprint editor does. **My game**, on the left, lists the file's declarations by group, with a **+** on each group to add one. **Details**, on the right, shows what's selected: its name, type and starting value, its options as ticks with what each does written under it, **Advanced** (closed) for the rest, and its note. With nothing selected it has the file's own: its namespace and the namespaces it uses. Each panel closes with its **×** and opens from the toolbar, and stays as you left it. On a phone they open as sheets over the board.

<a id="moving-renaming-and-the-menu"></a>

## Moving, renaming and the menu

- **Drag anything to move it**: a card, a frame or a node, by its title, its name, its kind or the room between its rows; only its controls (a type, a value, a button) don't move it. A frame's nodes stay in it, and it grows to hold them. A move is undone like any change.
- **Drag on an empty part of the board** to select with a box (inside a frame, its nodes); Shift or Ctrl adds to what's selected. What's selected moves, copies and deletes together.
- **Double-click a name to rename it**, or press F2: a card's, a frame's, a field's, a parameter's, a local's. Renaming a declaration renames what the file says of it by that name (a field's type, a system's need, a call); renaming a parameter renames its reads.
- **A right click on anything, and its "…", open the same menu**, in the same order everywhere: what can be added to it (**Add a field**, **Add a node…**), **Rename**, then **Cut**, **Copy**, **Paste**, **Duplicate** and **Delete** with their keys, and **Note…**. Options and attributes are in Details, not menus.

<a id="cards-the-game-s-data"></a>

## Cards: the game's data

A component, a singleton, a struct, an event, an enum, an input, a scene, a constant, an asset and the game's settings are cards. A card is edited where it's drawn:

- **Its name**, at the top. A new card's name is typed as it's made: press Enter to go on to its first field.
- **A row for each field**: its name, its type, the value it starts with. Enter in a row's name goes to the next one, and makes it after the last; the **+** on the card's title does the same. An enum's rows are its choices. The settings' **+** offers the engine's settings that aren't set yet, each saying what it does; its value is typed in the control its type has (a number, text, a tick box, a scene picked from the file's).
- **Its menu** adds what else its kind can have, and nothing more: a method or a property on a component, an operator on a struct only, `Sample` on an input only. Its options (**Dev builds only**, **This machine only**), **Generic over** where a kind can be generic, its attributes and its place in the file are in Details.

A member with code of its own, a method or an input's `Sample`, is a frame on the board named for its type (`Ball.Bounce`); its row on the card goes to it.

<a id="picking-a-type"></a>

### Picking a type

A type is never typed free. Click a type (or type a letter on it) to open the type picker: a list with a search box that narrows as you type, with the common types first, then this file's and the rest of the game's own, then the ways to make a type of others (**List of…** asks what it holds, with the same picker; a generic type of the engine's is made the same way, **Asset of…**), then the engine's. Enter takes the first match. The picker asks Tide which types go there, so a field isn't offered a component, and a system's needs aren't offered an enum.

<a id="values"></a>

### Values

A value is edited by its type's own control: a number, a tick box, text, a vector's numbers, a colour, an enum's choices (the enum can be declared in any of the game's files). An empty control shows the type's default, greyed. To work a value out instead (`GRAVITY * 2`), press the small **ƒ** on its row, or **Work it out…** in Details: the value opens as a small graph beside its card, whose last node is where its value is wired in. **Done** closes it.

<a id="frames-what-the-game-does"></a>

## Frames: what the game does

A system, a view, an event handler, a command, a function and a type's method are frames: a titled box that holds the code's nodes and the wires between them. Drag its title to move it with everything in it; it grows around its nodes. Its menu adds a node, a note box or what it needs; Details tidies its nodes.

A frame grows around its nodes and never covers anything: a card or frame in its way moves aside, in the same edit.

A frame's first node is its **entry**. It says when the code runs, in the kind's own words (**Every tick, for each entity with** for a system, **When this happens** for an event handler, **Takes** for a function), and has a row for each thing the code takes. A system or a view that takes no component runs once a tick or a frame, not for each entity, and says so: **Every tick**, or **Every frame, with** its singletons.

- **+ needs…** adds one by picking what: a component of the game, a singleton, a filter (**only with**, **without**). A component or a singleton dragged out of My game onto the frame does the same.
- How it's taken is a word on its row: **reads** or **changes**. Click it to change it.
- An event handler's first row picks its event; a command's rows are the values a player sends with it; a function's last row is its result's type.
- Each row has a **pin** on its right, and the entry has an **arrow** at its top right.

A shader is a frame too: a **vert** runs for each vertex of a mesh and a **frag** for each pixel. Its **+ input…** offers the file's structs and singletons and no filters. A vert's first input is the vertex it runs on, taken as **changes** and called `vertex`. A frag's picker also has **What it makes**: **Color**, the pixel's colour (`out Color color`), or something else it makes. Its code is nodes like any other's: `color` is Set from **Color(r, g, b)**, whose parts are each worked out. A draw takes shaders by name: **Draw.Mesh**'s **+** adds an input that offers the file's verts and frags (**Draw.Blit** and **GPU.Run** the same).

<a id="nodes"></a>

### Nodes

The code is nodes, as in Unreal's Blueprint. A node says what it does (**Set** `score`, **If**, **Bounce**, **Multiply**) and has a row for each of its inputs:

- **Drag from the entry's arrow** and let go inside the frame (or just right of it or under it: the frame grows to what you add) to add what happens first: the search offers the statements (**Set**, a call, **If**, the loops, **Return**). A method of what the code has is found by its name: `Add` finds `ribbon.vertices.Add(item)`, with Gets of `ribbon.vertices` wired in. A **For**'s **first** declares what its condition, **after each** and **do** read: `i` in `i <= 48`, changed by `i++` after each. An engine function is found by its own name: `Circle` finds `Draw.Circle`, `Euler` finds `quaternion.Euler`. A call that holds code (`GUILayout.Vertical`) comes with a place for it, and one that's called with a type of its own (`Json.Read`) asks which. Only what does something is offered as a step: a value made (`float3(…)`, `Math.Abs`) is offered where a value goes. Each call's row says what it does under its name and what it gives on its right; its whole signature and description show when the pointer is over it. Each statement has an arrow of its own to drag what happens next from, and those that hold code (an **If**'s branches, a loop's body) have an arrow for each.
- **What never changes is in its input.** A number, a tick or text is typed there, a vector made of numbers has a box for each, and a colour has its swatch. An input that takes a vector offers one to make in its list (`float3(…)`, its numbers then typed in its boxes); the search's **float3(…)** makes one as a node of its own, to wire where it's wanted. A type, a namespace, an enum's choice or a constant is a name in the input (`Math.PI`, `Phase.Running`); an enum's choice is picked from its choices. `this` reads **self**.
- **A variable is a Get node**: a parameter, a local or a field of one. A Get is small, with no title: the variable's name and its pin, in its type's colour. A field's Get has a **Target** pin on its left, wired from what it's a field of (`ball` → `position` → `x`). One Get's pin can be wired to any number of inputs: drag from it again for another wire. With the pointer over a Get, where its variable comes from lights up (its row on the entry, or its Local), and its other Gets.
- **Click an input**, or the **pick…** of an empty one, to choose what goes in it. The list has a search box and offers what fits there: a value to type, what this code has, the game's constants and functions, and **Work it out…**. Enter takes the first match. The list's title says what the input takes: a type, one of a few (an engine function that takes any vector), or the kind of the game's declarations it takes (**Spawn**'s components, **Send**'s event). Typing finds more by name: a function of the engine's (`Abs` finds `Math.Abs`), a constant of the type that goes there (`red` finds `Color.red`), an operator (`Greater` finds **Greater than**, for an input that takes a yes or no). What doesn't fit is left out; **Show what doesn't fit too**, at the end, lists it. Something this code has is put there as Gets, left of the input and wired to it.
- **What the code has opens to its fields**: click its arrow, press the right arrow key, or type a dot after its name (`wobble.`).
- **What's worked out is a node, wired in.** **Work it out…** has the operators (**Multiply**, **Less than**) and the calls. The new node goes left of the input it's for, at its height, so what's worked out reads from left to right as the code does (`body.position.x`, then **Math.Abs**, then **Greater than**, then **If**), with a wire from its value, and what was in the input becomes its first input. Its own inputs are picked the same way. A method is called on its **Target**, wired in; a call on a type or a namespace says it under its name (**Clamp**, with **Math** beneath).
- **Pins are always there**: every input has one on its left, hollow while it's empty and filled once something is in it, and every value has one on its right. **Drag from a pin** to connect it: while you drag, the pins it can go to light up and the rest dim. Dropped on an input (or on a node, for its first empty input that fits), it fills it; dropped on empty space, it opens what can go there, as Blueprint's actions do: from a value, what it has first (Gets with it as their Target), then the nodes that use it; from an input, the variables that fit it first. A parameter's pin on the entry, dropped on an input, is a Get of it beside the input. **Alt+click** a pin to break its links, or right-click it for **Pick a value…**, **Work it out…**, **Empty it** and **Break links**. Emptying an input takes away what's typed in it; a Get wired in stays, unwired.
- **A local** is a node that names a value: its pin's Gets read it. Right-click a worked-out node's value pin and choose **Keep it as a local** to have it worked out once: a Local is made just before the statement that first reads it, with that node as its value, and its wires go to a Get of the Local. Its name is then typed.
- **Reroutes**: double-click a data wire, or right-click it and choose **Add a reroute**, for a knot to route it by. A knot is dragged like a node and its pin goes to any number of inputs; deleted, the wire is whole again.
- **Right-click, or press Space, inside a frame** to add any node. Type to search; Enter adds the first.
- **A call in the flow of statements is one node**, with arrows through it. Its arguments are named as the function names them.
- Drag the end of a wire off its input to take it away, or onto another to move it. An input takes one value, and a statement runs from one place.

**My game** lists the **Variables** of the code in hand (the frame that's selected): what it takes and its locals, each opening to its fields. Drag one onto the frame to choose **Get** or **Set** it; hold Ctrl to make a Get at once, or Alt to make a Set. Dropped on an input, it's a Get wired there.

A system that adds to a field each tick is one node. Drag from the entry's arrow and pick **Set**. Click **what** and choose `wobble`, then `phase`: the node is now **Set phase**, with a Get of `wobble` wired to its **Target**. Click the `=` under it and choose **goes up by**, which is `+=`. Click the value beside it and choose `wobble`, then `frequency`: a Get of `wobble` and a Get of its `frequency`, wired in. (Alt-dragging `wobble` › `phase` out of My game makes the same **Set phase**.)

**Set** only offers what it can do. Its name in the title, clicked, lists what this code can change: a need taken as **changes**, a local marked **Can be changed**, and their fields; what the code only reads is listed greyed, with how to change it. Its `=` lists only the ways Tide takes for what it changes and the value it's changed by: a `float3` changed by a `float` can go up, down, be multiplied or divided, but not become it, and a component (`transform` itself) can only become another. **Work it out…** offers only the operators that go with what's in the input. A variable that other nodes read too isn't in the title: its Get is wired to the Set's **what**.

A wire stays inside its frame: code in one frame reaches another's through the game's data (a component, an event) or by calling it. Dropped outside, the wire says so.

Nodes that nothing runs, and values nothing reads, are left out of the game; the editor shows them faded.

Where a frame is on the board says nothing of when its code runs. Systems run in the file's order, which **My game** shows, unless a stage says otherwise; **Earlier** and **Later**, under a frame's or a card's **Advanced** in Details, change it.

What's rare on a node (its options, a generic call's types) is in Details. A call starts with the arguments every call of it writes; what it can leave out (`Math.Perlin`'s `seed`, `Scene.IsPrepared`'s `player`) isn't there until it's wanted. The small **+** at the end of a call's last argument adds the next one its function takes, by its name; there is none once each has its value, but for a function that takes any number (**Spawn**'s components), whose **+** adds another. A right click on an argument's pin can delete it, or name it. A function dragged out of My game into a frame is a call there; a constant dropped on an input fills it.

<a id="text-in-a-graph"></a>

### Text in a graph

A **Text** node is a value written as Tide, `a * b + 1`, whose inputs are wired in by name. A **Code** node is statements written the same way, and a **Tide text** card is declarations. Use them where text is clearer, as for a long formula, or not at all: everything has a node of its own.

<a id="problems"></a>

## Problems

Tide checks the board as you change it, with the rest of the game's code. The chip at the top right says **Checked**, or how many problems there are; click it for the list, and a problem to go to it.

A problem is shown on what it's about: a field's row, an input, a node. It's red there, and says the compiler's message and what to do about it when the pointer is over it. An input with nothing in it says so by its name (**Pick what goes in 'what'**), and the rest of the file is still checked while it's empty. A problem goes as soon as its cause does.

Without Tide's language server (`tidels`, which comes with `tide`), the chip says **Not checked**: editing works, and mistakes show when the game is built. Building says the same errors with the element they're about: `Assets/Enemy.tidegraph:@17: error: ...`.

<a id="finding-your-way"></a>

## Finding your way

- Drag with the right or middle button (or hold Space and drag, or use one finger) to look around; the wheel scrolls, and Ctrl with the wheel (or a pinch) zooms. **Fit** shows the whole file. Far away, frames are blocks under their names.
- **My game** lists what the file has, by group: click one to go to it. **Find…** (Ctrl+F) jumps to a declaration by its name.
- The Tide a file stands for isn't on screen. **View as Tide**, in the board's "…" menu or the file's Details, opens it. The same menu has the file's namespace, the namespaces it uses, and **Tidy up the board**: data in a column, code beside it.
- Delete removes what's selected, Ctrl+D duplicates it, and Ctrl+C and Ctrl+V copy and paste nodes into a frame, fields into a card, between files and between editors.
- Undo and redo (Ctrl+Z, Ctrl+Y) go through what was done, step by step.

<a id="in-unity"></a>

## In Unity

The graph editor is a window of Unity's own. A graph in Assets is checked with the game Unity builds, so its types and functions are offered. A double click on a graph's error in the Console opens the board on what it's about. Saving (Ctrl+S) and Undo are Unity's.

<a id="in-vs-code-and-jetbrains-ides"></a>

## In VS Code and JetBrains IDEs

The graph editor is the file's editor, and the file stays the IDE's: it saves, undoes and shows changes in git as any file does. Its JSON is a tab away (VS Code: **Reopen Editor With > Text Editor**; JetBrains: the **Text** tab), and the IDE's problems list has a graph's errors on their line of it. **Show as Tide** in the IDE's menus is the board's **View as Tide**. Cards and frames copy and paste too, onto any board.
