Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KERNEL

A provably-fair tactical duel where whole classes of cheating are impossible by construction.

CI License: MIT Play

Most competitive games fight cheating with anti-cheat software, server authority, and bans. KERNEL removes the possibility of entire cheat classes instead. Each turn is a cryptographic commit–reveal over simultaneous orders, resolved by a deterministic, integer-only function of the committed inputs, with tie-breaks drawn from a hash both players can recompute. From that, four common cheat classes stop being enforcement problems and become structurally impossible:

  • No aim → no aimbot. Orders are simultaneous and sealed before either is revealed.
  • No hidden state streamed to your client → nothing for a wallhack to read.
  • No riggable RNG → every tie-break is SHA-256(nonce_blue ‖ nonce_coral ‖ tick), verifiable after the fact.
  • No dominant strategy → stance combat is a cyclic game whose only equilibrium is ⅓/⅓/⅓.

The whole match is chained into a tamper-evident ledger and exports to a portable proof that anyone — even someone who never played — can independently verify.

Honest scope: the math guarantees fairness and reproducibility, not that the game is fun — balance and feel are tunable design parameters. And two-party trustless play can't prevent a player from aborting (refusing to reveal); it penalises it with a deterministic forfeit. See the specification §2 and §7.7.

Play

  • Live: enable GitHub Pages (see below), then open https://Ideatrino.github.io/kernel/.
  • Locally: the game needs a secure context for the Web Crypto API, so serve it rather than opening the file directly:
    npm start          # serves the folder at http://localhost:3000
    # or: python3 -m http.server
    Then open the local URL. (Opening index.html via file:// may disable the crypto the game relies on.)

Modes

Mode What it is
Play the KERNEL AI Local opponent that commits from board state only and plays the unexploitable uniform-random stance mix. Offline, instant.
2 players · this device Two browser tabs pair over a same-origin channel and run the real adversarial protocol against each other — each tab a separate, untrusting client.
2 players · remote A direct WebRTC peer link (one copy-paste each way to connect). No server ever sees your match.

Verifiable match proofs

Any match exports to a self-describing JSON proof. The Verify a saved match proof screen (in-app) re-executes the entire game from the opening position, recomputes every commitment, fairness seed, per-tick state hash, and the full hash chain, and reports whether the record is authentic — trusting nothing in the file, only recomputing it. Tampering with any order, nonce, seed, state, or the chain head is detected at the exact failing tick.

How it works

The design is specified precisely — enough to reimplement from scratch and to audit the security claims — in docs/SPECIFICATION.md: the exact rules and parameters, the commitment and seed derivations, the two-party protocol state machine and message formats, a per-attack threat model, the proof schema, and the reference verification algorithm.

Tests

The engine and protocol are checked empirically, not just argued. The single source of truth is index.html; scripts/extract.cjs pulls the engine + protocol controller out of it so the tests exercise exactly what ships.

npm test
  • test/invariants.cjs — 8,000+ randomised games: no crashes, no overlapping or off-board units, bit-identical determinism, balanced win rates.
  • test/protocol.cjs — two independent clients: honest synchronisation, deterministic replay, cheat detection, forfeit-on-timeout, independent seed agreement.
  • test/proofs.cjs — portable-proof round-trip and tamper detection, Byzantine-input hardening (garbage/duplicate/malformed messages never crash or fool a client), and the AI upgrade (stronger than the old greedy AI, still balanced in self-play).

CI runs the full suite on every push via .github/workflows/ci.yml. No dependencies — the tests use only Node's built-in crypto.

Project structure

index.html                  the entire game (self-contained: engine, protocol, UI)
docs/SPECIFICATION.md        formal specification + threat model
scripts/extract.cjs          regenerates the test module from index.html
test/                        invariants, protocol, proofs + hardening + AI
.github/workflows/ci.yml     runs the test suite on every push

Tuning

Constants near the top of the <script> in index.html — grid size G, UNITS, TARGET, MAXTICK, the momentum tiers, relay layout, reveal timeout — change balance and feel without touching the security machinery (commitment, verifiable seed, determinism, chain, forfeit), which holds for any parameter choice.

Enabling the live demo (GitHub Pages)

After pushing: Settings → Pages → Build and deployment → Source: Deploy from a branch → Branch: main / / (root) → Save. Since the game is index.html at the repo root, it goes live at https://Ideatrino.github.io/kernel/ with no build step.

License

MIT — permissive; swap it if you'd prefer something else for an original design you own.


KERNEL is an original design. It's yours to own, rename, reskin, extend, or build a server tier around.

About

A provably-fair tactical duel where whole classes of cheating are impossible by construction — cryptographic commit-reveal, verifiable RNG, deterministic replay, and portable match proofs.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages