Skip to content

How the SDK works

The SDK does not replace the game API. It adds two kinds of convenience:

  1. shortcuts such as agents.local() and camera.main() that compile to a native property or call;
  2. 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.

import { agents, camera, time } from "@killscript/sdk/client";
const local = agents.local(); // Agents.GetLocalAgent()
const view = camera.main(); // Cameras.Main
const 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:

MethodNative 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.

FeatureClientReflexPurpose
agentsCommon Agents queries and selections
arraysOne-based native collection loops
loggerPrefixed and rate-limited console output
schedulerClient frames or server ticks plus timing helpers
scopeCleanup owned subscriptions and callbacks
timeNative time values and safe tick conversion
defineSettingsGenerate and access module configuration
defineNetworkTyped batched Reflex transport
cameraMain/custom camera access
defineControls and inputPlayer-remappable module actions
visualsClient 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.

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.