Kissrule
This is a lightweight rule-based system for game AI micro-decisions, written in C++20. It lets you register C++ object hierarchies as named facts, load rule sets from JSON, and evaluate them at runtime with lazy fact fetching and caching.
Copyright © 2026 Laurent Couvidou
Contact: hello@lorancou.net
Source: https://codeberg.org/lorancou/kissrule
Features
- Rules defined as flexible lists of criteria evaluating facts, fully serializable to JSON.
- Rich comparison operators for criteria (equal, range, outside range, etc.).
- Flexible fact source definitions.
- Enum support with typed enum values in rules.
- Multiple rule ordering policies (by priority, criterion count, or combined).
- Multiple response execution policies with runtime filtering.
- Performant runtime evaluation.
Coding Convention
We're loosely following the LLVM coding standards: https://llvm.org/docs/CodingStandards.html, but use snake_case for everything: types, variables and functions. Private member variables end with an underscore: member_variable_. Template parameters are framed with two underscores: _type_.
Known Limitations
- Rule compilation is heavyweight, probably has room for improvement on the performance side.
- 64-bit value types only allow equality comparisons, ordinal comparisons are not supported (because every fact value is converted to double-precision floating point at rules compilation).
- For now we're only joining criteria with AND operator. We may some day consider allowing OR operators in edited/serialized rules, and flattening them at compilation time.
To-do List
- Error handling / data validation ++
Future Plans
- Standalone rules editor (Qt6 DLLs + vcpkg, or maybe C#).
- Godot integration (GDExtension, should be fine with C++20, even if the engine itself is C++17 -- at least according to Claude).
- Unreal integration (a plugin, most likely).
- CMake FetchContent to avoid storing third party libs in the repo, see for example https://github.com/eyalamirmusic/ScopedMemoryAllocations.