Visit https://roll4d4.github.io/KLEP/ for the philosophies behind KLEP.
Visit https://github.com/Roll4d4/KLEP/wiki for an indepth implementation of KLEP.
this page will act as a quick start guide to cover the practical implementation of KLEP into your projects.
KLEP is a modular, symbolic AI framework designed for simplicity, transparency, and flexibility. By leveraging keys, locks, and executables, KLEP empowers developers to build dynamic, adaptive systems for games, simulations, or experimental AI research.
KLEP is my personal exploration into bridging symbolic reasoning with human-like cognition. Can a bit of math truly think like a person? This framework is my ongoing experiment to answer that question.
Whether you're crafting intelligent NPCs or pushing the boundaries of symbolic reasoning, KLEP offers a strong and adaptable foundation to bring complex behaviors to life.
KLEP models decision-making as a flow of keys (inputs), locks (conditions), and executables (actions).
- Keys: Represent concepts, actions, or conditions. Keys are the "currency" of decision-making.
- Locks: Define the conditions required for behaviors to activate.
- Executables: Encapsulate actions or processes that influence the environment or release new keys.
KLEP supports runtime modification, making it ideal for real-time experimentation and development.
Simply download the KLEP folder and move it into your project. Its symbolic logic, so no need for heavy multi GB models of training data. Unless thats your thing.
To start using KLEP, drag the KLEPNeuron
script onto an empty GameObject and hit play. This auto-initializes the system.
KLEP works with sensors to inject information into the neuron. For example, the Keyboard Sensor interprets user input as keys.
- While the simulation is running, drag the
KeyboardSensor
script onto the entity. - Input keys and see them propagate through the neuron.
KLEP allows you to create custom keys and locks to define and trigger behaviors.
- Create a key (e.g.,
"JumpKey"
) in your sensor or through code. - Define a lock that looks for
"JumpKey"
in an executable.
An executable is the core of KLEP's behavior system. Here's how to create a custom executable:
- Inherit from
KLEPExecutableBase
. - Override
Execute()
to define the action. - Use
CanValidate()
andCanExecute()
to check for required keys.
public class JumpAction : KLEPExecutableBase
{
public override void Execute()
{
if (CanValidate(parentNeuron.heldKeys) && CanExecute(parentNeuron.heldKeys))
{
Debug.Log("Jumping!");
// Example of a clean release:
PushKey(MakeKey("LandedKey", 1.0f));
}
}
public override bool IsComplete()
{
// Signal that the action has finished.
return true;
}
}
Keys can be cleanly released (on behavior completion) or dirty released (at any time):
Occurs when keys are pushed on behavior completion:
PushKey(MakeKey("CleanKey", 1.0f));
Occurs when keys are pushed at arbitrary moments:
PushKey(MakeKey("DirtyKey", 0.5f));
Use dirty releases sparingly to maintain behavior predictability.
You can check for the presence of a key in the neuron:
if (IsKeyPresent("JumpKey", KeyCheckType.inNeuron))
{
Debug.Log("JumpKey is present!");
}
Executables call Cleanup()
during their lifecycle if needed. For example:
public override void Cleanup()
{
// Reset or clear any state after execution.
Debug.Log("Cleaning up JumpAction");
}
You can find the cleanup behavior in the KLEPAgent
script to customize how and when it is triggered.
KLEP enables you to:
- Dynamically create behaviors through executables.
- Introduce sensors to feed keys into the system.
- Use locks to conditionally activate actions.
- Monitor and adapt key flow in real time.
This modular approach allows for endless experimentation and applications, from intelligent NPCs to real-world problem solvers. Example: Dynamic AI Control with KLEP
This example demonstrates how KLEP's modular architecture can be used with sensors, actions, and routers to drive an AI agent through user input.
MouseData_KEY: Captures the Vector3 position of the mouse, enabling the agent to react to spatial input.
W_Hold: Indicates when the W key is held down, allowing the AI to interpret movement inputs.
While recording and playback is not a built-in feature of KLEP, it showcases how custom executables can extend the system's functionality. For example, you can create an executable that records user input as keys and replays them into the neuron, allowing for automation of actions—like resource collection or repeating complex sequences.
This approach highlights KLEP’s versatility and adaptability, showing how you can integrate specific game mechanics or experimental features seamlessly.
I'm also working on a dedicated Wiki to provide in-depth guides, tutorials, and a community knowledge base—stay tuned for updates!
KLEP is designed as a foundation for exploration. Developers can:
- Integrate KLEP with neuroevolution, genetic algorithms, or other learning systems.
- Experiment with symbolic reasoning combined with traditional AI methods.
- Develop adaptive systems capable of self-modifying behaviors.
Want to contribute or share your experiments? Visit the KLEP GitHub Repository and join the conversation.
Let's build the future of AI together—whether that's saving lives, creating compelling games, or simply making the coolest tech around.