npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

coronal

v0.0.1

Published

A ES2015 TypeScript Game Engine inspired by React and Unity

Downloads

2

Readme

Coronal Game Engine

Build Status License Coveralls Dependency Status devDependency Status

npm i coronal

Coronal is a TypeScript Game Engine modeled after a number of libraries and engines, such as React, Unity, Angular 2, Three.js, Unreal Engine 4, Godot, and Game Maker Studio.

It's designed to have a lightweight core and extendable components, such as a Individual Renderers, Device plugins like MIDI controllers and Wacom Tablets, etc. A bundled and minified version of the engine is very small, and designed to work with tree-shaking systems like WebPack 2.

5 Minute Quick Start

Let's make a cube that moves up according the arrow up button. From there we'll add our cube character to a level, and start our game engine.

import {GameObject, Input, KeyCode} from 'coronal';
import {Renderer, Cube} from 'coronal-webgl';

/**
 * A cube that moves up according the arrow up button, and shoots a cube.
 */
class CubeCharacter extends GameObject {

  constructor() {
    super();
    // Add a Cube Component to our GameObject.
    this.addComponent(Cube);
  }

  update(deltaTime: number) {    
    // Check if the ArrowUp key is currently pressed.
    if (Input.getKey(KeyCode.ArrowUp))
      this.transform.position.x += 10 * deltaTime; // Move 10 units per second
  }
}

// The Game is only made of one object, a CubeCharacter.
Renderer.render(CubeCharacter, document.getElementById('game'));

What will happen here is the Renderer will render the CubeCharacter we made onto a canvas created by it and update it ever 60 fps. Every frame the update function of the character will be called, as well as those of the components that the GameObject is made of.

Architecture

GameObject Tree

You can think of a Game as a tree of GameObject(s), each of which is made of components. This design applies to everything, from characters to levels, to the entire game, everything is a GameObject.

A Rendering System is then responsible for taking our Game and rendering/animating it. We also use this system to get implementation specific classes like 3D Models exported from programs like Blender to Sprites.

Decoupled Renderer

The WebGLRenderer for example will create a fullscreen canvas at in the DOMElement with id='game', with a CubeCharacter at the origin, and a default camera at the point vec3(10, 10, 10) pointing at the origin vec3(0, 0, 0).

The Coronal WebGL Module can handle a number of things, such as change the canvas size (the game window), make the aspect ratio of the rendered scene constant, creating custom shader materials, procedural geometry, postprocessing effects, etc.

Engine Processor

A Game Engine is powered by an Update Loop, a Render Loop, and a number of subsystems at different levels of abstraction, such as high level GUI managers to low level Input processors. These subsystems are detailed by Jason Gregory in his book Game Engine Architecture.

Coronal's Update/Render loop is delegated to the Renderer, which processes coronal's Core components like Input updating and Clock updating, to the actual draw update.