KCDS 1.1.3

KCDS 1.1.3

Servers and players both need 1.1.3: a client and a server of different versions refuse each other.

New for resources

Holding a hand at a point (server, every game)

  • Player.setHandTarget(hand, options) (server): holds the 'right' or 'left' hand's grip (the hand slot, where held items attach) at a point on the body's axes (x right, y forward, z up, from the feet), or from a joint with relativeTo: 'RightArm'. Every game solves that player's arm each frame on top of whatever the body plays, walking and running included, on the player's own body and on what everyone else sees. It suits a cup raised to drink, a lantern held forward, a torch held up, or a hand on a cart.
  • Its options: rotation (the hand's turn as a Quaternion or Euler degrees; without it the hand keeps the animation's turn, so a vessel stays upright), pole (the point the elbow bends towards), weight (0 to 1), blend (seconds to move in and out, 0.2 by default, up to 10), and firstPerson: { position?, rotation? }, used instead only in the owner's own first-person view, so an item can sit in view without changing what others see. Targets are up to 3 m from where they are measured; anything else throws TypeError or RangeError naming the option.
  • Player.setHandTarget(hand, null) lets the hand go, back into the game's own pose over the blend. player.handTargets reads both hands ({ right, left }, each the checked target or null). Late joiners see the holds at once.
  • Animations.skeleton() (client): the local body's joints by name, with each joint's parent and its rest pose relative to the parent and in the body's space, read from the body's own skeleton (471 joints for a player). Scripts that work out joints no longer guess the hierarchy.

LocalPlayer from the player's own game (client)

  • LocalPlayer.position, rotation, velocity, gaze, health, stamina, exhaust, hunger and the conditions now come from this machine's game, sent to the client scripts whenever a value changes. Before, they made a round trip through the server and trailed the game by up to about 0.3 s: a stamina bar lagged the game's own, and a step or a turn was seen late (0.55 to 0.95 m behind the drawn body while walking or running, now about 0.06 m). Everything else about the local player, and every other player, still comes from the server. Before the first reading and outside a world, the server's copy is read as before.

Camera.getPose and client scripts that wait (client)

  • Camera.getPose() no longer waits for the game: it returns the camera the game client already streams for Hud.worldToScreen. A HUD compass or marker that reads it from a fast timer no longer slows every other client resource. Camera.rayFromScreen gains the same.
  • A client resource whose calls wait for the game for more than 200 ms a second is named in the client log, with its calls by API, at most once every 30 s. For example: "kitpoll held the client scripts for 997 ms in the last second waiting for the game (World.raycast x44); every client resource waited". The SDK reference now says which calls wait for the game's next frame: World.raycast, World.groundHeight, Player.jointPosition and Player.jointRotation.

NPCs on seats and smart objects

  • Npc.useObject puts the NPC on the seat when the sit-down or lie-down ends, turned as the game's animation leaves it, and out of the seat where the stand-up ends. Before, an NPC whose game did not carry it with the animation's own motion sat or lay in the air beside the bench at seat height, up to 2.5 m from it (table benches from behind or the side, chairs, beds). This applies to every smart object an NPC uses, not only seats.
  • SmartObject.levelPlaces() gives each place its rotation (the helper's facing as a Quaternion), so a script can line things up with a place.

For server owners

Which resource holds the server

  • The server log names the resource that held the script runtime, and what ran, as soon as the hold ends: "The script runtime was held for 2710 ms by shop (setInterval callback, every 60000 ms); every resource and server event waited", under the resource's name. It names event handlers (resourceStart handler, playerJoin handler and the rest), message handlers, entity state handlers, timers (setTimeout, setInterval with its interval, setImmediate, queueMicrotask), HTTP routes and scripts being loaded. Before, every warning said [host] and named nothing.
  • Each piece of code counts only its own time: a resource whose handler fires an event another resource handles slowly is not blamed for the other's part, and a resource that took a fair share of the same hold is named after it. A resource logs at most one such line every 10 s; its next line counts the holds in between.
  • Code that runs after an await is not started by a handler or a timer. When a hold has no handler or timer behind it, the log says so and the server times code after await as well for the next 10 minutes, so the next such hold is logged as "by shop (code after an await)". The 30 s check that reports it now says "in the last 30 s", so its rhythm is no longer mistaken for a resource timer.
  • KCDS-Admin, Resources tab: a new "Script time (last min)" column shows how long each running resource's code ran in the last minute, with its slowest run of the last 10 minutes; hover for its five slowest runs and when they ran. /api/resources gives the same as cpuMs and slowest.
  • The crash report's copy of the log (kept every 5 s) is written in the background, and only the newest lines when the disk is slow, instead of holding every resource while it writes.

Fixes

  • A game could stop with an access violation (0xC0000005 in memmove) in the game's actor LOD budget after taking many level people's bodies. The budget's queue now keeps each actor once, and only actors it can take.
  • Server list: a server of another release no longer shows "matches yours" with a CONNECT button only for the join to be refused. It shows "needs another version" and UPDATE REQUIRED, and the update dialog says which side is older by the release too. A client-only hotfix still matches its release's servers.