Installing Excalibur.js

Getting Excalibur

There are several ways you can download Excalibur.

Bower:

bower install excalibur

npm:

npm install excalibur

Nuget:

Install-Package Excalibur

Yeoman Generator

You can use the Excalibur Yeoman generator to spin up a blank, ready-to-go Excalibur game:

# Install Yeoman globally
npm install -g yo
# Install the Excalibur generator globally
npm install -g generator-excalibur
# Create the folder you want your game to be in
mkdir my-game
# Go into the folder
cd my-game
# Run the excalibur generator
yo excalibur

The Yeoman generator will automatically create the appropriate package.json and bower.json files and install the needed dependencies for your project.

Raw Script Files

You can also download the raw Javascript files from the Excalibur Distribution repository.

Note

Remember, Excalibur is a client-side library and cannot be used in a server-side Node.js project.

Unstable Builds

If you want to live on the edge and get unstable builds, you can add the Excalibur Appveyor Nuget feed to your project, see Unstable Builds.

Referencing Excalibur in your project

Just include the excalibur.min.js file on your page and you’ll be set.

If you’re using TypeScript, be sure to reference the declaration file excalibur.d.ts file.

<!DOCTYPE html>
<html lang="en">
    <head>
    </head>
    <body>
        <script src="excalibur.min.js"></script>
    </body>
</html>

Referencing Excalibur via Imports

Excalibur does not yet come with out-of-the-box support for import intellisense in TypeScript. However, until it’s natively supported, you can add support yourself with a slight modification.

Modify your local copy of the distributed excalibur.d.ts file and add the following to the end:

export default ex;

This will allow you to reference Excalibur using TypeScript with the import style syntax:

import ex from 'excalibur'

You can read more about specific module syntax in the TypeScript Handbook.

For Windows 8 & 10 projects

Please reference the GitHub repository for an example of using VS2013 and a WinJS application to run Excalbur.

  1. Install the Excalibur Nuget package
  2. Include the JS file in your WinJS layout file (e.g. default.html)
  3. Include a small script to new up your game (don’t use default.js)