Skald

Last updates on Skald Engine:

Color utility functions

PixiJS handle colors by its int value (e.g., 0xFFFFFF), so I created a bunch of function to convert or manipulate colors in this format. Right now you can:

  • Convert color from/to RGB format (array, [255, 255, 255]).
  • Convert color from/to HEX format (string, ‘#FFFFFF’).
  • Convert color from/to HSL format (array, [255, 1, 1]).
  • Get the individual color channels (red, blue, green, hue, saturation, lightness).
  • Saturate a color by a given amount.
  • Desaturate a color by a given amount.
  • Covert the color to greyscale.
  • Lighten a color by a given amount.
  • Darken a color by a given amount.
  • Spin the color by the hue space by a given angle.
  • Blend two colors.
  • Tint (blending a color to white).
  • Shade (blending a color to black).

 

Utility for random generators

I also added a bunch of function to generate random numbers and other  stuff related:

  • `random.choose()` to choose a value from an array.
  • `random.inclusiveRandom()` which is similar to Math.random(), but it can include the 1 (i.e., it generates a number in interval [0, 1]).
  • `int()` to generate a random integer.
  • `polar()` to generate a number between -x and x.

Easing function and modifiers

I add more easing functions, a general bell curve and a gaussian shaped (using the normal distribution formula without the normalization term). So they can be used to generate interesting effects.

I also added two function that modifies the easing functions, one for mirroring the result of the easing (it repeat the ease function 2 times, but it invert the result of the second half), and one for repeating (pretty straightforward). I am still testing this format, so I don’t know if I’m gonna keep it.

Particle systems!

Added an initial implementation of particle system. there are some improvements to be made, but it is working pretty good.

Game config changes

I decided to remove the manifest as parameter of the game and added it as an item of the configuration. This should keep consistence among the API.

Additionally, I added a startScene and a preloadScene option, so the game can initialize and run a preload scene during the manifest loading, and start automatically the main scene when the game starts.

To help you in this initialization process, I also added a `start` event, triggered after the preload (if there is any item on the manifest), and added a default preload scene.

Scene stacking

I thought I could live without it, but I was wrong, so we have scene stacking now. Now you can add or remove scenes over the base scene (the one called with `play` method). The scenes are attached to the base scene, so if you remove the base, all scenes in the stack will die too.

 

Next steps

For the next alpha release, I want to add an event pool for event recycling (so we don’t have to create a new event instance everytime an event is triggered), and simplify the scene API. Right now the scene API is very limited and unintuitive.

Read more

About two year ago I started a game engine called Creatine, which was built upon CreateJS. I used this engine for quite some time, creating 4 jam games with it. However, I reached a point where I couldn’t improve Creatine anymore due to the limitations of CreateJS, in particular because CreateJS cannot use WebGL.

After some time without seeing anything about game development (I started in a new job, and hence my absence from this blog), I decided to start a new engine in order to enter make games for game jams again. This time, I decided to go with PixiJS, which is the status quo of 2D WebGL rendering in the JavaScript world.

But why I don’t simply use Phaser? Well, Phaser is undoubtedly a great project, with a mature code base and huge community, but I personally don’t like it. Its internal structure is confuse and I can’t understand properly (without spending a lot of time) how it works. Notice that, this is my opinion. I don’t like Phaser, but I am not saying you shouldn’t use it.

So I started Skald, my new engine, with some important pillars in mind:

  • The engine must allow me to create fast prototypes for my jam games, however, it must have a good architecture so I can create larger games with it if I want to.
  • Kind of consequence of the point above, the engine must allow me to reuse individual components, something similar to how Construct 2 works.
  • The engine architecture must be simple and intuitive, so anyone could understand what is happening under the hood.

Additionally, I would like that the engine be flexible enough so people can use it ignoring any part of it (e.g., you may rewrite how scenes and ECS works with relatively simplicity).

Right now Skald is on Alpha 2 – which means that I don’t recommend anyone to use it yet! – and the core features at this point are:

  • Game class with managers to control audio, inputs, scenes, devices, etc.
  • An extensible asset loader.
  • ECS objects. Not perfect or very strictly classic implementation, but it is working well.
  • Multiple and extensible audio systems. Right now with support to webaudio and html5 audio.
  • Support to 3rd-party plugins.
  • Scene transitions (similar to creatine).
  • Tweens, color and easing functions, and other utility functions and structures.
  • Most of the features of PIXI.

The final version of Skald won’t be released any time soon, but for the next alpha release I would like to add the following features:

  • Particles! Super important to have a particle system.
  • Scene stacking, so we can add, for example, a pause screen over the game without removing the game scene off the screen.
  • A better initialization procedure with a default loading scene (if there is anything to load).
  • Anonymous scenes and entities.

The project is hosted on github:

 

Read more