Skip to content

Getting started with the demo ​

Everything below runs from the repository root. The cluster scripts copy the asset tree to a scratch directory (~/.cache/kode-demo-engine-run) and start the real engine there, so the repo tree stays clean.

Prerequisites ​

  • MySQL. Defaults (matching scripts/run-demo-engine.sh): host 127.0.0.1:3306, database kode_demo (created for you when KBE_DEMO_DB_RESET=1); override with KBE_DEMO_DB, KBE_DEMO_DB_USER, KBE_DEMO_DB_PASS. Credentials also live in templates/assets/res/server/kbengine.xml.
  • Engine binaries. Either the prebuilt release assets from https://github.com/cuihairu/kbengine/releases (0.1.2: linux64 tar.gz, win32 zip, SHA256SUMS) or a local build of the fork's master (binaries older than the PY_SSIZE_T_CLEAN + login fall-through fixes fail the login face with code 19).

Start the cluster ​

sh
scripts/run-demo-engine.sh start    # start the 9-process cluster
scripts/run-demo-engine.sh stop     # stop it
scripts/run-demo-engine.sh clean    # stop + remove the run directory

After start, the loginapp listens on port 20013 and the baseapp on 20015 (the Godot runners connect to 20013 and follow the redirect). Script-level lifecycle and gameplay evidence goes through the scripts' evidenceLog() lines.

Run the headless bots ​

sh
scripts/run-demo-engine.sh bots

Bots log in, select/create avatars, walk to monsters, fight, collect kills and rewards, and join sects — the full gameplay loop without a display. Bot process output lands in logs-proc/bots.out.

Cross-server arena (two service groups) ​

The 036 cross-server drill runs two groups on the same host against one shared database. Group 1 (home) starts first and is the only group that resets the database; group 2 (arena) skips machine (a per-host singleton) and shifts every client-facing port, its component ids, and its hot-reload ports so the two clusters do not collide. shareDB is enabled on both.

sh
scripts/run-demo-engine.sh start                  # group 1, 9 processes, DB reset
scripts/run-demo-engine.sh bots                   # home players, level-5 drill
KBE_DEMO_GROUP=2 scripts/run-demo-engine.sh start  # arena group, 8 processes
KBE_DEMO_GROUP=2 scripts/run-demo-engine.sh bots   # arena-side bots

KBE_DEMO_GROUP=2 sets uid 1002 via the engine's UUID environment variable (shell UID is read-only), uses a -arena run directory, and never resets the shared database. Stop each group with the same variable (KBE_DEMO_GROUP=2 scripts/run-demo-engine.sh stop); group-scoped stops match the group's component-id prefix and leave the other group running. The real-machine run and its anchors are recorded in the acceptance evidence.

Mailbox ​

The mailbox needs nothing beyond the plain single-group start above: bots fire the mail drill on their own login pull (the one stable callback window a bots session owns). A mail is one tbl_Mail row written by a short-lived Mail entity at send time; the recipient fetches unread headers on login (and on reqMailFetch), claims an attachment through the real cell bag (Inventory.addItem, the monster-drop channel), and deletes the row (child attachment rows go with it). One drill mail is claimed and deleted; a plain letter stays in the box as the durable tbl_Mail / tbl_Mail_attachments row and replays as an unread header on the next boot's login pull.

Containers ​

The container family also needs nothing beyond the plain single-group start: bots fire the container drill from the same login-pull window. Three Parent=Item tiers exist — SpatialRing (4 slots), StorageBag (12) and StorageSpace (40) — each with a contents stack list persisted to its own table plus a nested *_contents child table. Storing gates the container base-side, then takes the stacks out of the real cell bag (Inventory.takeItem); taking grants them back (Inventory.addItem). The drill funds its own store legs through that same bag channel, anchors the capacity caps (a count over the ring total denies bad-count at the base gate while the same count passes the bag gate), round-trips the ring to empty, and leaves a durable stack in the space tier: restart without the database reset and the drill replays it (space replay slots=1, rows from previous boots) before storing anything new.

Skills ​

The skill system also rides the plain single-group start: bots fire the skill drill from the same login-pull window. Four skills live in scripts/common/skills.py — flame lance (single target, fire), frost novae (aoe, water), stone guard (self shield, earth) and qi mantle (passive, metal). Learning appends one SKILL_SLOT entry per skill to the avatar's skillSlots (a persisted base property, one child-table row per slot); casting first checks the learned face base-side, then the cell-side gates (mana, per-skill cooldown). Damage multiplies the skill's element against the defender's dominant root on the same five-element table the melee path uses. The drill learns two skills, casts a hit with the mana deduction (30→20→12), recasts into the cooldown deny, arms the shield, and — on a restart without the database reset — replays the learned slots (slots=2 at drill start, zero re-learns) before running the cast anchors again.

Run the Godot headless client ​

Three acceptance runners exist under templates/godot-client/scripts/. Each exits 0 only when all its anchors pass and writes a JSONL/JSON evidence file:

sh
# 13-anchor login/protocol chain
godot --headless --path templates/godot-client \
  --script res://scripts/acceptance_runner.gd -- \
  --account=godot001 --password=pwd123456 \
  --ip=127.0.0.1 --port=20013 --timeout=60 \
  --evidence=/tmp/godot-acceptance.log

# stats panel bound to the property sync (reqPractice drives exp 0 -> 20)
godot --headless --path templates/godot-client \
  --script res://scripts/panel_runner.gd -- \
  --account=godot002 --password=pwd123456 \
  --ip=127.0.0.1 --port=20013 --timeout=60 \
  --evidence=/tmp/godot-panel.log

# AOI object view: entity list + top-down markers; drives reqGoto/reqAttack
# over the client->cell pipe to kill an in-view monster
godot --headless --path templates/godot-client \
  --script res://scripts/object_view_runner.gd -- \
  --account=godot003 --password=pwd123456 \
  --ip=127.0.0.1 --port=20013 --timeout=80 \
  --evidence=/tmp/godot-view.log

Use a fresh --account per run; unknown accounts are created on first login. --wire=1 on the object-view runner additionally hexdumps low wire message ids for diagnosis.

Edit and re-verify ​

templates/assets is the source of truth. The cluster runs from a copy, so after editing scripts/defs under templates/assets you must restart the cluster (the copy is refreshed from the repo on start). The mirror tree tests/fixtures/kbengine-demo-assets must stay byte-identical for the scripts the extension's test corpus covers — the test gates enforce this.

Kode documentation