Skip to content

unstabler/higu

Repository files navigation

스크린샷 2026-07-17 10 17 57

higu

English | 한국어

NOTICE: This software was written entirely from scratch by vibe coding with Claude Code.

Yet another script interpreter that runs the scripts of Higurashi When They Cry (MangaGamer Unity port + 07th-mod) in a web browser.

  • Language: TypeScript
  • Rendering: HTML + CSS + JS (DOM-based. No HTML Canvas / WebGL. SVG filters are allowed)
  • Target corpus: the 168 script files of Ep05 (Meakashi chapter)

The original game's assets and scripts are copyrighted and are not included in this repository. A legitimate copy of the game is required to run it.

SYNOPSIS

The interpreter knows nothing about the browser — the host supplies script loading, flag persistence, and a renderer, and wires them together (see packages/app/src/main.ts for the real thing):

import { HiguScript } from "@higu/script";
import { HiguRenderer } from "@higu/renderer";
import "@higu/renderer/style.css";

const higu = new HiguScript({
  // Scripts come from wherever the host says — here, over HTTP.
  // (07th-mod overlay rule: files in Update/ shadow Scripts/.)
  loader: { load: async (name) => (await fetch(`/assets/Update/${name}.txt`)).text() },
  // GlobalFlags persistence (settings, unlock state) — e.g. localStorage.
  storage: myStorageAdapter,
});

const renderer = new HiguRenderer({
  rootElement: document.querySelector("#game")!,
  policy: higu.policy,       // interpreter and renderer share the same
  scheduler: higu.scheduler, // playback policy and scheduler
  flags: higu.flags,
  validity: () => higu.validity,
  assets: { baseUrl: "/assets", manifest },
});
renderer.start();

// The two sides are coupled only through the engine-function registry.
higu.useAll(renderer.commands());                     // ~61 presentation functions
higu.use("TitleScreen", async () => { /* … */ });     // GUI screens are the host's job

// Boot. init.txt sets up presets and chains into flow.txt by itself.
await higu.load("init");
await higu.run("init");

// Any wait-for-input point can be saved — the whole execution state is plain JSON.
const save = higu.snapshot();
await higu.restore(save);
await higu.resume();

Architecture

The interpreter and the renderer are fully separated. The interpreter knows nothing about the DOM (it has no browser API dependency, so it is tested standalone on Node), and the renderer knows nothing about the script grammar. They are coupled only through a name → async fn engine-function registry.

Package Contents
@higu/script Lexer, parser, AST, PC-based VM, save serialization
@higu/renderer DOM stage, text, audio, transitions, input
@higu/app Host app (Vite) — asset serving, save slots, HostUI

The design documents are the source of truth for this project — docs/design/.

Running

Place a legitimate copy of the game (HigurashiEp05.app) at the repository root, then:

npm install
npm run build
npm --prefix packages/app run dev

@higu/* is loaded through dist, so after modifying a library you must run npm run build again — otherwise stale code keeps running.

On boot the title screen appears — Start begins from the beginning, and the chapter jump under Extras starts from any chapter you like.

URL parameters

Parameter Description
?chapter=_meak_002 Skip the title and start from that chapter
?jump=3 Same as above, but by s_jump number in flow:Game
?lang=jp Japanese text (default: Korean)
?load=0 Load that slot on boot (?load alone means quick slot 0)

Controls

Input Action
Click / wheel down / Enter / Space Advance (completes typing first if in progress)
Esc / right click Menu (save/load/config). While skipping or in auto mode, right click only turns that off
A Toggle auto mode
S Toggle skip mode (read-text skip — stops at unread lines)
Ctrl (while held) Temporary skip (skips everything, ignoring read state)
Wheel up / / PageUp Open backlog
R Replay the last voice line
Q / E Quick save / quick load (slot 0)

While a movie is playing, click / Enter / Esc skips the movie.

Two bindings deliberately differ from the original. Space is view mode (hide window) in the original but advances here, and quick save is F5/F7 in the original but F5 reloads the page in a browser, so it moved to Q/E. Rationale: docs/design/03-renderer.md §10.

Console API

Save/load/config are available from the menu (Esc / right click), and a console API is exposed as well:

save(0)    // Save to slot 0. Returns false where saving is not allowed
load(0)    // Load slot 0
saves()    // List slots (saved time, SavePoint label)
higu       // Interpreter — status / canSave / callStack / policy
renderer   // Renderer — snapshot() / scene / layers / audio / history

Where the script forbids saving (the title screen, etc.), canSave is false and the save-slot UI locks its slots too.

Development

Command Description
npm test Run all tests (Vitest)
npm run typecheck tsc --build --force
npm run build Build every workspace

Tests come in two layers. Fixture-based tests use minimal self-written scripts and always run; corpus-based tests run only when the original game is present locally (they auto-skip otherwise). Since the corpus is copyrighted, the goldens contain no original text either — only a structural digest (file/section/statement counts + a node-kind histogram) is pinned.

The third layer is playback in a real browser. jsdom has neither layout nor real assets, so "the size is wrong" or "it's invisible" is fundamentally unobservable there — after touching the renderer, look at it yourself.

Status

M8 (minimal GUI / full Ep05 playthrough) in progress — title/chapter select, Select choices, the in-game menu (save slots/config), and movie skip are done. What remains is verifying a full playthrough of every Ep05 chapter. The roadmap and per-milestone findings live in CLAUDE.md.

License

This is not open-source software — its development heavily referenced 07th-mod/higurashi-assembly, a decompilation of the original game's C# assemblies, and use is permitted only to those who legitimately own a copy of Higurashi When They Cry. See LICENSE for the full terms.

About

An HTML+CSS+JS interpreter for Higurashi When They Cry — no Canvas, no WebGL, just the DOM.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors