Forge is a browser-based, code-only game engine. It has everything you'd expect from an engine, including rendering, audio, input, animations, an Entity-Component-System (ECS) core, physics, and more.
Forge is published to GitHub Packages, so npm needs a GitHub token before it can install it:
-
Create a classic personal access token with the
read:packagesscope. -
Log in to the GitHub npm registry for the
@forge-game-enginescope. Enter your GitHub username, and the token as the password:npm login --scope=@forge-game-engine --registry=https://npm.pkg.github.com
-
Install the package:
npm install @forge-game-engine/forge
Add a <div id="game-container"></div> to your page, then create a game, a
camera and an entity with a sprite, and register the systems that draw it:
import { createGame } from '@forge-game-engine/forge/utilities';
import {
addSpriteComponent,
createCamera,
createImageSprite,
createRenderEcsSystem,
} from '@forge-game-engine/forge/rendering';
import {
addPositionComponent,
createTransformEcsSystem,
} from '@forge-game-engine/forge/common';
const { game, world, renderContext, time } = createGame('game-container');
createCamera(world);
const texture = await renderContext.textureCache.getOrLoad('sprite.png');
const sprite = createImageSprite(texture);
const entity = world.createEntity();
addPositionComponent(world, entity);
addSpriteComponent(world, entity, sprite);
world.addSystem(createTransformEcsSystem(time));
world.addSystem(createRenderEcsSystem(renderContext));
game.run();The Getting Started guide walks through setup in more detail, and the demos are complete, runnable examples of each feature.
See CONTRIBUTING.md for setup, verification steps, and commit and changelog conventions.
Forge's demos and website use art, audio and fonts by many creators. See Credits and attributions.