Recently I’ve been trying out Stencyl, which is a game making framework, based on MIT’s Scratch, which publishes to Flash and iOS. Version 2 uses Actionscript, but the new version currently in beta uses Haxe NME for more speed and ease of publishing to more platforms, including Android.
If you’ve never used Scratch, it’s a program that allows you to code by snapping blocks together, with blocks shaped to only fit into certain spaces. Stencyl builds on this concept, and introduces elements to make creating games easy, such as physics (Box2D), animation and level building. It also comes with a number of sample games covering the main types, so you can start with one of those and customise it as you like.
My experience so far has been really positive. I’m using the Beta version, so things aren’t quite as smooth as they will be, but the developers (and other users) are very active on the forums and have sorted out my problems very swiftly. I was able to get a working space invaders type game up and running within a few hours, working from the tutorial, and then moving on to adding more complicated behaviours to put some more fizz into the game. It’s this ease of use that really makes Stencyl worth using, getting you past the tedious set up that normally goes into making a game and straight into doing the fun stuff.
The main paradigms are Actors, Behaviours, Groups, Tiles and Scenes. Actors are anything that require behaviours, so these could be the player character, enemies or things like platforms or doors that require special treatment. Behaviours are the meat of the game, and cover all the things that an Actor can do, for example, Walk, Jump, Attack and so on. These are reusable between Actors, so you can simply assign the behaviour to anything that needs that action. You can also reveal properties so that they can be customised, so you might reveal a height property for your jump behaviour. Groups are used to provide separation between Actors, so you might have Players, Enemies, Platforms, etc. as Groups. Behaviours can check whether an Actor belongs to a particular group and customise its actions based on that. Groups are also used for collision detection, and you can specify which groups collide with which. Tiles are background or foreground objects, and cannot have behaviours attached, other than whether they are collidable or not. Scenes combine all the previous elements together to produce levels, menu screens and so on.
There are downsides to using a framework rather than coding directly. Although you can write code directly in Actionscript/Haxe, this isn’t encouraged or documented. The method of grabbing and snapping together code blocks can feel a bit clunky at times, especially if you need to make a small change like changing a < to a >. In order to do this, you have to pull out the block, find the new block, add it in, move the arguments from the old block to the new one and then drag the old block to the bin. However, a right click gets you to the most common blocks, and there are dropdowns on the code spaces which give you the blocks you can use in that context, so it isn’t too onerous. There are also occasional glitches, either in the behaviours (although the ones created by the core team are solid) or in the physics engine because it’s not entirely suited to arcade style games. The developers are working on a “simple physics” mode which should hopefully combat these issues in games where the full power of Box2D is not needed.
The main advantage of Stencyl for me though is workflow. Rather than having coders, designers and artists working separately, and the final responsibility of creating a build in the hands of the programmers, Stencyl allows everyone to work much more closely - the programmers can create behaviours and then pass them over to the designers to tweak the values, while the artists can work on the animations and backgrounds, all running in the game directly. Because the behaviours are easy to read, code savvy artists can modify them, and because the whole system allows you to get up and running so quickly, you can get into iterating your game design at an early stage. Anyone can create a build without technical knowledge, so it becomes much easier for each person or team to iterate on their work without having to disrupt the others.
All in all, while it has it’s flaws, Stencyl is proving to be a great framework which provides a powerful and simple way of creating games.