Skip to main content
platform - Copy

Creatine 1.0.0!

Ludum Dare is great! Not just because it motivates me to create (and finish) a new game, but also because I use it to update Creatine. So, as usual, after the compo I’m releasing another version creatine, now the release 1.0.0!

This version is big. It has a lot of new stuff and a lot of changes for the old features. But before talking about the modifications and additions to the library, let me talk about how I was felling about creatine 0.2…

To be honest, I wasn’t happy about the previous version, I added several classes to handle storage, sound, layout, scenes, among other things. But they weren’t working together, there were some annoying bugs (in special with transitions) and I was spending a good time rewriting the same base structure for new games, over and over.  So I decided to rethink some things: how can I make my development easier and faster? My conclusions and desires after that:

  • I want to use a visual editor to build my scenes, something like Overlap2D or one tool of my own.
  • I need more flexibility for fast prototypes (sometimes I just want to test some idea).
  • Modularity is cool, but is not a great deal. A class that controls all modules would be more useful and would save some time by eliminating the base common structure that I was rewriting every project.
  • I need more fluffy things, more juice, which means that have to be easy to add particles and visual or sound effects to the game.
  • I want to have a physic system and other predefined behaviors easy to use in my games (such as a platform system, or 2d top-down movement and collision system).
  • Other details that I don’t remember right now (it is Sunday 11PM, give me a break!).

With these things in mind, I started to update creatine.

Game

The main addition to creatine is the Game object. The game is now the core of my library, because it is the responsible to create and initialize all game systems. For example: it is the game that creates the canvas element; the game also stores all creatine helpers (now called managers), such as the director (SceneManager), the device,  display and many others.

The game class is based on Phaser core, so if you know Phaser you may find this familiar. A game has 5 states: ”boot”, “preload”, “create”, “update” and “draw”. In the boot state you can initialize 3th-party libraries and some configuration of the engine. In preload, you will set which files should be loaded by the engine and may be show a preload scene. In the create state you will create and initialize all game objects, including scenes and object pools. The update and draw states are the main loop, and are executed every tick. You can use these state by passing functions to the game:

The first argument of the Game class is the configuration object. This could be only an url to a JSON file containing the configuration. Notice that, with this, I will try to keep all engine data-driven, so you will be able to configure everything using this parameter. Right now, it has the following default values:

To set configuration you can do:

or yet:

where ‘myconfig.json’ is the json file containing the configuration values.

Resources and Factories

Creatine now have an interface to PreloadJS (the ResourceManager) and a factory manager. The resource manager helps you to load general assets in a more pleasant way and also helps you to load specific assets (such as spritesheets and audiosprites) in an easier way. For example, now you can set which files you want to preload in the preload state:

Or you could define these assets in the manifest (pretty much like how you do with PreloadJS):

With your stuff loaded, you can create objects easier:

 

Scenes and Transitions

Scenes now have some default method that you should override to use, such as “enter”, “pause”, “resume”… To create a scene, you must define a new class inheriting the scene class, an easy way to do that is by using the new shortcut:

You can also create your scenes before starting the application and register them to the director, using an unique identifier:

Transitions are now working as they should be! You can use any transition in any function (replace, push or pop), repeatedly, or without having to wait the current transition.

Input handlers

We have input now! Keyboard, gamepads, mouse and touch. They don’t work together yet, but they are pretty cool already. Instead of putting code here, I suggest that you take a look into the creatine example folder and into the API documentation.

In the next releases I want to create a common Input or Control object that group all type of inputs together. So instead of checking the state of the keyboard, mouse and touch, you could simply check game.control.isDown('action a') . Moreover, you should be able to redefine the input commands.

Particles!

Particles are so so so so cool! Creatine uses the cocos2d particle style. So if you want to create some fire you do:

Unfortunately, the current particle system has some limitations. For example, it cannot change the particle colors due to performance. It also must be updated manually, sometimes I forget that!

Sounds and Storage

The SoundManager is simpler now, it does not separate music from sound effects, but you still can add sound groups to it. The coolest thing is that sound works together with the StorageManager, so when you change the volume or the mute, the sound manager stores this information locally and you don’t have to worry about that anymore!

Legacy Stuff

Some things will be changed to a better structure, such as the layout managers and the custom display objects. They are still in creatine but they weren’t updated this time.

Moar of Creatine

To now more about new stuffs in creatine, check it out:

You can also contact me for any doubt or suggestion.

icon

Beneath The Sea and Ludum Dare 29 Results.

Beneath The Sea is the game I created to Ludum Dare 29, under the theme “Beneath The Surface“. In this post I will talk a little bit about how was the process to create it, including all the good and the bad things that happened on the way.

icon

The Game

As all Ludum Dare games (in the solo competition), this game was created in 48 hours. Well, actually, it was around 30 for me.

Initially, I was thinking in creating a platform game using physics and tiles. The player would have to run, jump, grab and climb to make his way out from a desolated and unknown cave. I would like to related this “run-away-from-a-dark-cave” game with clinical depression and how hard is to be free from it and how easy it is to fall into this dark cave.

That wasn’t going very well. I’ve implemented the tile system using CreateJS and Tiled and integrate the physics engine. But after 12 hours, I’ve realized that it is pretty hard to create a good platform game. I mean, you have to tweak a lot of variables to make a satisfactory gameplay. To make things worse, my plan also included pixel art, but I also realized that I have no idea how to create pixel art!

So, in half Saturday, I forgot my first idea and had to formulate a plan B. Now, I wanted to create something simple, using only the mouse or a single key button, and I wanted to create something using vector art, because I can do it on Inkscape pretty well.

Last week I was taking a look into the Orisinal games, and I remembered their Silent Water, which is an example of simplicity and which I could based my game.

With these conditions and references, Beneath The Sea came up. I thought in put the player in the charge of a battleship with the task of killing the evil summons of an ancient badass god, holding them as long as he/she can. I know that this isn’t an original idea, but it was what I could do with the 30 remaining hours.

Graphics

I’ve started with the background and the core sprites because I think it is easier to see want you will need in the game – despite the fact, that is so much better to program a game with pretty graphics.

I choose to use only silhouettes to represent the battleship, the bullets and the creeps because it was the easier and faster alternative I could find. Silhouettes also have the advantage to work well with a various graphical styles.

The background was based on classical vector art tutorials, other water games, and sponge bob. If I had more time, I would make the clouds, sun and water animated. I also wanted to put some bubbles and explosion effects, but the time was short.

Programming

Programming Beneath The Sea was pretty easy. I used the CreateJS bundle and some utilities functions (such as scene management, scene transitions, layout management and flexible images) I had here. Notice that, you can only use personal code if you make it public before the beginning of competition.

The code logic is pretty simple: create creeps and make them go toward the surface; create bullets and make them go toward the bottom; check collisions among bullets and creeps; check collisions among the ship and creeps.

Then, after a long night of work, and an exhausting Sunday morning, I had the games mechanics ready to go.

Sounds

Sounds were my biggest problem. I had no previous experience on audio edition or composition and I only know how to use Guitar Pro.

As a priority, I created the main music, which is the most important audio in the game. You can’t put several sound effects without a background music! I’ve based on the Terminator theme, with a lot of bass beats. After trying several instruments, melodies and combinations, my music was complete.

For shoots sounds I’ve used drum beats amplified and equalized on Audacity. To the explosion I’ve recorded the sound me lightening a match, and slowed and equalized it on Audacity. Finally, for the overheat signal I’ve just whistled.

I hate the sound effects I put on Beneath The Sea, I had just a few hours to finish the game and I still needed to adjust the gameplay and the kongregate api.

Gameplay

I’ve tweaked the gameplay as fast I could. I added the overheating system to control the bullet flow and created a mechanism to increase the spawn rate of creeps and weapons relative to the time.

Summary

Based on my experience on this Ludum Dare, I can summarize some important things:

  • Keep It Simple, Stupid! I didn’t followed the KISS principle when I was creating the conception of the game on Friday night. As a result, I’ve lost a lot of precious time.
  • Do what you know. My first plan involved too many technologies, mechanisms and techniques that I am not familiar with. You can’t learn everything in 48 hours.
  • Take a break, periodically. The lack of sleep and fatigue are your enemies. Without sleep, you can’t concentrate very well, so you need to take some breaks periodically to rest a bit.
  • Make TODO lists. Without concentration, you lose efficiency and time, so, make TODO lists to keep tracking what you are doing. Before starting the development of the game, create the TODO of the features. Before starting each feature, make a TODO of the tasks need to complete the feature. Before each task, make a TODO of simple changes and additions to the game.
  • Prioritize the features of your game. You probably won’t finish your game, so, prioritize the core features. If you finish the important parts and got some time, then you can do the fluffy things.

Results

Check it out the screenshots of the game:

You can play Beneath The Sea on kongregate

You can see the entry on Ludum Dare

HTML5 Logo

Local Storage in HTML5

Almost all games needs to record certain information about the player progression. For example, you may want to have a local leaderboard to track the player best results of each round, or the story progression, or the name of the player, etc. Sometimes is interesting to record these kind of information even after the user closes the browser and turn off the computer, thus, the next time a user comes back to your game, the progression is saved there.

HTML5 provides a feature for this kind of offline storage, called Local Storage. The concept is similar to cookies: you have a key-value storage system and you can write or read information locally with it. It is really basic, all you have to do is:

and you have an information stored in the user computer. The user can close the browser and turn off the computer but when he or she opens you game again, the information ‘key = value’ is still there.

The problem is when the browser does not support the HTML5 Storage feature. When this is the case, you need to use a third party library for offline storage, store the information into some server, or don’t save the information at all. The third option is the easier (if storing information is not essential), because you don’t have to change all your code, just define a stub localStorage object and the life goes on.

A beautiful way to detect if browser supports localStorage or any other HTML5 feature is using the Modernizr library. Thus, you can add the following verification to your code:

Take a look at http://html5demos.com/storage to see an example.

CreateJS Logo

A Humble Introduction To CreateJS Suite

CreateJS Logo

CreateJS is a great suite of modular libraries and tools to make HTML5 games and other interactive applications. In the core of CreateJS, there is 4 libraries: EaselJS, SoundJS, PreloadJS, and TweenJS. These libraries are completely independent, i.e., they can be used isolated or even with other game libraries.

EaselJS is the main component of CreateJS. EaselJS controls the game loop, the event manager, the hierarchical organization of objects and the rendering system. It works above the canvas element, thus, providing an easy interface to draw shapes and bitmaps.

SoundJS provides a consistent API to use audio in different browsers. It works via plugins which abstract the actual audio implementation, so playback is possible on any platform without specific knowledge of what mechanisms are necessary to play sounds.

PreloadJS is used to preload all assets to your game, such as images, sounds, data, etc. It provides a complete API with an event system so you can track the loading progress and the connection fails.

TweenJS provides tween function for animations. It can be used independently and provide a simple but complete API to track tweening of object properties and chained commands.

Together with these four libraries, the CreateJS suite also comprises a set of tools to aid the game development process, from applications for exporting SWF animations to EaselJS spritesheets to code completion for editors.

Checkout the video below by the creator of CreateJS to have a better overview of what CreateJS is capable of.

Work For It

Getting Started With Game Development

Work For It

For a long time I’ve been reading several discussions, tutorials and posts trying to answer the question “how do I start to develop games?”. In general, the answer is “study hard, develop something, study harder, develop more, …”.

I believe this is true a even more, I think the process “study, develop” has no end. Regardless of your level of expertise, there are always more things to learn, more ideas to develop, more problems to come, more solutions to think.

Currently, I’m a researcher in artificial intelligence field and I can say I’m proficient in the programing languages that I work and the fundamental concepts of computing theory. In my free time, I’m aspiring to be game developer.

I have some knowledge about several aspects of the game development and I also have some projects in my curriculum. My goal now is to transform a hobbie into a profession and I want to register this transmutation process in this blog.

I chose to start the “serious” development with simple HTML5 games. I want to work in all aspects of a game, including the design of rules and gameplay, programming, graphics, musics and sound effects, etc. I hope to improve my abilities over time, making games more and more interesting and complex.