@minininja/engine

A simple zero-dependency modular game engine for bootstrapping games.

Stats

stars šŸŒŸissues āš ļøupdated šŸ› created šŸ£size šŸ‹ļøā€ā™€ļø
10Oct 26, 2018Sep 7, 2018Minified + gzip package size for @minininja/engine in KB

Readme

@minininja/engine

A simple zero-dependency modular game engine for bootstrapping games.

Installation

npm i --save @minininja/engine

Documentation

https://prozi.github.io/engine/

Base concept

  1. You create GameObjects + Scripts / Components.

  2. Each GameObject has a Transform property which is either a base Vector3 instance some kind of i.e. pixi.js or three.js object.

  3. Scripts have a many to one relationship with a GameObject.

  4. You append a script's Transform to a GameObject's Transform. Once you call one GameObjects onUpdate it propagates to all its children.

  5. You can reference a Transform's parent GameObject by this.gameObject accessor and GameObject's Transform by this.transform in GameObject context.

Classes

āœ… Vector3: class

āœ… Component: class

āœ… Script: Component

āœ… Transform: Vector3

  • Recommended read: Transform

  • This is a transform property in a GameObject.

  • This is to be replaced in child class with an instance of any child of PIXI.DisplayObject

āœ… GameObject: Component

āœ… Scene: GameObject

TL; DR

All constructors eat a JSON with parameters:

āœ… name: string

āœ… active: boolean

and four optional handlers:

āœ… onEnable: function

āœ… onDisable: function

āœ… onStart: function

āœ… onUpdate: function

āœ… transform: property (Vector3, source of position you can overwrite with anything)

Notable Mentions

https://www.npmjs.com/package/@minininja/pixijs -> for use of this library with pixi.js

https://prozi.github.io/engine-pixijs/demo/ -> benchmark / demo of the above

License

MIT

Author

Jacek Pietal prozi85@gmail.com

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.