-
Notifications
You must be signed in to change notification settings - Fork 5
Home
Oğuz Eroğlu edited this page Jun 18, 2020
·
5 revisions
Kompute
is a lightweight and efficient steering library for AI movement. It's not a visual library and generates numbers (velocity & position data), that's why it may easily be plugged into any codebase.
Include it in your project.
For browser:
<script src="PATH_TO_kompute.min.js"></script>
For NodeJS
:
var Kompute = require("kompute");
Create a World:
var worldWidth = 1000;
var worldHeight = 1000;
var worldDepth = 1000;
var binSize = 50;
var world = new Kompute.World(worldWidth, worldHeight, worldDepth, binSize);
Create a Steerable:
var steerableID = "steerable1";
var steerableCenterPosition = new Kompute.Vector3D(0, 50, 0);
var steerableSize = new Kompute.Vector3D(25, 25, 25);
var steerable = new Kompute.Steerable(steerableID, steerableCenterPosition, steerableSize);
Insert the steerable into the world:
world.insertEntity(steerable);
Create a new Steering Behavior:
// this could be any type of Steering behavior
var behavior = new Kompute.SteeringBehavior();
Set the behavior:
steerable.setBehavior(behavior);
Update the steerable (ideally 60 times per second):
function update() {
steerable.update();
// steerable.position -> the updated position of the steerable
// steerable.velocity -> the updated velocity of the steerable
// You may visualise the steerable with any rendering library
// You may use the velocity with a physics engine
requestAnimationFrame(update);
}
update();
- Core
- Path
-
Steering Behaviors
- AlignBehavior
- ArriveBehavior
- AvoidBehavior
- BlendedSteeringBehavior
- CohesionBehavior
- EvadeBehavior
- FleeBehavior
- HideBehavior
- JumpBehavior
- LookWhereYouAreGoingBehavior
- PathFollowingBehavior
- PrioritySteeringBehavior
- PursueBehavior
- RandomPathBehavior
- RandomWaypointBehavior
- SeekBehavior
- SeparationBehavior
- Wander2DBehavior
- Wander3DBehavior
- Math
- Extra