HTML5 Game Development Server

Introduction

Remember how there aren’t any good HTML5 game dev environments? Well that’s sligtly less true now.

With Bjork you can easily reuse code via modules, manage dependencies, oh god I’m so boring. I’ve become everything I hate. Let’s start over, yeah?

With Bjork you can easily make amazing games! Nothing can stop you! Nothing will stand in your way!

Getting Started

gem install bjork
bjork create awesome_game

Running your Game

# From the root of your awesome_game directory
bjork

Your game will be running on http://localhost:1999

Open it in your browser and party like it’s 1999.

Structuring Your Files

├── data
│   └── ...         <- JSON and whathaveyou (.json)
├── images
│   └── ...         <- Put your images here (.png)
├── music
│   └── ...         <- Ehhhn womp womp womp (.mp3 or .ogg)
├── sounds
│   └── ...         <- Beep boop beep boop  (.wav)
└── source
    ├── main.coffee <- Runs your app!
    └── ...         <- Your other code goes here (.js or .coffee)

Bjork serves up files from your directories.

main.coffee

#= require_tree .

engine.add "Player",
  x: 50
  y: App.height/2

engine.start()

The first line says to include all your other code first. We then add the player and start our engine!

Adding Component Gems

Entire game components can be stored as gems. The gems concentrate their power, kind of like Dragon Balls.

It’s simple to include them in your game. Your Gemfile lists what gems your game uses.

gem "bjork"
gem "rake"

group :components do  # <- Add your components inside here
  gem "jquery-source"
  gem "shank"
  # ...
end

I/O

Saving data to your filesystem from HTML has never been easier:

POST /save
data The file contents to save
path The path relative to your project to save to

Example

$.post "save",
  data: '{"coolField": "isAwesome"}'
  path: "data/awesome.json"

Loading data is even easier. Because Bjork serves all content in your project folder it will happen automatically.

$.getJSON "data/awesome.json", (data) ->
  alert data.coolField