Author's Posts

As the first post of the year, I wish you all a great 2015!

This last year was crazy, lot of changes in my Ph.D., several projects, great trips. As a reminder to myself, I will summarize my activities of 2014 relevant to this blog and record the promises of new year`s resolution for 2015.

2014

In April of 2014 I created this blog with 2 things in mind: I wanted to motivate myself to keep a frequency in my Game Dev studies by forcing me to always write a new articles here; and to serve me as a development diary so I could put ideas and thoughts here and after some time, I could revisited all my steps towards game industry. After 9 months, I wrote 39 posts and got more than 11 thousands views. I received some feedback (less than I wanted and more than I expected), via comments here and email. I thank you all for the audience, feedback and discussions.

In the half of the year I finally decided what to do in my Ph.D.. After months of (almost) unfruitful areas, researches and experiments, I decided to move on and research something related to game AI development, but with the requirement to also have something to do with robotics (there is a lot of methods and models fulfill that!). After some weeks of research and lot of readings, I decided to go in the direction of Behavior Trees, once it has some nice successful applications and big support on the game industry and now its being applied on robotics.

In consequence of my developments in the Ph.D. and my studies on Game Dev, I started 2 open source projects: Creatine and Behavior3JS. Creatine is my set of tools to develop games within CreateJS, while Behavior3JS is an implementation of Behavior Trees to JavaScript. I use Creatine to create my games while I use Behavior3JS to games and to my research. B3 received a lot of attention since its release (about 2 months in this moment), it already has 32 stars and 5 forks on github (it is my most-successful project).

Talking about games, I created 3 games for ludum dare but didn’t complete a few others. I’m really happy with my games this year – despite the unfinished ones – they weren’t great games but they have their importance to me. The last game of the year was Baa-Ram-Ewe, which earned the #35 place on the competition (there were more than 2600 submissions), I am really happy with this result and I hope to do better next time.

2015

For this next year, I want to:

  • Publish some papers about BT and machine learning;
  • Update and improve Creatine and Behaivor3JS;
  • Write more than 40 posts here in the blog and receive more than 11000 visits;
  • Write more ludum dare games and finally finish some full game;
  • I plan to work on the game industry, so I decided to learn – really learn – C++.

I thank again for all comments, talks, suggestion and critiques, on this blog, reddit, github and any other mean.

Read more

Ludum Dare 31, the last jam of the year, ended up very well for me. I created “baa ram ewe“, a game where you must herd sheeps with the mouse, moving them from a thin grass to a plentiful pasture. The game has a good – and solid, for an experimental game made in 48 hours – mechanics and a good overall aesthetics, I really liked the final result of this game. I also received a lot of positive feedbacks, mostly asking me to create a mobile version, which I decided to do.

Baa Ram Ewe uses a boiding algorithm (also known as flocking algorithm) to move the sheeps, to keep them together, and to avoid obstacles and dangerous elements. The boiding algorithm is a method to simulate collective movement of animals, such as fishes, birds, sheep, etc. For example, take a look a the following video, which shows a simulation of buffaloes running:

The algorithm is very simple. All agents in the simulation follow a set of simple rules. These rules defines how each agent will move accordingly to its neighbors flock-mates. The interaction between the agents generate an emergent behavior, as you can see in the video.

The rules used in these kind of simulation are really simple. Commonly, all boiding applications have the following ones:

  • Separation: the agent must avoid the nearest flock-mates by steering away from them;
  • Alignment: the agent try to head to the average position of the nearest flock-mates;
  • Cohesion: the agent try to move to the average position considering the nearest flock-mates;

You can see a visual example of these rules on the figure below (copied of the Craig Reynold’s site, the creator of this algorithm)

boiding_rules

(a) separation rule; (b) alignment rule; and (c) cohesion rule. From (http://www.red3d.com/cwr/boids/)

In Baa Ram Ewe, I used the algorithms presented by Conrad Parker in his site as basis. Summarizing, I have a FLOCKING function that moves the sheeps accordingly to a set of rules:

FUNCTION FLOCKING
  VECTOR v1, v2, ..., vN

  FOR EACH boid IN boids
    v1 = rule1(boid)
    v2 = rule2(boid)
    ...
    vN = ruleN(boid)

    boid.velocity += v1 + v2 + ... + vN
    boid.position += boid.velocity
  END FOR EACH
END FUNCTION

As you can see, you can define any number of rules, but be careful with that! More rules mean more complexity, you probably won’t be able to generate the behavior you want. Check it out the Conrad Parker site to a nice description of the basic rules.

See

 

 

Read more

Following the new milestone of CreateJS, I just released Creatine 0.2.0!

This version has some cool new additions to the library:

  • Tile Maps: now you can load maps created with Tiled by using the new TMXMap. It supports all maps projections of tiles (orthogonal, isometric and staggered) and all type of layers (tile, image and object). Check it out the examples.
  • Jukebox: a helper class to handle music and sound playback. With this class, you can set different volume setting for music and sounds, and play random sounds from a group.
  • Storage: a helper class to handle persistent data using the HTML5 localStorage. With this class you overcome the type limitation in localStorage (it only accept string variables) and , thus, can save and retrieve objects, numbers, arrays, etc.
  • Entity-Component-System: a ultra basic implementation of ECS model, I hope to provide more features in the future.

Moreover, there are some other modifications on the existing features:

  • Sizers now manage scale and registration point properties of children.
  • Fixed an initialization bug present in several transition.
  • A complete update to the class and inheritance model of creatine, following the new style of CreateJS.

Together with this new version, I also published the new website for creatine (the old one http://guineashots.com/creatine now redirects to the new site):

http://creatine.guineashots.com

Right now I’m updating my boilerplate to follow the new releases and to include a new improved architecture.

Read more

This week we finally had the new release of CreateJS, with a lot of changes, starting with the new site and new visual identity! All libraries (EaselJS, PreloadJS, TweenJS and SoundJS) have major updates that improve performance and the architecture.

Some important updates:

New class model with performance improvements:

In the old CreateJS, attributes were defined in the classes prototypes. By moving the definition from prototype to instance, EaselJS could decreases the canvas update time (by stage.update) in more than 2 times (a 100%-150% improvement).

The tick propagation was also improved with a small change: the tick event is reused for all display objects through the propagation of the tick, i.e., the tick event is instantiated only a single time. By avoiding redundant instantiation, the tick propagation has also an improvement of ~100%.

See:

New inheritance model

The inheritance model were updated following the modification of the class model. Now, if you want to inherit some class in CreateJS, you need to use createjs.extend and createjs.promote.

The createjs.extend function set up the prototype and constructor of a new class. The code is pretty simple:

createjs.extend = function(subclass, superclass) {
    function o() { this.constructor = subclass; }
    o.prototype = superclass.prototype;
    return (subclass.prototype = new o());
}

 and this function must be called right after the creation of the new class constructor.

The createjs.promote back up the superclass methods that were overridden. For example, if you create a FlexibleBitmap inheriting from Bitmap and override the method draw, createjs.promote back up the method bitmap draw by creating an alias Bitmap_draw inside the new FlexibleBitmap.

See:

All classes now implement properties for getters and setters

Some changes are pretty straightforward, e.g., Container.getNumChildren() is now replaced by Container.numChildren; but some names have been updated too, e.g., Ticker.getFPS() is now Ticker.framerate. Using properties instead of getters and setters is a good practice, nice to see that on CreateJS.

See:

Other updates

See https://github.com/CreateJS/EaselJS/blob/master/VERSIONS.txt for a full list of changes.

Read more