// the find
soonfx-engine/core
🎮 TypeScript game numeric engine for RPG & strategy games. Zero dependencies, type-safe formula parsing, battle system simulation, and expression evaluation. 基于 TypeScript 的游戏数值引擎,专为 RPG 和策略游戏设计。零依赖、类型安全的公式解析、战斗系统模拟和表达式计算。
A TypeScript library for decoupling game numeric logic (damage formulas, character stats, resource rates) from game code by representing them as runtime-evaluated JSON. Targets indie and mid-size game studios building RPGs, strategy games, or card games in TypeScript/JavaScript who want designers to own balance changes without touching source code. The real pitch is the companion visual editor, not the runtime alone.
Zero dependencies and under 50KB minified is a real constraint hit — this won't bloat a game bundle. The RPN expression evaluator is the right architecture for a sandboxed formula engine: it avoids eval() security issues while still handling operator precedence. The JSON-as-data approach for formulas is sound: a designer can tweak a damage multiplier in the editor and export without a code review. TypeScript types are first-class throughout, not an afterthought .d.ts file bolted on.
The test suite is nearly nonexistent — two test files covering MathUtils and System, nothing for the expression parser or battle system. For a formula engine where correctness is the product, this is a serious gap. The visual editor is a separate repo and appears to be where most of the value lives, making the standalone runtime feel incomplete without it. The event system (CallCenter/Eve) feels like it's there to support the editor's internal messaging, not a general-purpose game event bus — adopters will likely rip it out and use their own. Documentation shows API signatures but almost no explanation of the formula data schema (the JSON format the editor exports), so using the runtime without the editor requires reading source code.