JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q53985F
  • License MIT

A pluggable steering library for game AI.

Package Exports

  • kompute

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (kompute) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Kompute

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.

Kompute is originally designed to be used by the ROYGBIV engine, however may be easily used in any other project as well.

See the documentation.

Demos

Getting Started

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();

License

Kompute uses MIT license.