Game API and types
SDK helpers cover repeated development patterns; the game API is the set of objects, properties and methods provided by KILLSCRIPT. It contains agents, items, cameras, physics, Defusal state, UI, world visuals, chat, audio and the rest of the module model.
You are expected to use both layers in one project.
Call the game API directly
Section titled “Call the game API directly”Projects created by the CLI load the correct declarations automatically. No
runtime import is required for globals such as Agents, Physics, Cameras
or NotificationController:
import { quaternion } from "@killscript/sdk/client";
const camera = Cameras.Main;const direction = quaternion.rotate(camera.Rotation, Vector3.forward);const hit = Physics.Raycast(camera.Position, direction, 100);
if (hit.HasHit) { NotificationController.ShowHint( `Surface distance: ${hit.Distance}`, 2, );}TypeScript itself cannot type the native quaternion operator, so this example uses one SDK helper for the rotation and then continues with native game objects. Use the same approach when a small helper makes a direct API call clearer.
Client and Reflex see different APIs
Section titled “Client and Reflex see different APIs”The generated project has two type configurations:
tsconfig.client.jsonloads@killscript/types/clientfor cameras, input, UI, sound and other client presentation APIs;tsconfig.server.jsonloads@killscript/types/serverfor Reflex and omits client-only globals.
Shared types may describe plain data, but shared implementation code must not assume a client or server global exists. The compiler also prevents one entry from importing the other entry’s implementation files.
Types record write access and values that are statically optional. A read-only
game field cannot be assigned merely because it looks like a JavaScript
property, and an optional object requires an undefined check.
Visibility redaction is conditional and is not fully expressible in the current
declarations. For a hidden Entity, check IsVisible before reading fields
other than ID and Name. For a hidden Hitbox, check IsVisible before
reading its other fields even when TypeScript shows a non-optional type.
Find behavior, not only a signature
Section titled “Find behavior, not only a signature”Use the separate verified KILLSCRIPT API reference when you need to know:
- where a notification or hint appears;
- whether a property is client-only, server-only, readable or writable;
- the coordinate space or unit of a value;
- what an event means and what fields its payload contains;
- a minimal native Lua/TypeScript-equivalent usage example.
This SDK documentation explains the TypeScript toolchain and helpers. The native reference explains game behavior. Pages link between the two instead of copying a second, eventually stale API description here.
How declarations are maintained
Section titled “How declarations are maintained”Declarations are generated from public LuaType/LuaGen metadata in the game
assembly, then corrected with verified runtime context, write access and
statically optional values. They are compile-time only and add nothing to the
emitted Lua.
Game and Random are marked LuaDocSkip by the game, so they are not treated
as supported public module APIs. Tutorial internals are also outside the
supported module workflow. This is deliberate rather than a missing SDK
wrapper.
If a verified public game member is absent from the declarations, report the member and its client/Reflex context as a type coverage bug.