Giter Club home page Giter Club logo

kompute's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.