KCDS 0.2.0

0.2.0 brings NPCs and animals that every player sees the same way: the server spawns them, one player's game runs each of them with the game's own AI and animations, and everyone else sees that. NPCs walk on the game's own paths, fight players, die, can be looted, and follow the server's orders. Animals are spawned by the server too, so a deer or a sheep stands in the same place for everyone.

Servers need the 0.2.0 server as well. The launcher updates itself to 0.2.0 on the next start.

Highlights

  • Server NPCs on every screen (#59). Npc.create spawns an NPC for all players, with its clothes, weapons, face, speech bubbles and animations. Men and women both look right on every client.
  • NPCs walk on the game's own paths (#59, #63). moveTo, follow, flee, lookAt and patrol routes use the game's movement, so NPCs go around trees and houses with their own walk and run animations. The server script hears when an order ends (npcIntentDone).
  • Fights with NPCs (#60). Players lock on to NPCs, hit them with the game's own damage, and see the same hits, reactions and deaths on every screen.
  • Looting NPCs from the server (#61). A dead NPC's items come from the server's inventory, so robbing a corpse can no longer duplicate items, and its clothes come off for everyone.
  • Animals by the server (#62). The game's own chickens, rats, mice and cats no longer spawn on one client only. The server spawns animals with a percent per species, and everyone sees them in the same place.

NPCs

  • Spawn and look (#59, #61):
    • Npc.create with a name, class, position, rotation, outfit and dimension;
    • Npc.setOutfit keeps a server-fixed outfit, weapons shown on the body (a bow on the back);
    • Npc.setAppearance builds the face from character components;
    • Npc.say shows the game's own speech bubble over the NPC's head for every player;
    • Npc.playAnimation and stopAnimation;
    • client-only NPCs (LocalNpc) for things one player should see alone.
  • Orders, the game's way (#59, #63). Checked live with 3 clients:
    • moveTo: walked about 10 m on the navmesh, npcIntentDone: reached;
    • follow(player, { radius }): walks after the player and stops within the radius, again when the player moves on;
    • flee(point, { radius }): runs away until far enough;
    • lookAt(player | npc | point): turns to face it;
    • PatrolRoute and npc.patrol(...): walks every point, patrolWaypoint for each and patrolFinished at the end.
  • Smooth movement for everyone. The player whose game runs an NPC sends its state 20 times a second while it moves or fights, 5 times while it stands.
  • Health and death (#60): health, damage, kill, revive, invulnerable, and their events. The NPC dies the game's way on every screen, and the killer is the player who struck.
  • Fights (#60):
    • npc.attack(player): the NPC draws the weapon it carries (its outfit's sword), raises its guard and attacks with the game's own combat automation; its blows land with the game's damage;
    • the NPC defends itself with the game's own combat defence: it raises its guard and blocks; npc.setCombatSkill({ defense }) sets the share of the defences the game offers that it takes (0 to 1; null, the default, leaves it to the game). The game offers a defence for the first blow of a quick combo only, so a fast combo still gets through (#60, being improved);
    • lock-on to NPCs works for every player;
    • the player who fights an NPC runs it for the fight, so blows and reactions are immediate;
    • other players see the same fight: the NPC's drawn weapon, its place and facing follow the fighting body closely (20 times a second), its moves within 30 to 90 ms.
  • Same NPC for everyone: a server NPC has the same face on every client (the game picks a runtime body's face per client; the first simulator's choice is now everyone's), and no Rob hint is offered on a living server NPC.
  • Looting (#61):
    • robbing a corpse goes through the server's inventory (no duplicates), and the worn clothes come off for everyone;
    • pickpocketing a server NPC is refused;
    • harvest tables for dead animals (Npc.setHarvestTable) and npcInteract.

Animals

  • The game's own small animals are off (#62): chickens, rats, mice and cats no longer spawn on one client only.
  • Server population (#62): an animal-population.json in the resources folder (or Npc.setAnimalPopulation) turns it on, with a percent per species, a cap, a group size per spawn point and respawn times. Off by default.
  • Animals are on every client in the same place, run by one player's game like horses.

Horses and dogs

  • Horse looks (#157): the server picks body, head, mane and tail, so a horse is the same on every client.
  • Horse ownership (#57): removedWithOwner and giveTo(null).
  • Dogs (#58): spawn with an owner, modes, Player.dog.
  • Horse orders (#55): moveTo, patrol and hold on the server.

SDK

  • Handcuffs (#232): hands behind the back, only walking, released only by a script.
  • Interaction on any prop (#233): World.addInteraction shows a hint and calls a handler, for example on a pillory.

Not in this version

  • Horse knock-out instead of death (#56). (in progress)
  • Drunk and plate-armour walk seen by everyone (#228), tub washing (#200): waiting for a live check.