<commit_before>[![Build Status](https://travis-ci.org/ember-theater/ember-theater.svg?branch=master)](https://travis-ci.org/ember-theater/ember-theater)

# ember-theater

A modular, extensible game engine build on top of Ember.js.

## Installation

`ember install ember-theater`

## Producer-Level Components

The producer is responsible for coordinating the high-level components of your game. You can specify what these components are in your `ember-theater/config.js` file:

```js
export default {
  initial: {
    components: [
      'ember-theater/director',
      'ember-theater/menu-bar'
    ]
  }
}
```

Any components you specify in the config will be concurrently rendered by Ember Theater. The Ember Theater team maintains several of these, but you can also create your own producer-level components and specify them here. The Ember Theater supported components include `ember-theater/director` and `ember-theater/menu-bar`.

### `ember-theater/director`

The `director` is responsible for reading scene scripts and coordinating components both on-stage and off-stage with its directions.

#### `ember-theater/scene`

Scenes can be generated with:

`ember g ember-theater-scene scene-name`

(where `scene-name` is the name of your scene, ideally dasherized)

Scenes have two properties:

##### `name`

If present, the scene `name` will appear in user-facing descriptions of a scene, such as a save game. If not present, the scene's id will be used instead.

##### `script`

The `director`'s primary responsibility is to read scene `script`s. Scripts contain lines of directions, which effect actions both on and off stage. For example, the following script will fade in a backdrop (over the course of one second) and then present a line of text:

```js
script: async function() {
  await this.backdrop('beach', { duration: 1000 });
  this.text('Hello, and welcome to my beach game.');
}
```

Note that [async functions](https://jakearchibald.com/2014/es7-async-functions/) can make the scripts easier to read than plain promises.

#### `ember-theater/direction`

The `director` commands a scene through its use of directions. These directions can do everything from playing music to moving characters across the screen to displaying dialogue and choice interfaces. Many of these directions come bundled with Ember Theater, but you can easily make your own as well.

##### `backdrop`<commit_msg>additional readme text<commit_after>[![Build Status](https://travis-ci.org/ember-theater/ember-theater.svg?branch=master)](https://travis-ci.org/ember-theater/ember-theater)

# ember-theater

A modular, extensible game engine build on top of Ember.js.

## Installation

`ember install ember-theater`

## Producer-Level Components

The producer is responsible for coordinating the high-level components of your game. You can specify what these components are in your `ember-theater/config.js` file:

```js
export default {
  initial: {
    components: [
      'ember-theater/director',
      'ember-theater/menu-bar'
    ]
  }
}
```

Any components you specify in the config will be concurrently rendered by Ember Theater. The Ember Theater team maintains several of these, but you can also create your own producer-level components and specify them here. The Ember Theater supported components include `ember-theater/director` and `ember-theater/menu-bar`.

### `ember-theater/menu-bar`

The `menu-bar` is an interface for meta-game activities, such as saving, loading, changing settings, or looking at achievements and scores. You can create your own menu-bar interfaces, as well as use the ones that come baked into Ember Theater. These include `save`, `load`, `reset`, and `rewind`.

#### Configuration

You can configure your menu bar layout in the `ember-theater/config.js` file:

```js
export default {
  initial: {
    emberTheaterMenuBar: [
      'ember-theater/menu-bar/rewind',
      'ember-theater/menu-bar/load',
      'ember-theater/menu-bar/save',
      'ember-theater/menu-bar/reset'
    ]
  }
};
```

You can further configure the key bindings that activate the various buttons:

```js
export default {
  menuBar: {
    load: {
      keys: {
        open: ['ctrl+l']
      }
    },
    reset: {
      keys: {
        open: ['ctrl+r']
      }
    },
    rewind: {
      keys: {
        open: ['ctrl+b']
      }
    },
    save: {
      keys: {
        open: ['ctrl+s']
      }
    }
  }
};
```

#### Baked-in Buttons

##### `ember-theater/menu-bar/save`

The save button opens a menu from which the player can save their progress, either overwriting existing games or creating new ones.

##### `ember-theater/menu-bar/load`

The load button open a menu from which the player can load a previous save.

##### `ember-theater/menu-bar/reset`

The reset button returns the player to the very beginning of the game.

##### `ember-theater/menu-bar/rewind`

The rewind button lets the player rewind to a previous scene, regardless of whether or not they had saved there.

### `ember-theater/director`

The `director` is responsible for reading scene scripts and coordinating components both on-stage and off-stage with its directions.

#### `ember-theater/scene`

Scenes can be generated with:

`ember g ember-theater-scene scene-name`

(where `scene-name` is the name of your scene, ideally dasherized)

Scenes have two properties:

##### `name`

If present, the scene `name` will appear in user-facing descriptions of a scene, such as a save game. If not present, the scene's id will be used instead.

##### `script`

The `director`'s primary responsibility is to read scene `script`s. Scripts contain lines of directions, which effect actions both on and off stage. For example, the following script will fade in a backdrop (over the course of one second) and then present a line of text:

```js
script: async function() {
  await this.backdrop('beach', { duration: 1000 });
  this.text('Hello, and welcome to my beach game.');
}
```

Note that [async functions](https://jakearchibald.com/2014/es7-async-functions/) can make the scripts easier to read than plain promises.

#### Configuration

You can configure many of the Ember Theater default values in `ember-theater/config` file:

```js
export default {
  globals: {
    classNames: ['et-block', 'et-paper'], // the default class names applied to dialogue and choice
    speed: 300, // the speed at which text is written
    transitionDuration: 200, // the speed at which dialogue, characters, backdrops, and other fade in and out
    keys: {
      accept: [' ', 'Enter'],
      cancel: ['Escape'],
      moveDown: ['ArrowDown', 's'],
      moveUp: ['ArrowUp', 'w']
    }
  },
  director: {
    transitionDuration: 750 // the speed at which scenes transition
  }
};
```

#### `ember-theater/direction`

The `director` commands a scene through its use of directions. These directions can do everything from playing music to moving characters across the screen to displaying dialogue and choice interfaces. Many of these directions come bundled with Ember Theater, but you can easily make your own as well.

##### `backdrop`
{'fraction_non_alphanumeric': 0.10404624277456648, 'fraction_numerical': 0.0038065698576060904, 'mean_word_length': 3.8456284153005464, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7161566', 'n_tokens_mistral': 2060, 'n_tokens_neox': 1975, 'n_words': 831}