
# SkewedAspect Game Engine (SAGE)

<div align="center">

![SAGE Logo](https://gitlab.com/skewed-aspect/games/sa-game-engine/-/raw/main/docs/images/sage_logo.png)
</div>

The SkewedAspect Game Engine (SAGE) is a powerful and flexible game engine designed for creating 2D and 3D games. It leverages BabylonJS for rendering and Havok for physics simulation.

## Installation

To install the SAGE library, use npm:

```sh
npm install @skewedaspect/sage
```

## Usage

### Creating a Game Engine Instance

To create an instance of the SkewedAspect Game Engine, you need to provide a game canvas and rendering options.

```typescript
import { createGameEngine, GameCanvas, RenderEngineOptions } from '@skewedaspect/sage';

const canvas: GameCanvas = document.getElementById('gameCanvas') as HTMLCanvasElement;
const renderOptions: RenderEngineOptions = {
    // ...your rendering options...
};

const gameEngine = await createGameEngine(canvas, renderOptions);

// Start the game engine
gameEngine.start();
```

### Stopping the Game Engine

To stop the game engine, simply call the `stop` method on the game engine instance.

```typescript
gameEngine.stop();
```

## Releasing

Releases are done locally via the release script, which bumps the version, stamps the changelog, commits, tags,
and pushes. CI then auto-publishes to npm when it sees the version tag.

```sh
npm run release -- patch        # 0.8.0 -> 0.8.1
npm run release -- minor        # 0.8.0 -> 0.9.0
npm run release -- major        # 0.8.0 -> 1.0.0
npm run release -- prerelease --preid=beta   # 0.9.0 -> 0.9.1-beta.0
```

Requirements:
- Clean working tree (commit or stash first)
- On the `main` branch
- GitLab CI needs `NPM_ID_TOKEN` OIDC configured for npm provenance publishing

The script publishes both `@skewedaspect/sage` and `@skewedaspect/sage-vue` at the same version. Prereleases are
tagged as `next` on npm.

## Contributing

Contributions are welcome! Please open an issue or submit a merge request on GitLab.

## License

This project is licensed under the MIT License.
