
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
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.
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.
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.
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.
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.
FAQs
A ES2015 TypeScript Game Engine inspired by React and Unity
The npm package coronal receives a total of 1 weekly downloads. As such, coronal popularity was classified as not popular.
We found that coronal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.