Spark Engine Web is a lightweight, browser-based web game engine project for fun.
The engine is being built to be simple and fairly performant, aiming to provide the best possible experience to game developers and contributors.
The MVP is currently being iterated through until the target is reached, so expect no major version and few breaking changes until then.
- Node ^20
- NPM ^10
Run npm i to install packages. After that, you are good to go
Here you can find the list of commands. Commands with the :ci flag are reserved for the CI setup of the project and not recommended for normal use
npm testto run the unit test suitenpm run test:perfto run the performance test suitenpm run test:visualto run visual testsnpm run test:visual:update-baselineto generate/update visual tests snapshotsnpm run buildto build the enginenpm run build:libto build the engine in its library versionnpm run build:devto build the engine in development modenpm run build:docsto build the documentation directorynpm run cleanto clean the dist foldernpm run serve:examplesto serve examples in a local webserver, getting rid of annoying CORS issues and similar. Requiresnpm run build:*
Download the latest release here: https://github.com/RuggeroVisintin/SparkEngineWeb/releases/latest.
Then npm i and npm build to install dependencies and build the .js distribution file.
You can now include it in your HTML page like so
<html>
<body>
<canvas id="canvas" style="width: 100%; height: 100%"></canvas>
<script type="text/javascript" src="./dist/spark-engine-web.js"></script>
<script>
const context = document.getElementById('canvas').getContext('2d');
const engine = new SparkEngine.GameEngine({
context,
framerate: 30,
resolution: { width: 1920, height: 1080 }
});
const scene = engine.createScene();
</script>
</body>
</html>See the available examples to find out more
You can add more examples in the examples folder. To correctly serve them, especially if you experience problems with CORS, see the npm run serve:examples command.
or just visit https://ruggerovisintin.github.io/SparkEngineWeb/examples for a ready-to-use version, updated to the latest release
You can contribute to the project via pull requests. If you are working on an existing issue, remember to link the pull request to it.
Once opened, a core maintainer will review the PR and eventually approve it.
When contributing, make sure to follow our coding guidelines
See LICENSE file
See the maintainers section in package.json