For my GAM300/350 classes at DigiPen, I was the UI/UX programmer on a team of eight Computer Science majors. Over two semesters we built a custom 3D C++ game engine and a game with it. The engine was very big with a Vulkan renderer, a custom audio mixer, Jolt physics, and our own scripting language, Prose.
The game took inspiration from Kodu Game Lab, Project Spark, and Dreams, so players needed to be able to write game logic without knowing how to write code. Our Systems programmer built the Prose language and compiler. I integrated the Clay UI library into the engine and built a drag-and-drop block editor that generates Prose code. Our Graphics programmer, with a little help from me, wrote the system that turns Clay's render commands into Vulkan draw calls.
This writeup will cover the editor; the panels, the blocks, and how drag-and-drop works with the immediate mode rendering.
The scripting editor is a two-panel view that opens when you select a script file from the properties panel.

Left panel, the block sidebar
NOTE: The "Whiteboard" was our solution to variables, a per-object key value storage.
Right panel, the sentence canvas

A sentence is the basic logical unit in Prose: WHEN [conditions] THEN [actions].
// Generated Prose Code, line 3 in above screenshot
sentence Sentence3:
{
events: told("take_damage");
when:
{
return ((wbget(self, "lives") < 1) and (wbget(self, "immunity_timer") < 0));
}
then:
{
tell(self, "die");
}
}
A trash icon sits to the left of each sentence to delete it entirely. Dropping any non-sidebar block back onto the sidebar also deletes it.
Blocks are the draggable pieces. Every block is a horizontal strip of content. It contains a mix of static text labels and interactive input slots.

Each block has:
Blocks are defined entirely in JSON files under res/Scripting/blocks/. Adding a new block means adding an entry to the right category file.
{
"category": {
"id": "wb",
"name": "Whiteboard",
"description": "Use these blocks to directly interact with the values in an object's whiteboard",
"color": {
"text": [ 255, 255, 255 ],
"bg": [ 139, 92, 246]
}
},
"blocks": {
"wbset": {
"name": "Set",
"description": "Set the value of a variable on the whiteboard of this object.",
"argument": false,
"placement_restrictions": {},
"content": [
{
"type": "STRING",
"label": "variable",
"id": 1
},
{
"type": "TEXT",
"text": "to"
},
{
"type": "ANY",
"label": "value",
"id": 2
}
],
"output": "wbset(self, $1, $2)"
}
}
}Input slots are the interactive pieces embedded inside a block. Each slot has a type:
| Type | Widget | Example |
|---|---|---|
| String | Text field | A dialog line |
| Number | Text field | A distance value |
| Enum | Dropdown | Direction (Left/Right/Up/Down) |
| Variable | Dropdown | A named whiteboard variable |
| Object Reference | Dropdown | A prefab to spawn |
| SFX / Music | Dropdown | An audio asset |
| Entity Reference | Block slot only | A live entity |
| Boolean | Block slot only | True/False |
Dropdown inputs populate their options from the project registry at runtime, so the list of variables or audio assets updates automatically as the project changes.
An input slot can also accept an inner block as its value instead of a typed input. The slot becomes a drop zone and the nested block's output is used in its place. Entity reference and boolean slots have no widget of their own. They exist just to hold an inner block that produces the value, like a comparison block for a boolean.
Clay is an immediate-mode library, so every frame you declare the whole UI from scratch, Clay lays it out, and nothing carries over to the next frame. Drag-and-drop is the exact opposite, it's state that needs to persist across multiple frames, like what's being held, where it came from, and what it's hovering over. That disconnect is what I fought with the most often.
My solution was to keep the editor as a retained tree of my own objects and have Clay only describe it each frame. Sentences own BaseBlocks, blocks own their content, and every block and drop zone owns its drag-and-drop handle. Three key design points made that work out.
Stable IDs from persistent UIDs. Each block declares its Clay element with an ID derived from its own UID rather than its position in the list:
this->m_draggableHandle->m_elementID = CLAY_IDI("block", this->m_uid);The reason is hit testing. During declaration, the only layout Clay can report is the one from the previous frame, so Draggable and Droppable test the mouse against Clay_GetElementData(id).boundingBox. If IDs came from list positions inserting a block would shift every ID after it (which was my initial solution, this happened a lot), and hit tests would use other blocks' boxes for a frame. Keying on UID means a block always finds its own box, wherever it moved.
Dragging without leaving the tree. A held block isn't removed from its sentence while you drag it. It's drawn in the same place in the tree, but switched to a Clay floating element: it's taken out of the layout flow, offset by the drag, and given a raised z-index. The data only changes on drop, so a cancelled doesn't need to undo anything.
Drop zones updated every frame. Drop zones sit between blocks, so the amount of them depends on the data. Before drawing, each sentence calls CheckDropCount() which adds or removes Droppables until there is one more than there are blocks in each row. This keeps the drop zones in sync with the block list which may change on any frame.
The DND system has three parts: Draggable, Droppable, and DNDManager.
Draggable is attached to every block. It tracks:
std::any) carrying the block's ID and whether it came from the sidebarDroppable is attached to every drop zone. It tracks:
Draggable was released over it (cleared each frame after handling)DNDManager is the coordinator. There is one per editor. It:
Droppable fires with a pointer to the released DraggableThe editor saves each script as two files:
.json file storing the block tree (which blocks, in which order, with what input values).prose file, the compiled text output that the runtime readsSaving happens automatically on every block drop and explicitly when you hit the Back button. The Back button also triggers a recompile of the .prose file and returns you to the properties panel. The JSON save format mirrors the block tree exactly, so loading is just reconstructing blocks from their category+id template and re-filling the saved input values.
Before building the in-engine editor, I built a web prototype to playtest the block scripting idea on its own. It gives players a few scenarios to solve, like opening a door or collecting coins, plus a sandbox. Playtesters had a lot of fun with it, and some even asked if they could keep playing with it. The in-engine version got a lot less outside testing, but a few teammates used it for work in the engine. Once I'd fixed some of the usability and quality-of-life issues they found, it held up decently well.
As a project, we spent the whole year torn between making impressive tech for our portfolios and making a cohesive game. The final game showed that tension. Still, each of us came out of it with a system worth showing, and this editor is mine.