# The engine

> What Rove emulates for scripts: instances, properties, events, services, scheduling, physics, pathfinding, GUI and Actors, all in Rust around the official Luau VM.
> Rove documentation: https://docs.rove.wtf/engine

Game scripts don't talk to the network; they talk to an engine. `part.Touched:Connect`, `TweenService:Create`, `workspace:Raycast`, `task.wait`, `Humanoid:MoveTo`: each of those is engine behaviour that Roblox implements in C++. Rove reimplements that surface in Rust (the "Rust host"), around the unmodified C++ Luau VM and compiler. No Python, no Roblox code.

Behaviour is matched against the real client, either by measurement or by reading its machine code; the [engine notes](https://docs.rove.wtf/notes) record each comparison.

## Instances and properties

Reads go through the replicated record first, then local changes, then the class's default. Defaults for `Instance.new` objects come from Roblox's own API dump: 3,457 values across 395 classes, so `Instance.new("Part").Size` is `4, 1.2, 2` exactly as in Studio ([property defaults](https://docs.rove.wtf/notes/property-defaults)).

The examples on this page run in a real Rove client. Change them and press run.

```lua
local part = Instance.new("Part")
print(part.ClassName, part.Name, "anchored:", part.Anchored)
print(part.Material, part.Shape, part.BrickColor.Name)
print(string.format("size %g x %g x %g", part.Size.X, part.Size.Y, part.Size.Z))
```
Output, recorded from a real Rove client (rove 1.00 · 29 Nov 2026):

```text
Part	Part	anchored:	false
Enum.Material.Plastic	Enum.PartType.Block	Medium stone grey
size 4 x 1.2 x 2
```

Property writes fire `Changed` and `GetPropertyChangedSignal` the way Roblox does, including deferral ([property notifications](https://docs.rove.wtf/notes/property-notifications)). Destroyed instances behave like Roblox's: `Parent` is locked, connections go quiet and writes are accepted but have no effect ([instance cleanup](https://docs.rove.wtf/notes/instance-cleanup)).

```lua
local part = Instance.new("Part")
part.Parent = workspace

part:GetPropertyChangedSignal("Name"):Connect(function()
  print("2. then the handler: renamed to", part.Name)
end)
part.Name = "Door"
print("1. the line after the write runs first")

task.wait()
part:Destroy()
print("3. after Destroy, Parent is", part.Parent)
print("4. parenting it again works:", (pcall(function() part.Parent = workspace end)))
```
Output, recorded from a real Rove client (rove 1.00 · 29 Nov 2026):

```text
1. the line after the write runs first
2. then the handler: renamed to	Door
3. after Destroy, Parent is	nil
4. parenting it again works:	false
```

## Events and scheduling

Signal handlers run deferred, at the next resumption point, like Roblox's default. The scheduler gives each frame a 64 ms slice and splits it into phases (`PreRender`, `RenderStepped`, `Heartbeat`, `Stepped` …), so a game with hundreds of render-step handlers doesn't starve. `task.wait`, `task.delay`, `task.defer` and `task.cancel` follow Roblox's ordering rules, including cancellation of waiting threads ([runtime waits](https://docs.rove.wtf/notes/runtime-waits)).

```lua
local RunService = game:GetService("RunService")

task.defer(print, "2. deferred: when this thread yields")
task.delay(0.1, print, "4. delayed: a tenth of a second later")
print("1. the main thread")

local step = RunService.Heartbeat:Wait()
print(string.format("3. one Heartbeat later (%.0f ms frame)", step * 1000))

local waiting = task.delay(5, print, "never printed")
task.cancel(waiting)
```
Output, recorded from a real Rove client (rove 1.00 · 29 Nov 2026):

```text
1. the main thread
2. deferred: when this thread yields
3. one Heartbeat later (20 ms frame)
4. delayed: a tenth of a second later
```

One difference to know about: `task.spawn` currently queues its function like `task.defer` does, where Roblox runs it immediately, inside the call. Code that reads something the spawned function sets, on the very next line, sees it one step late.

## Services

Client-side services exist and behave, from the everyday (`Players`, `RunService`, `UserInputService`, `TweenService`, `HttpService`, `CollectionService`, `Debris`) to the specific:

| Service | Covered |
|---|---|
| `PathfindingService` | 3D grid A* over parts, terrain and modifiers, with climbing, jump arcs and smoothing |
| `ContextActionService` | binding, priorities, bound-action info, touch buttons |
| `TeleportService` | every teleport form, settings and teleport data |
| `MarketplaceService` | ownership checks, product info, purchase prompts |
| `BadgeService` · `GroupService` | badge and group lookups |
| `Lighting` | `ClockTime` / `TimeOfDay` sync, sun and moon directions |
| `PhysicsService` | collision groups |
| `GuiService` · `StarterGui` | insets, selection, core GUI toggles |
| `TextChatService` · `Chat` | chat version, filtering |

Server-only methods fail with Roblox's own client-side error message rather than silently returning nothing.

```lua
local CollectionService = game:GetService("CollectionService")
local TweenService = game:GetService("TweenService")

local lava = Instance.new("Part")
lava.Parent = workspace
CollectionService:AddTag(lava, "Lava")
print(#CollectionService:GetTagged("Lava"), "part is tagged Lava")

local tween = TweenService:Create(lava, TweenInfo.new(0.25), { Transparency = 1 })
tween.Completed:Connect(function(state)
  print("tween", state.Name, "- transparency is now", lava.Transparency)
  lava:Destroy()
  print(#CollectionService:GetTagged("Lava"), "tagged after Destroy")
end)
tween:Play()
```
Output, recorded from a real Rove client (rove 1.00 · 29 Nov 2026):

```text
1	part is tagged Lava
tween	Completed	- transparency is now	1
0	tagged after Destroy
```

### Pathfinding, live

`PathfindingService` is a 3D grid A* over the real parts in the world. This asks it directly: the page builds your floor plan out of anchored parts in a Rove client, calls `ComputeAsync`, and draws the waypoints that come back.

(Interactive on the web page: draw walls on a floor and the page asks a real Rove client's PathfindingService for the route, then draws the waypoints it returns.)

## Physics

For the parts it owns, Rove simulates the world with gravity, collisions against parts and terrain, friction and bounce. It supports:

- **Movers:** legacy `BodyVelocity`, `BodyPosition`, `BodyGyro`, `BodyForce`, `BodyThrust` and `BodyAngularVelocity`, and modern `LinearVelocity`, `VectorForce`, `AlignPosition`, `AlignOrientation`, `AngularVelocity` and `Torque`.
- **Mechanical constraints:** springs, ropes, rods, hinges and prismatic joints.
- **Humanoids:** walking, `MoveTo` with `MoveToFinished`, jumping, flying and `FloorMaterial`.
- **Impulses:** `ApplyImpulse`, `ApplyAngularImpulse` and `ApplyImpulseAtPosition`.
- **Touch:** `Touched` and `TouchEnded`.

When nothing is moving, a frame's physics costs under a microsecond. Measured live in Classic Crossroads, a Rove character spawns in about a second, falls under gravity (196.2), walks 40 studs with `MoveTo`, jumps 6.4 studs and lands, and the server accepts every move.

In a live game the solver steps on its own. `stepphysics` drives it by hand, which makes a drop easy to watch:

```lua
local floor = Instance.new("Part")
floor.Anchored = true
floor.Size = Vector3.new(40, 1, 40)
floor.Position = Vector3.new(3000, 0, 3000)
floor.Parent = workspace

local crate = Instance.new("Part")
crate.Size = Vector3.new(4, 4, 4)
crate.Position = Vector3.new(3000, 30, 3000)
crate.Parent = workspace

for frame = 1, 90 do
  stepphysics(1 / 60)
  if frame % 15 == 0 then
    print(string.format("%.2f s   height %5.2f   speed %6.2f",
      frame / 60, crate.Position.Y, crate.AssemblyLinearVelocity.Magnitude))
  end
end
floor:Destroy()
crate:Destroy()
```
Output, recorded from a real Rove client (rove 1.00 · 29 Nov 2026):

```text
0.25 s   height 23.46   speed  49.05
0.50 s   height  4.66   speed  98.10
0.75 s   height  2.50   speed   0.00
1.00 s   height  2.50   speed   0.00
1.25 s   height  2.50   speed   0.00
1.50 s   height  2.50   speed   0.00
```

## Spatial queries

`Raycast`, `Blockcast`, `Spherecast`, `Shapecast`, `GetPartBoundsInBox`, `GetPartBoundsInRadius` and `GetPartsInPart` run against real part shapes and decoded mesh geometry, with `RaycastParams` and `OverlapParams` filters. Terrain is stored as sparse 4×4×4-stud voxels (zero bytes when a game has none) and takes part in rays, sweeps and collisions.

```lua
local ramp = Instance.new("Part")
ramp.Name = "Ramp"
ramp.Anchored = true
ramp.Size = Vector3.new(20, 1, 20)
ramp.CFrame = CFrame.new(5000, 10, 5000) * CFrame.Angles(0, 0, math.rad(30))
ramp.Parent = workspace

local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Include
params.FilterDescendantsInstances = { ramp }

local hit = workspace:Raycast(Vector3.new(5000, 60, 5000), Vector3.new(0, -100, 0), params)
print("hit", hit.Instance.Name, "after", string.format("%.2f", hit.Distance), "studs")
print(string.format("surface normal %.3f, %.3f, %.3f", hit.Normal.X, hit.Normal.Y, hit.Normal.Z))
print("material", hit.Material.Name)
ramp:Destroy()
```
Output, recorded from a real Rove client (rove 1.00 · 29 Nov 2026):

```text
hit	Ramp	after	49.42	studs
surface normal -0.500, 0.866, 0.000
material	Plastic
```

## GUI and text

GUI layout follows Roblox's rules: `UIListLayout`, `UIGridLayout`, `UIPageLayout`, `UITableLayout`, `UIScale`, size and aspect constraints, `ClipsDescendants`. `GetGuiObjectsAtPosition` hit-tests it. Text is measured with real font shaping (HarfRust, with bidi and line breaking), so `TextBounds` and `TextFits` match. Rove measures text but never draws it.

## Actors

Each `Actor` gets its own Luau VM, as in Roblox, with parallel Luau (`task.desynchronize`, `task.synchronize`), `SharedTable` and cross-VM messaging. Changes an Actor makes merge back into the shared world atomically.

## Values

All the datatypes behave like Roblox's, down to the details: `CFrame` (`lookAt`, `lookAlong`, `fromAxisAngle`, Euler orders, `Orthonormalize`, slerped `Lerp`), `Color3` (`fromHex`, `ToHSV`), `BrickColor` with the full palette, `NumberSequence`, `TweenInfo`, and more.

```lua
local look = CFrame.lookAt(Vector3.zero, Vector3.new(10, 0, 0))
print("LookVector", look.LookVector)

local accent = Color3.fromHex("#bca0ff")
print("hex round trip", accent:ToHex(), " BrickColor", BrickColor.new(accent).Name)

print("3-4-5:", Vector3.new(3, 4, 0).Magnitude, " X cross Y:", Vector3.xAxis:Cross(Vector3.yAxis))
print("halfway:", Vector3.zero:Lerp(Vector3.new(10, 20, 30), 0.5))
```
Output, recorded from a real Rove client (rove 1.00 · 29 Nov 2026):

```text
LookVector	1, 0, 0
hex round trip	bca0ff	 BrickColor	Pastel violet
3-4-5:	5	 X cross Y:	0, 0, 1
halfway:	5, 10, 15
```

Printing a `Vector3` shows every digit of its 32-bit floats (`1.2000000476837158`) where Roblox rounds to nine (`1.20000005`). The value is the same; only the text differs.

## What isn't there

There's no renderer, so anything that needs pixels doesn't exist: `ViewportFrame` contents, screenshots, real lighting. Audio is tracked (play state, time position, events) but not decoded. Some places' custom streaming or loading handshakes can delay the character. The [rust host note](https://docs.rove.wtf/notes/rust-host) keeps the current list of open parity work.
