KCDS 1.0.8

KCDS 1.0.8

KCDS is now code signed: the launcher, the mod and the other Windows programs of the download carry our Certum code-signing certificate. World Architect exports work like the game's own places: their props have collision and cast shadows, fences can be vaulted, and players sit on benches, beds and chairs placed by scripts. Web views no longer lag under a busy GPU. Server owners get databases, NPC schedules and factions, navmesh paths, cart harnessing, fog and blizzards, and a lantern for players.

Servers and players both need 1.0.8: a client and a server of different versions refuse each other when joining. The launcher updates itself on the next start; servers update from their update channel, the new packages or the Docker image ghcr.io/kcd-synced/kcds-server:1.0.8.

Code signing

  • Signed with our Certum code-signing certificate: every Windows program and library of the KCDS download (the launcher, its updater, the game client and its tools). Third-party libraries that already carry their publisher's signature keep it. Windows and antivirus software see who made them.

World Architect and placed objects

  • Exported props have collision from their own model file (ovens, crates, stalls, wells, sheds, fences).
  • Exported props cast the sun's shadow (shed roofs, ovens).
  • Placed fences can be vaulted from both sides, like the level's own.
  • Players sit on placed benches and chairs and lie on placed beds with the game's own key and animations, and stand up with the "Stand up" hint (U). Placed chairs now show their chair.
  • Hidden grass stays hidden in exported works and after a Load, on any server.
  • The catalog offers the game's interactive prefabs (seats, beds, work places, fireplaces, ladders) and the export keeps them usable; the editor marks models that are only models.
  • Decals moved across a slope lie on the ground; grass paint grows the level's own grass; Add nature grows what suits a painted material; plane handles on the gizmo.
  • Ctrl+S saves, a paste follows the cursor until you place it, a dragged group moves live, a mixed meadow brush, and Ctrl+Z / Ctrl+Y follow your keyboard layout.
  • Fog and blizzard weathers in World Architect.

Players

  • Web views stay smooth under a busy GPU: a dragged map page no longer jumps, and clicks and keys reach pages at once.
  • A crash report now names the graphics layers in the game (OptiScaler, frame generation) and the overlay's last step.
  • A crash with OptiScaler / XeSS frame generation: the overlay draws on the game's own queue.
  • No crash when a blocked attacker is gone mid-block.
  • Microsoft Store: no crash on level load; the licence proof goes through the GDK.
  • NPC fights: no swing at a downed foe.

Server owners

Horses and carts

  • Horse theft event you can cancel: horseStealing(horse, player). It runs when a player mounts a horse that belongs to another player, before horseMounting. Handlers run synchronously: return false and the theft is refused (the client dismounts the player, and no horseMounting, horseMount or horseStolen follows). Return nothing to allow it, or decide by your own rules (factions, jobs, a wanted list, the owner online or not). The horse argument carries owner and ownerId. After an allowed theft, horseStolen(horse, player) fires and horse.thief names the thief. It is cleared when the owner rides the horse again or horse.giveTo hands it on. A thief is not asked again until the owner has ridden it.
  • Harnessing real horses to a cart: cart.harness(horse) / cart.harness([horseA, horseB]) and cart.unharness(). One horse for a cart, two for a wagon (Cart.blueprints lists each blueprint's horse count and seats, so you choose which cart or wagon to spawn). The horses must be alive, unridden, in no other cart, in the cart's world and within 15 m. While harnessed, the horse leaves the world (horse.harnessedTo names the cart), and the cart's horse looks like that exact horse. cart.unharness() puts them back beside the cart; it refuses while someone sits in the driver seat. Events: cartHarness(cart, horses) runs before and can return false to refuse; cartUnharness follows. cart.harnessed says whether the cart has horses: a cart without them cannot be driven, but its other seats still work.
  • Who may drive and who may ride: cartEntering(cart, player, seat) (since 1.0.0) runs before a player takes a seat and gets the seat's name. Return false to refuse, for example to keep the driver seat for the owner and let others ride. cartEnter / cartExit follow, and cart.driver, cart.whoSits, cart.seatPlayer and cart.unseatPlayer let a script place or remove people.

NPCs

  • Factions and hostility: Faction.setRelation(a, b, 'hostile' | 'friendly' | 'neutral'), Faction.relation(a, b) and Faction.relations(). A faction is a number 1 to 65535 that you give to NPCs (npc.faction) and players (player.faction). Set "faction A attacks faction B" by making them hostile. Per NPC: npc.hostile = true (hostile to every player), npc.hostileTo(playerOrNpc) (hostile to one player or NPC, whatever the factions; false undoes it) and npc.isHostileTo(target). npc.aggroRange (0 to 50 m) makes an NPC attack the nearest foe it sees, and help friends of its own or a friendly faction who are struck. The event npcAggro runs before each such attack; return false to refuse it (not offered again for 5 s).
  • "Use here" at any spot: npc.useHere(position, { fragment | clip, tags, loop, facing, speed, ... }). The NPC walks to any point, not only a SmartObject, turns to facing and plays the fragment or clip there. npcIntentDone reports the walk and npcAnimationEnd the action.
  • Daily schedules: npc.setSchedule([{ hour, position, ...action }]). Up to 48 entries by the world clock. At each hour the NPC is sent to the entry's position: with useHere when the entry has an action (fragment, tags, clip, loop, facing), otherwise with moveTo (speed, radius, pathfinding). npcScheduleEntry(npc, { index, hour, position }) fires for each entry, and npc.schedule reads it back. Between entries a script can give other orders until the next entry comes.
  • Did it arrive? npcIntentDone(npc, status) reports how a moveTo, follow, patrol leg or useHere walk ended: 'reached', 'blocked' or 'failed' (no way there).

Navmesh queries for scripts

  • Terrain.findPath(from, to) gives the way on the game's navmesh as the game's NPCs would walk it: { reaches, points }, the points from start to end. reaches answers "can you walk here?". When the goal cannot be reached, reaches is false and the points end where the search came nearest. Paths go around Terrain.blockNavmesh boxes.
  • Terrain.nearestWalkable(place, reach): the nearest point of the navmesh where an NPC can stand, within reach metres (up to 50).
  • Both return null where the navmesh is not loaded in the game running the script, or when the start or goal is more than 3 m off it.

Databases (also from Lua)

  • kcds.core.Database: SQLite databases in the resource's own folder, the same from JavaScript, TypeScript, Lua and C#. Calls are synchronous: the rows come back at once, as objects (Lua tables), with no promise to wait for. Database.open('data/shop.db') (or ':memory:', up to 8 open), then db.query, db.get, db.run ({ changes, lastInsertId }), db.exec, db.transaction(fn) and db.close. Parameters: ? with an array or :name with an object.

Lua

  • Configurable Lua call limit: luaCallLimit in server.json (or KCDS_LUA_CALL_LIMIT), in seconds from 1 to 600. It sets how long one call into the server's Lua scripts may run before it fails with a timeout error. The default stays 5 seconds; a player's game always uses 5. An invalid value logs a warning and keeps 5.

Sharing code between resources (since 1.0.0)

  • Exports / Imports work across resources in every language. A resource lists names under kcds.exports in its manifest and calls Exports.register(name, value). Others get them with Imports.get('resourceName') (Lua: kcds.core.Imports.get("economy")).

Lanterns

  • player.setLantern({ model, hand }) and player.lantern: the lit lantern the game's NPCs carry at night (warm light, about 6 m), in the player's hand. It stays there on foot, while riding and in a cart. Every player sees it, including later joiners, until it is set to null, the player leaves or the resource stops.

Weather

  • World.setFog(amount): fog over the weather's own for every player, from 0 (only the weather's fog) to 1 (a few metres of sight). About 0.3 is a misty day and 0.5 the game's fog weather. World.fog reads it.
  • Blizzards: World.setSnow({ ..., flakeSize, storm }): flakeSize sets the flake size (0.1 to 5) and storm how hard the wind drives them (0 calm to 1 blizzard).

Crafting

  • Crafting.defineWorkpiece: a smithing workpiece of your own (fields as in the game's BlacksmithWorkpieces.xml, or like an existing one); a Crafting.defineRecipe recipe then names it as its workpiece.
  • A script's smithing recipe starts at a game smithy. A product forged after the smithy closed now completes.
  • grindstoneStarting: return false to refuse sharpening at a grindstone.
  • The crafting events' data is described field by field in the reference.

Level, inventory and menus

  • levelEdit.hideParts = ['name', ...]: hides parts of a brush's model by sub-material name, up to 8, for every player. levelEdit.material = 'objects/...' draws an object with another game material.
  • Inventory: clothing rows carry their dirt and blood. Inventory.clean(id?) washes one row or all of them.
  • ActionMenu.open({ compact: true }): shows only the marked entry, with the game's mouse-wheel icon, as the game's own prompts do.
  • Level edits say which waiting edits should have found their objects.

KCD1 map

  • Townspeople walk on KCD1's navmesh; players start in the open street.
  • Rooms lit by global illumination the game builds from the level.
  • Blocked townspeople step down and reach unreachable legs out of sight.

Known limits

  • The inside of a house placed from a prefab is still lit like the outdoors at night.