In games we trust

Hello there, if you are here, it's probably because you're interested in making HTML5 Games, or you're just curious about our game engine.
So here is the github's link, more descriptions/tutorials are coming soon.
The "How to" will help you to start, and the documentation is available but not complete, feel free to help me complete it :).

Dream-Engine on Github

Also feel free to come on our channel on Twitch and see how we do/ask questions

If you are new in JavaScript (or if you only develop in jQuery), I strongly recommend you check out the RequireJS before you start a new project using our Dream-Engine. You can also use the standalone version of our engine that only requires RequireJS to load the engine.
Also, if you don't know Grunt, you might want to check it out beforehands (even if you can do it later), as this will save you a lot of time to build your own game (especially games on specific platforms).

Start with the "How to"

There is currently the API Documentation website, and I'm filling it. Regardless, the code is well commented (Prioritizing on what you will use for sure). There is also the "How To" which is a great way to get started with the Engine.
Documentation is made for those who want get closer with the engine, or those who want contribute.

The Games featured below were made using the Dream-Engine.
If you made anything using the Dream Engine (a game, a prototype etc...), make sure to let us know so we can feature it here !
(If your project is getting displayed here we will need a 256px icon, a short presentation (in English if you can) that will be visible on this page as well as a longer one that will be displayed if someone presses "About" on your Project's card.)

If you wish to contact us: Facebook - Twitter - contact[ at ]dreamirl[ dot ]com

Beginner's guide about the Dream-Engine

Do you wish to try the Dream-Engine ? If yes, you've come to the right place !
With this short guide, you will be able to do things like "this" with no efforts.
We are going to use GameObjects (with inheritance), SpriteRenderer, TextRenderer, Keyboard and Mouse Inputs, Gamepad API, Audio, and after all this, compile it all using Grunt.
By the end of this tutorial, you should be able to make your own complete game !
Let's get started then ?

Before coding, managing folders and files

Copy all the sample "kill-bubble" in a new folder (being the least filled folder that we have at our disposal). This is my personal way of doing it : "(grunt file, _dev folder, release folder)"
You can of course do as you please, but keep in mind that I will be using this template for the rest of the tutorial.
We are only going to work on the "_dev" so if you see something such as "Go in the 'js' folder", it will actually be "_dev/js".
Rename the balls.html if you want to as well as the title or other meta. You don't have to rename css/js files.

  • The "custom" folder : I put everything that does not come from the engine.
  • The "datas" folder : This is where you'll find all the default data files used by the engine, each of them is used to declare what you are going to use (images, audios, inputs, localisation etc...)
  • The "ext_libs" folder : Contains only the required libraries but you can add new external libraries here if you need any.
  • The "platforms" folder : Contains the files needed to compile on specific platforms (currently only w8).
  • The "DreamEngine-min-require.js" is the compiled version of the engine.
  • The "files.js" is the required config (that's where you have to write your custom files)
  • The "main.js" will start the engine (and launch the game using it). You can set some parameters here but usually you can just everything as it is (simply give the init and start functions, custom gameLoop and the data files, you can change it if you want but it's not necessary).

Just open js/custom/Game.js to remove the current game. Remove from line 17 to 144 and add this :

If you encounter any difficulties or need additional help, you can check out the full sample source code available in your "samples" directory (little-shmup).

Customize the engine for your own game

First thing you need to do is have your Inputs, Images and Audios that you're going to need in your game.
Copy the folders "audio" and "img" from "sample/little-shmup/_dev" in your "_dev" folder.
Then go into your "js/datas" folder and open "audiosList.js", in the audioList's array, you have to put all the musics and FXs that you wish to use :

This is quite simple so I won't be spending any more time on it. Now proceed to open dictionary.js, if you want to use more languages, you can do so, but I personnaly made it for English and French so far.

Now set "imagesDatas.js", it's a little bit more complicated because there are a lot of options, and that's also where we'll be setting up the Quality Settings.

Now, let's take a look at some details.
First of all, screenSizes are the different available qualities for your game, you can have just one set up, but if you want to see your game running well on mobiles, and have a great quality on a desktop computer, you should use this file to make more than one.
You provide a width (w) and a height (h) and you can set a specific path for the quality. This path will be a suffix to the folderName.
There is also another way to have a good customization without having to resize all of your images and creating new folders. You can simply set the "notRatio" to true, and this will make it so that the given sizes aren't the native sizes for your images (this feature is currently work in progress).

You shoudln't set a path that's different from the original quality AND notRatio to true at the same time, because when you set notRatio, the Engine resizes images with the ratio from the original size and replace it with the current one.

conceptionSizeIndex is the index in the screenSizes array which you build the game in (in this case, we'll make the game based on 1000*1080, so it's 0, but I could put 1 if I were to make the game based on 666*720. You can of course set this as your default size, BUT you cannot set notRatio on the conceptionSizeIndex size attribute if you want to modify the conceptionSize. You have to manually resize all of your images for the given ratio.

folderName is the path to images

Now, to load your images, you have to use an array with the following parameters:

  • The name you want to use in the code (current: ship)
  • The Image name being the same one as the one in your folder (current: ship, but you should use my-super_awes0me.ship, you know you should)
  • The Image's format
  • Object parameters with the following options (keep in mind that all the options here are meant to save you some time when you create a SpriteRenderer, so use them wisely and you'll see a good use for them later on) :
    • {Boolean=true} load -> Used to load the image on the loading screen
    • {Int=1} totalFrame -> The total amount of frames in your image (only if it's a Spriteset). If you set this as 0 or 1, the engine will automatically set "isAnimated" to false, saving some calculating time
    • {Int=1} totalLine -> The total amount of lines in your image (only if it's a Spriteset)
    • {Int=0} eachAnim -> The delay between each frame (in milliseconds)
    • {Boolean=false} isReversed -> Used to have a reversed animation on the Sprite by default
    • {Boolean=false} isAnimated -> Used to automatically animate the Sprite by default
    • {Boolean=false} isPaused -> Used to pause the image by default when you use Sprites (and if you set isAnimated: true)
    • {Boolean=true} isLoop -> Used to loop animations by default if you use Sprites

Now, open inputsDatas.js, and you can see that this is another file that has many options. Try to do this as best as you can, trust me, it will save you a lot of trouble later on :)

Some details, here it's not an array because we want a name on our inputs.
I explain with the "fire" input.

  • "fire" is the input name
  • "keycodes" is an array with all inputs (keyboard or gamepad) that trigger this input.
    If you want use gamepad axes I suggest you to do it in an other input, then catch this events in an other handler because an axe value goes from -1 to 1 and a button is 0 to 1 (I did it here for left/right - up/down and haxe/vaxe, you'll see in the code)
    To see all inputs available open Inputs class starting at line 34
  • then you can set "interval", the input will trigger each interval (milliseconds)
  • isLongPress@Bool is a special parameters, if you set it to true, the input will trigger only after the given delay (when you call Inputs.key)
  • stayOn@Bool make special effect to, if you set it to true, the input will trigger until you release the button (when you call Inputs.key)

Wooo, that's all for customizing the engine. As I said it's a little bit complicated, and sometimes it boring, but honestly this will save you to much time later

Custom files

We are making a shmup game, so we need a Player class, Enemy, and Bullet.
The Dreamengine is made to think inherits and architecture, I'm going to show you how to do this and make something maintainable.
So create in the js/custom folder the files Player.js Enemy.js Bullet.js and datas.js (to save all the custom datas of the game).
Add these files in js/files.js like this (there is already Game and customLoop):

Now we write the basic needs for RequireJS. In each custom files created write this

In js/custom/datas.js remove 'datas', 'DREAM_ENGINE' (and the same args in the function), datas don't need anybody, it's just json datas, and replace myFunction by datas = {} (it's not a function!)
In Player.js and Enemy.js add 'Bullet' in the define array and Bullet in function's arguments
The Game.js will create the player, the Enemies and he need the datas to know what to do. So add these files in the Game.js define (as we do it before) you should have this at the beginning of your Game.js

Ok we are ready start

The basics, Scene, Render, GameObject

Before write Player or Enemy, we have to write the basics to see the engine running without problems (if you forget images, or do a mistake it'll not load).
We already wrote an empty Game.init and Game.start function. If you look in main.js you can see that we give at the engine theses functions.
In fact when the engine is ready it initialize dictionary, Inputs, ImageManager, SystemDetection (by default it's web only, we'll see this later), and load the loader (you need a loader.png in the base path you given) and when this loader is loaded, the engine call your init function than you gift before.
At this moment the engine start load custom Images and you should see the Dreamirl's loader.
When the engine finished to load it call your start function.

So in the init function, you can set some parameters (like debug), create Scenes or Renders but you can't make GameObjects using images here, you have to do this in the start function
The init is short:

Add on the top the used sizes, we will need it to place the player, enemies, and if we change it it's only here. The size is the conceptionSizeIndex in the imagesDatas.

With this you have the Render, the Scene and the Camera.
If you did well, you should get a blue screen after the loading by launching the html in your browser.

Before starting custom classes, we can already write a part of the start function by making the menu (very simple menu), in the Game.start (before the setTimeout, always before) add:

I commented the code but, as resume:

  • Make a GameObject with an optional params object
  • Create a SpriteRenderer by giving at least the spriteName (here you can change parameters we have set in the imagesDatas, but we did well so nothing to change)
  • Create a TextRenderer by providing a param object (can be empty), text, and buffer's sizes
  • Make a FixedBoxCollider with height and width
  • The pointers events are simple, "onMouse" + eventName and write a function. You can bind with a on() but it's slower, and don't provide the "this" in the right context (because it's again more slower).
    It's an architecture question only. If it's the object's event handler, you should use an intern method. If it's an extern listener, use on().
    Mouse events give a mouse attributes (not got here), you can stop the current event by returning true, and stop the propagation by using mouse.stopPropagation = true;

At this point you could see than we can already make a simple button plugin's with GameObjects, I'll do it when the Gui will be ready.
You can think "why we don't used the GUI", and the reason is simple. I'm refactoring this part of the engine.
But we will be able to use the GameObjects or DOM, so if you like this method (or to append GUI on a GameObject directly) this will work.
Okay if you launch the html file you should have a button "Play" in the middle of the screen (if you click you'll get an error obviously we didn't created the startGame function)

The Player

Important first step with the engine. Classe's inheritance.
I didn't make a "extend" method, I don't like that, you provide an object as constructor, you use "this" inside methods but not inside the constructor, and btw you can't make private methods because you are inside a json object.
Go in Player.js and replace the content by this, we can directly set custom attributes

We created a customized GameObject, first we call the GameObject, then you can write your attributes and methods inside the function or add them later in the prototype.
At the end, we make the rest of inheritance by setting the prototype, redirecting to the good constructor, and the super (to GameObject).
After this you can set prototyped method.

Create the Player and add it to the scene in Game.start before setTimeout (I won't say it next time :p)

Wooow, but that's not exciting yet.
Go back to Player.js, we are going to make it moving and firing!
Add inside the main Player scope (because we use private attributes) the following methods.

And in the prototype

Ok, it's time to explain.
We added the method init (when restart game), checkPos (provide area limits), checkInputs (to control the ship), fire, flip (little feature to dodge by flipping on the sides), createGui (create heart and restart button), getDamage in the prototype and updateAxes in the prototype.
Each function seems to me eloquent so I don't explain each of them (you knows JavaScript) but I explain the engine features.
Look at the last lines in the main scope:

  • We registered events directly on Inputs. For gamepad's axes it's an other handler to catch forces and detect the flip depending on the value of this force (double tap to produce a flip)
  • We registered an automatism, it's something that the GameObject will call each frame but you can precise an interval (the first argument is the name for the automatism, the type is the called method)

In the createGui method we created a button "restartBtn" that trigger a restart event on mouseUp.
Bind this in Game.js (after player creation) and disable the player to don't see it in the menu:

Set the fxs volume lower

At this point you can't see your "Player" because we didn't create the "StartGame "function, add after the start function.

Nothing exceptional here, we just used the music manager, and cleaned the scene by parsing all gameObjects by checking the tag (we have to create Bullet and Enemy still )

Now if you refresh and click "Play" you can control your ship with keyboard (and with gamepad if you use chrome)
tadaaam....

Hum ok, we have some work to do to finish this "game". But you already know lot of things to be able to make games.
In the following lines, we are going to see how to delete objects, it's very simple (just call askToKill) and make some collisions detection.

Enemy and Bullet - collisions, enemy's deletion

To move a bullet, we will use the "addAutomatism" method. It's very powerfull to make some IA, and you can remove an automatism (with removeAutomatism(name)) so you can make an automatism call an other, destroying himself, etc... it's like "co-routine" in C# but more easy and "clean" in my opinion :)
If the object is disabled, all automatisms are also disabled.

If you want you can copy Enemy.js, Bullet.js and datas.js from the custom folder in the sample, and this will be finished, anyway I paste code here.

Open Bullet.js

Open Enemy.js

As you can see in Enemy and Bullet, to test a collision, we call CollisionSystem and the needed method (here circleCollision) returning a boolean true if there is a collision and false if not.
This is not physics, trigger only, but enough for a Shoot'em up (and for lot of games).
In the Game.js at the end we add:

And to make it work, don't forget to add it in the customLoop.js
The customLoop is like an automatism but it's general. Not for a specific object.
In the most cases, I didn't use the gameLoop because I do all my stuff with automatism

The datas to generate waves

In datas.js we create datas enemies, and datas waves. You can copy directly datas.js from the original sample

Here you have a great base to make a shoot'em up.
It's easy to make it better, some ideas if you want:

  • Bind gamepad on menus (like in our Pongarena
  • Make more complex pattern (a pattern for fires)
  • Add background scrolling (use a GameObject's pool)

Hope this was useful, and it was giving you a good sketch about the engine possibilities and methodologies.
If I made mistakes please report it on Twitter/Fb/Reddit.
Good code and Have fun

Grunt the game

Nothing is most simple, get npm modules (look package.json) and launch:

  • grunt: copy img, audio in the folder release/_common, grunt for the web, grunt for w8
  • grunt web: grunt the game.js for the web in release/web
  • grunt win8: grunt the game.js for Windows8 in release/win8

If you want add platforms, do as the same as I already do in compileSettings.json (and you have to create the customized files fot the platform, look in _dev/js/platforms/w8)

Finger in the noise

Finger-Rocket is a ciruclar tower defense, protect your planets in the space, against asteroids rains and some other.
Don't forget you canc ontrol your missiles with your fingers!
Early-alpha avalaible now!

Play

...

Finger-Rocker

A circular tower defense, protect your planet against asteroids

Play

Global Game Jam

Here is a game made during the Global Game Jam 2014, a plate-former beat them all with scenarist ending.
More on the global game jam website

Play

...

GGJ14 - Look at You

A scenarist plate-former beat them all.

Play

The Sample

You are new with the Dreamengine ? Here is a good way to start.
Follow our "how to" to make this game using gamepad, sounds and more.

Play

...

Shmup Sample

A great sample to start with the engine

Play

Immediate multiplayer fun

In this game, you can play with your friends or against the computer.
Make some big precise fire or a firing rain!
Released!

Play

...

Pongarena

Play this nervous arcade game with your friends. Easy to learn, hard to master !

Play

Stab your friends and say "Thank you"

Bio-carnage is a procedural multiplayer dungeon crawler.
Shoot with the arrow keys and use ZQSD or WASD to move.
Early-alpha, no multiplayer, no advanced features, stay in touch.

Play

...

Bio-Carnage

Can you reach the core of the infested starship ? A totaly random new dungeon each play.

Play

Choose-your-own runner

Tribal run is a runner where every types of platform has a new mechanics.
Try no gravity, fly between walls, run upside down...
Play with your friends on keyboard, with gamepads, or touch device.
Beta release!

Play

...

Tribal-Run

Wich one will make the better run ?
play with your friends up to 4 !

Play

GGJ15 - GFY

Made by a team of 2 during the Global Game Jam this game use platform engine sample and is playable with gamepad.
More on the global game jam website

Play

...

GGJ15 - Go F*ck Yourself

A versus game

Play

GGJ15 - Game of Life

The game of life
More on the global game jam website

Play

...

GGJ15 - Game of Life

A life management strategic game

Play

ARTE - Speedfarming

Speedfarming is a serious game about farming in cities.
More on ARTE website

Play

...

ARTE - Speedfarming

A Serious game about farming

Play

Solitaire

Simple solitaire card game
This game isn't free to use and is it the property of a company.

Play

...

Solitaire

Simple solitaire card game

Play

Crossword

Simple crossword game
This game isn't free to use and is it the property of a company.

Play

...

Crossword

Simple crossword game

Play

Sudoku

Simple sudoku game
This game isn't free to use and is it the property of a company.

Play

...

Sudoku

Simple sudoku game

Play

Eat this Cake

A boulder dash-like game
You like cakes and candies ? This game is definitively for you !

Play

...

Eat this Cake

A crazy boulder dash for those who like cakes

Play