Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oguzeroglu/Kompute
A pluggable steering library for game AI.
https://github.com/oguzeroglu/Kompute
ai game-ai game-development game-engine threejs webgame webgl
Last synced: 3 months ago
JSON representation
A pluggable steering library for game AI.
- Host: GitHub
- URL: https://github.com/oguzeroglu/Kompute
- Owner: oguzeroglu
- License: mit
- Created: 2020-05-02T14:10:57.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T04:49:38.000Z (almost 2 years ago)
- Last Synced: 2024-07-24T03:43:02.314Z (4 months ago)
- Topics: ai, game-ai, game-development, game-engine, threejs, webgame, webgl
- Language: JavaScript
- Homepage:
- Size: 560 KB
- Stars: 28
- Watchers: 4
- Forks: 4
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-threejs - Kompute
README
# Kompute
`Kompute` is a lightweight and efficient [steering](https://www.red3d.com/cwr/steer/gdc99/) 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](https://github.com/oguzeroglu/ROYGBIV), however may be easily used in any other project as well.
See the [documentation](https://github.com/oguzeroglu/Kompute/wiki).
# Demos
* [Autonomous Battle](https://oguzeroglu.github.io/kompute-demos-with-roygbiv/autonomousBattle/application.html)
* [Hide Behavior](https://oguzeroglu.github.io/kompute-demos-with-roygbiv/hideBehavior/application.html)
* [Arrive Behavior](https://oguzeroglu.github.io/kompute-demos-with-roygbiv/arriveBehavior/application.html)# Getting Started
Include it in your project.
For browser:
```html```
For `NodeJS`:
```javascript
var Kompute = require("kompute");
```Create a [World](https://github.com/oguzeroglu/Kompute/wiki/World):
```javascript
var worldWidth = 1000;
var worldHeight = 1000;
var worldDepth = 1000;
var binSize = 50;var world = new Kompute.World(worldWidth, worldHeight, worldDepth, binSize);
```Create a [Steerable](https://github.com/oguzeroglu/Kompute/wiki/Steerable):
```javascript
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:
```javascript
world.insertEntity(steerable);
```Create a new [Steering Behavior](https://github.com/oguzeroglu/Kompute/wiki/Steering-Behaviors):
```javascript
// this could be any type of Steering behavior
var behavior = new Kompute.SteeringBehavior();
```Set the behavior:
```javascript
steerable.setBehavior(behavior);
```Update the steerable (ideally 60 times per second):
```javascript
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 enginerequestAnimationFrame(update);
}update();
```# License
Kompute uses MIT license.