Visit https://roll4d4.github.io/KLEP/ for the philosophies behind KLEP, this page will cover the practical implementation of KLEP into your project.
KLEP is a modular, symbolic AI framework designed for simplicity, transparency, and flexibility. By using keys, locks, and executables, KLEP enables developers to create dynamic, adaptive systems for games, simulations, or experimental AI research. Whether you're building intelligent NPCs or testing symbolic reasoning, KLEP provides a robust foundation.
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.
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.