Interface TypeSpriteServiceConfig

Hierarchy

Properties

asepritePath?: string

Path to the aspeprite executeable used for sprite sheet generation

assetPaths?: string[]

Local paths that may contain assets and game code e.g.: game/ or assets/. All files in there are considered to be part of the game (including subdirectories).

Files and folders start with _ or end with _ will be ignored.

Simply put the directories (no *).

default: game/, assets/

builds?: Record<string, any>

WIP, not sure yet

bundleAsESMRun?: boolean

Per default TypeSprite exports the game in an: iife.

So it can be used like this:

<script src="game.js"></script>
<!-- The game is running now -->

If you like/need to load it in a more modern fashion and get more control when the engine starts and you also like to have access to the running instance one can set this value to true.

<script type="module">
import runGame from 'path/to/game.js';
const gameInstance = runGame();
</script>

See

https://esbuild.github.io/api/#format

canvasSelector?: string

depends on canvas Type

canvasType?: CanvasType

"create" => a new canvas is created and attached to the canvas selector object "selector" => it is expected that the canvas selector points to a canvas

fixedMainloopFps?: number

Only valid if mainloopType is MainLoopType.Fixed.

flags?: string[]

[OPTIONAL] Define any flags that helps to run your game.

Suggestions: "ios", "nativ", "desktop", or "demo" :-)

mainloopType?: MainLoopType

It's possible to have different mainloop behavior and controlls how update() is called.

maxBlurredFps?: number

when > 0 it will cap the FPS to the given value if the window has lost the fosus. This is useful during development when your laptop starts to scream at you while working on a game.

maxFps?: number

when > 0 it will cap the FPS to the given value.

noAutostart?: boolean

Means the mainloop won't start automatically. This has to be done by hand.

noEngineContext?: boolean
noStandardPropertyParser?: boolean

Means built-in property-parser won't be set automatically. You can add them by yourself

Note

advanced

noStandardResourceLoader?: boolean

Means built-in resourceloader won't be set automatically.

Note

advanced

pathAlias?: Record<string, string>

FIX: remove?

Should be analoge to tsconfig.path.

Simply put the directories (no '*').

{"@game": "./some/path"}

resourcePathPrefix?: string

A global path-prefix used for all resources loaded using the ResourceManager.

This is useful when deploying the game into a environment where the paths of the executed javascript code does not match the dev-environment.

run: string | RunConfig

You have two options to run a TypeSprite game:

  1. set a RunConfig and start an *.edf
  2. set a custom main-file and do everything on your own

1) RunConfig (recommended)

A minimal RunConfig is just this:

{
startWorlds: ["myworld"]
}

It'll search for a myworld.edf in the given assetPaths and allows quick and full feature access to the TypeSprite.

_

2) main.js/main.ts (for edge cases)

If the reasonable defaults are not suitable it's possible to write a custom main file and initialize the engine by hand.

servePort?: number

Port for the dev-server

startWorlds: string | string[] | string[][]

Name or list of names the start world.

For a very simple case one can simply set a string.

However, for certain patterns it's useful to start more than one world and in a controlled order.

Example 1: start two worlds at the same time

startWorlds: ["world1", "world2"]

Example 2: start 3 worlds in a controlled order

startWorlds: [["world1"], ["world2", "world3"]]

when world1 is active, world2 and world3 get activated.

Generated using TypeDoc