How the SDK works
The SDK does not replace the game API. It adds two kinds of convenience:
- shortcuts such as
agents.local()andcamera.main()that compile to a native property or call; - small generated helpers such as selections, scopes and intervals that encode a repeated safe pattern.
The returned values remain native Agent, Camera, EventSubscription and
other game objects. You can call their documented properties and methods
immediately.
Use a shortcut and continue natively
Section titled “Use a shortcut and continue natively”import { agents, camera, time } from "@killscript/sdk/client";
const local = agents.local(); // Agents.GetLocalAgent()const view = camera.main(); // Cameras.Mainconst currentTick = time.tick(); // Time.Tick
if (local !== undefined) { const position = local.Movement.Position; // Native API from here. const viewport = view.WorldToViewportPoint(position); print(`${currentTick}: ${viewport}`);}If the SDK has no shortcut for a call, use the typed native global directly:
const hit = Physics.Raycast( Cameras.Main.Position, Vector3.forward, 100,);There is no penalty or architectural problem in mixing both styles.
The client-only camera aliases are deliberately small:
| Method | Native operation |
|---|---|
camera.main() | Reads Cameras.Main |
camera.create() | Calls Cameras.CreateCamera() and may return undefined |
camera.remove(value) | Calls Cameras.RemoveCamera(value) |
See Agent selections for every
direct agents query and Math and time
for the time, vector and quaternion helpers.
Choose the correct import
Section titled “Choose the correct import”| Feature | Client | Reflex | Purpose |
|---|---|---|---|
agents | ✓ | ✓ | Common Agents queries and selections |
arrays | ✓ | ✓ | One-based native collection loops |
logger | ✓ | ✓ | Prefixed and rate-limited console output |
scheduler | ✓ | ✓ | Client frames or server ticks plus timing helpers |
scope | ✓ | ✓ | Cleanup owned subscriptions and callbacks |
time | ✓ | ✓ | Native time values and safe tick conversion |
defineSettings | ✓ | ✓ | Generate and access module configuration |
defineNetwork | ✓ | ✓ | Typed batched Reflex transport |
camera | ✓ | — | Main/custom camera access |
defineControls and input | ✓ | — | Player-remappable module actions |
visuals | ✓ | — | Client world lines and overlays |
Import runtime-specific features from @killscript/sdk/client or
@killscript/sdk/server. Importing a client implementation from server code,
or the reverse, is rejected by the compiler.
What reaches generated Lua
Section titled “What reaches generated Lua”Simple shortcuts are replaced with their native expression. Compiler-only
declarations such as defineSettings() disappear after producing JSON. Richer
helpers inject only the small runtime functions actually referenced by the
bundle.
This is why source code can use readable abstractions without shipping a large
framework inside every .KillScript file.
For the complete surface beyond these helpers, open Game API and types.