Book Review – Marmalade SDK Mobile Game Development Essentials

I recently obtained a copy of a new book called Marmalade SDK Mobile Game Development Essentials by Sean Scaplehorn, which is currently the first and only book available that covers the Marmalade SDK. The Marmalade SDK is a cross platform game and app development system for a number of mobile devices including Android and iOS, which I have been using now for a few years. With this book being the first and only book and considering that I had spent so much time writing tutorials to help bring would-be Marmalade developers get up to speed that I felt inspired to review this book. In addition, I was approached by Packt publishing some time ago to write this book, but unfortunately due to my busy schedule I had to forego the opportunity. So once I heard that the book was out you can bet I’m gonna read and scrutinise it :)

Ok, the first thing I do with all new books is take a scan through the chapter list to see how much content is there, I can usually judge a books value from the contents pages. I’m happy to say that this book passed my initial contents inspection. There’s quite a lot of content squashed into a relatively short book.

The book begins with a short introduction to the Marmalade SDK, including step by step instructions on how to install and setup Marmalade on your computer. It then moves on to building a fairly simple Hello World application complete with a step by step explanation of each of the parts of the program. The book then progresses on to explain many of the Marmalade API’s, below I will cover each section of the book:

* Resource management – This section covers Marmalade resource management. You should pay particular attention to this section as resource management is one of the most important things to get right when developing cross platforms apps.
* 2D Graphics – This section compares IwGL, IwGx and Iw2D then goes into in-depth details of IwGx (my favourite Marmalade graphics API), including materials, streams, textures and polygons
* User Input – This section covers detecting key presses, touch screen (including multi-touch) and accelerometer (would have liked to have seen compass covered also). Gestures sample project is good as it shows how to detect swipe and pinch gestures, something many developers have trouble with
* 3D Graphics – This section has a short introduction to 3D graphics, followed by an explanation on how to render 3D shapes with IwGx (polygon by polygon),, description of view / model matrices. The chapter then moves on to show you how to get data from popular packages such as Blender / 3DS Max into a format that Marmalade can use using the Marmalade supplied exporters. Finally the chapter covers rendering exported 3D data using Marmalades IwGraphics API.
* 3D Animation – This section covers basic PAS animation using matrices, morph target and bone animations, although morph target animations are not covered as in depth as I would like to have seen. I did however have a fair bit to learn from this chapter.
* Fonts, User Interfaces and Localisations – This chapter starts out by covering IwGxFont and bitmapped fonts, including building bitmapped fonts from Marmalade Studio Font Builder. I will admit that I personally prefer and would recommend looking at true type fonts instead (see IwGxFontCreateTTFontFromBuffer for reference) as you do not have to deal with intermediate tools such as the font builder. The author briefly touches on IwUI and IwNUI for user interfaces but opts to roll his own solution which I completely agree with because IwUI is difficult to get to grips with and IwNUI is only supported by Android and iOS, although I would have liked to have seen IwUI / IwNUI covered in a separate section for completeness.
* Sound and Video – This chapter covers playback of compressed audio (for in-game music), playback of sound effects and video playback.
* Support a wide range of devices – This chapter has to be by far my favourite. It not only covers handling different device capabilities and screen resolutions (things that will plague you unless you get the right at the start), it also covers other topics such as dealing with application configuration files, multiple resource sets and compression. This is a must read section, even for advanced Marmalade developers
* Social media and other online services – This chapter covers logging in and out of Facebook as well as posting information to the users wall using the Facebook Graph API. It briefly explains other services that are available but doesn’t venture into any of them with much depth. Hopefully a 2nd edition will delve deeper into these services.
* Extensions Development Kit – If you are coming to Marmalade from iOS or Android and have libraries of code that you would like to use in your Marmalade project, or maybe you want to simply integrate a 3rd party iOS or Android specific API into your app then the EDK is essential for you. The EDK enables you to call those libraries from Marmalade without too much hassle. The Marmalade EDK is impressive and this section is definitely worth absorbing. The author covers the creation, building and usage of an EDK extension for Windows, iOS and Android, providing an excellent step by step introduction to the EDK.
* The skiing app – I must say that I am impressed with Seans example skiing game, he not only provides a 2D version, but also a full 3D version. The code contained in these apps is invaluable for beginners.

In summary, I think that Sean Scaplehorn has done a great job and I would recommend this book to any would-be Marmalade developer, even seasoned Marmalade developers may have a few things to learn from it. I thought I knew just about everything about the Marmalade SDK, but this book proved that there are still a few corners that I need to investigate. I can say that I wish that this book was available when I first started my Marmalade journey. Marmalade is not the easiest of SDK’s to learn to use, but it is the best in my opinion, so its worth the time and effort to learn it properly and go on to create wonderful things. This book will help you along this journey much quicker than stumbling around in the dark the way I did when I first started using Marmalade. The accompanying sample code is also well written and well commented providing a good starting point for your own projects.

Overall I give the book a 9 out of 10. I would liked to have seen more coverage of the likes of True Type Fonts, In-app Purchasing, IwHttp and IwNUI. If a 2nd edition is forthcoming and these sections are covered then I could quite easily give an extra point.

IwGame Engine 0.4 has Landed – Massive Update, Lua, Camera and more

New here? What’s IwGame? IwGame is an open source free to use cross platform game and app engine for iPhone, iPad, Android, Bada, Playbook, Symbian, Windows Mobile, LG-TV, Windows and Mac, built on top of the Marmalade SDK. You can find out more and download the SDK from our IwGame Engine page.

Its been a long while since we did a major update of the IwGame Engine, but we have one heck of an update for you today. We have a huge number of new features, changes and bug fixes for you.

We’ve also got a slight license update. Basically the new license says that if you use IwGame then you MUST credit the IwGame either in the app / game or on the apps support web site. A VERY small price to pay for such a huge and useful engine that has taken many man months to create, test and maintain. If you cannot live with the license terms then we are willing to forego the terms for a small fee or hire one of our teams to create your project (get in touch to discuss)

Lets take a look at the complete change log:

IwGame 0.4 Changes:

  • AppEasy for Marmalade Project Manager and Apple Wizard tool added, easy wizard to help guide developers through the Apple iOS sign-up, certificate generation, provisioning etc..
  • Over 60 XOML / Lua examples added showing how to use the many parts of the IwGame engine core
  • New XOML documentation added, outlining the complete XOML and Lua API’s in depth
  • Lua API added which enables apps to be developed without C++ or a combination
  • New Script resource type added which enables scripts to be included via XOML. Globally declared scripts will exist in the global script space, whilst scene local scripts will be local to the scene
  • Support for Video Camera streaming added (IWGameCam)
  • New XOML resource type added that enables declaration of Video cam in XOML and streaming to a image (CIwGameVideoCam)
  • Sound effects have been moved into the XOML system. You can now define and play back music and sound effects from XOML
  • New RemoteReq XOML type added that enables you to make POST and GET requests declaratively
  • New XOML actions added / old ones removed
  • FromTemplate – Instantiate a XOML template from an action
  • PauseTimeline – Pauses a a timeline
  • CallGlobalScript – Calls a script in the global script space
  • ChangevideoCam – Modifies a VideoCam instance (start / stop)
  • Activate / Deactive scene removed
  • CallScript – Calls a script
  • Inline – Executes script inline
  • RemoteReq – Executes a remote request
  • Action / command parameters now support 5 parameters instead of 4
  • CIwGameActionsManager now supports removal of actions with removeActions
  • Actors / Sprites now support Orphan feature which enables them to be displayed outside their normal parent-chld hierarchy. This enables them to be layer sorted with other actors
  • Actors now support percentage positioning using the new PercPos actor property. When PercPos is set to true the actors Position property is classed as a percentage of the devices screen size
  • Actors / Sprites now have a new property called IgnoreCamera. Actors with this property set to true will ignore the scenes camera transform
  • Actors now have getProperty() method that can be used to retrieve actor properties
  • Actors now have an OnTick event that can call an actions list each time the actor is updated (each frame)
  • Actors have other new methods including CheckCollisionRect(), getDistanceBetween() and getAngleBetween()
  • Actors have many more properties that can now be set from XOML
  • Actors can now handle up to 5 simultaneous Begin / End touch and Tapped events in XONL
  • IwGameAds now sends correct user-agent for iOS and Android
  • CIwGameAnimTimelinesManager now allows removal of timelines
  • Image Brushes now support setting of UV coordinates directly using new UV property
  • XML parser pooling system changed from global to per XML parser instance, pools are auto calculated. This eliminates the need to set up XML pools.
  • Files can now transfer their data into a script when loaded
  • CIwGameImage has been extended to support CIwTexture instead of CIw2DImage, also now supports dynamic images that can be modified
  • CIwGameImage now has SaveBmp(), SaveTga(), SavePng() and SaveJpg() methods
  • New CIwGameModScript modifier added to enable actors / scenes to call scripts
  • Commands can now be conditionally executed using conditions
  • New Commands added to program system – add_var, get_var, if_var, call_script, call_global_script, inline, from_template, music, sound, wait, debug_text, remote_req
  • ChangeProgram action now supports restart command
  • Scenes now support new ScriptEngine tag which defines which script engine the scene should use
  • Scenes now support setProperty() and getProperty()
  • Scenes now have an OnTick event that can call an actions list each time the scene is updated (each frame)
  • Scene allos setting of physics time step with new PhysicsTimestep property
  • Most sprite, actor and scene parameters that were fixed point based and now floating point based
  • CIwGameSprite now has new methods SimpleTestOverlap() and TestOverlap()
  • CIwGameBitmapSprite now supports direct setting of its Uv coordinates
  • WebView (CIwGameUIWebView) completely reworked. Now uses device coordinates and can now show dynamic html / javascript
  • XOML variables can now be made persistent so that their values are saved and restored between sessions
  • XOML array variables can now be populated from comma delimited data, elements will be split at commas
  • Variables can now be removed from CIwGameXomlVariableManager
  • New CIwGameSettings class added that is used to save and restore engine settings. Currently controls debug trace output level and enable / disable device power saving
  • Many new error checks and error / warning messages added throughout
  • Slider, Imageview and TextView now support binding to integer variables
  • Labels and TextViews now have a new property TextUseParentOpacity. When set to true the labels text will scale its opacity by the label images opacity, default is not to scale
  • ActivateScene and DeactivateScene actions removed, activation / deactivation rolled into resume / suspend
  • Actors with no size or SrcRect defined will default to 100% proportional sizing
  • SetVar action now supports the generation of a random number in the same way that set_var command does
  • SetVar action and set_var command when called on an array will now fill the whole array, including the random version
  • SetVar action and set_var command now support generation of random characers with randchar
  • P1, P2, P3, P4, P5 can now be used instead of Param1, Param2, Param3, Param4, Param5 for command and actions parameters
  • All commands can now accept variable substitutions for parameters
  • Conditions can now be used on arrays for string searches, number comparisons etc..
  • Added new system variable array called touches. This array of integers represents the x, y, touched status of 5 simultaneous touches
  • Variables passed as action and command parameters now cached to speed up access
  • Raw script can now be executed inline using the new “Inline” action and “inline” command. P2 specifies scene in which to run the script (omit to run in global script space)
  • Actors that have Draggable set to true will also set Hittest to true unless you override it
  • All files are now Preload and Blocking by default
  • If you now try to add a resource that already exists in the scope it is loaded then a warning will be displayed and the resource will be overwritten
  • WebView now supports new Html attribute which can be used to pass html to the web view to be displayed
  • WebView now works in screen coordinates and not virtual canvas coordinates
  • Actors now have new UserData property that can be use to store a single integer, can be used to store index into script table / array for additional data
  • Html Ads are now integrated via the web view (see section 20 of XOML User Guide)
  • WebView now has OnError event handler which is called if the web view is not available
  • VideoCam now has OnError event handler which is called if camera fails to start
  • TTF local font loading reworked to use memory buffers
  • String class optimised to minimise memory allocations and data copying
  • String class now supports Occurrences() and Split() methods
  • Internal slot array optimised to reduce memory allocations
  • TTF local font loading reworked to use memory buffers
  • Particles defined within a Particle Actor have a new property called Attached. When set to true the particles will follow the emitter, if false then they do not.
  • Image brushes now have a new Tiled property that allows you to enable / disable tiling of the brush
  • BUG FIX: Sprites no longer appear at origin on first frame
  • BUG FIX: Fixed problems with CIwGameAnimInstance
  • BUG FIX: Scene layering fixed and optimised
  • BUG FIX: Crash when deleting or adding scenes at the same time as removing them
  • BUG FIX: Scene layers now taken into account when processing touches
  • BUG FIX: Patch9 based actor clipping bug fixed
  • BUG FIX: Text margin for labels now fixed
  • BUG FIX: Crash when assigning invalid timeline to scene
  • BUG FIX: Template parameter case issue fixed
  • BUG FIX: Nop command now returns immediately
  • BUG FIX: Crash when not assigning brush a type. Defaults to Image with a warning
  • BUG FIX: WebView was not positioned correctly when scene origin was set to something other than centre
  • BUG FIX: Web view now works on iOS and Android (does not work on Windows)
  • BUG FIX: AspectLock fixed
  • BUG FIX: None batched sprites now render correctly at edges
  • BUG FIX: Deleting particle actor that was child of another actor crashed when removing particle actor
  • BUG FIX: Particle actor placed inside parent actor didn’t scale by parents opacity when UseParentOpacity set
  • BUG FIX: Particle angvelmode, scalevelmode, depthvelmode names corrected
  • BUG FIX: Empty Param2 in FromTenplate action / commands crash
  • BUG FIX: Fixed changing orientation resizing
  • BUG FIX: Touch panning glitch fixed
  • BUG FIX: Crash fixes in CIwGameDataFile
  • BUG FIX: Compass fix
  • BUG FIX: Actors OnCreate event was not working
  • BUG FIX: Deleting scene crash
  • BUG FIX: Crash when invalid animations added to a timeline
  • Many other small additions and bug fixes that we forgot to note :)

I did say there were a lot of changes :)

Lets separate some of the changes and take a look at what they mean to IwGame Engine users:

Moving Towards a Portable Engine

We have decided to make IwGame portable as we no longer see the iwGame engine as a Marmalade learning tool. With this in mind we have started abstracting Marmalade specific code out of the main code and into its own platform section (see Marm sub folders). Over time all Marmalade types, classes, functions and constants will be moved out and replaced with a universal system that can be easily ported. We will then be porting IwGame to each individual native platform, These platforms include:

* Windows XP/Vista/7/8
* Mac OS
* Android
* Apple iOS
* Windows Phone 8
* BlackBerry OS 10
* PlayStation Vita
* Marmalade SDK

With this in mind you will have a couple of changes to make to get your existnig projects to work with IwGame. Here are the changes you will need to make:

1) Add #include “Marm\IwGamePlatformMarm.h” to your main.cpp file
2) Call IwGamePlatformMarm_Create(); at the start of main() before you do anything related to dynamic memory allocation or IwGame / Marmalade
3) Call IwGamePlatformMarm_Destroy();; right before you exit main() after you have done freeing memory and shutting down IwGame / Marmalade


By far the most interesting addition to IwGame is the Lua API. The IwGame Lua API enables you to develop games and apps without any need to fall back to C++. Just about anything you can do in C++ you can do in Lua + XOML. We want to move IwGame towards a none compiler based system where you can create great games and apps without the need for professional level knowledge of C++ or compilers or IDE’s. In fact, we have a new service for Marmalade and none Marmalade developers called AppEasy that is built upon the IwGame core that does just that and is available at

Actors can call scripts and scripts can create and modify actors, scenes and all sorts of other stuff. You can even execute inline script in XOML!

AppEasy for Marmalade

AppEasy for Marmalade has been included in this distribution of the IwGame engine. AppEasy for Marmalade is a cool little project manager that lets you organise assets, scripts, icons, splash screens, set app info and generate a fully working MKB project for you that you can build and deploy. We have provided this awesome tool to enable you to easily check out all of the new examples, as well as give you a taste of C++ free development.

Over 60 Examples

IwGame 0.4 comes with nearly 70 examples that show off the various parts of the SDK. Here’s a complete list of examples:

Accelerometer – Shows how to use the accelerometer
• ActorChildren – Shows how actor hierarchies work
• ActorCollisionFlags – Shows how to use collision flags to mask collisions between actors
• ActorConnector – Shows how to use the connector actor to visually connect actors
• ActorDocking – Shows how actors can be docked to arrange them effectively on different sized screens
• ActorLayers – Shows how actors can be layered to add depth sorting
• ActorModifier – Shows how to use actor modifiers to add additional functionality to actors
• ActorParticles – An example that shows how to use the particles system. This example builds up to 1000 animating particles at different depths over a short period of time.
• ActorPhysics – Shows how to apply physics to actors
• AdvancedCollision – Shows how to query and interact with an actors list of start / end collision contacts
• BasicActions – Shows how to use basic actions to play and pause an animation
• BasicAnimation – Shows how to create basic animation and attach it to an actor
• BasicDataBindings – Shows how to basic data bindings. This example binds properties of an actor to different variables
• BitmapAnimation – Shows how to create a bitmap animation from a sprite atlas and attach it to an actor
• ComplexProgram – Shows how to create a slightly complex program using commands that are executed in sequence or in parallel
• ConditionalActions – Shows how to execute actions based on certain conditions being met
• ConditionalImages – Shows how to load different image sets based on conditions such as the screen size
• DataGrid – Shows how to create a grid user interface component and bind XML data to it
• Demos/Happy Birthday – Shows image loading and basic animation
• Demos/SpaceGame – Shows a basic demo of an object flying through space that can shoot bullets. Lua is used to provide the game logic
• DynamicWebView – This example shows how to write html directly to a web view using actions creating dynamic web content. It also shows how to use actions to navigate web pages / sites.
• Files – Shows how to load files and bind the loaded data to a label
• Games/GameOf10 – A game written completely in XOML, including logic
• Games/HangMan – A hang man game written in XOML and Lua
• Games/RockPaperScissors – A rock paper scissors written completely in XOML
• HelloWorld – Basic hello world XOML example
• Joints – Demo that shows how to use a variety of different Box2D joints to connect actors together
• Music – Shows how to play and stop music using actions
• OverlapTest – A simple example that shows how to use script to test for overlapping actors
• PersistentVariables – An example that shows how variables can be made persistent across different app sessions
• ProgramLoops – Shows how to create and use loops in programs
• RemoveResources – Shows how to remove resources from the global resource manager
• SceneAnimation – Shows how to animate a scene
• SceneAugmentation – Shows how to add functionality to a scene after it has already been declared
• SceneClipping – Shows how to change the clipping extents of a scene
• SceneEvents – Shows how to use and handle scene events
• SceneExtents – Shows how to change a scenes extents
• SceneLayers – Shows how to layer scenes
• ScenePanning – Shows how to use touch camere panning within a scene
• ScenePhysics – Shows how to set up basic physics in a scene
• SceneSwitch – Shows how to load and switch between different scenes
• SimpleCollision – Shows how to use collision modifiers to add collision detection to actors
• SimpleProgram – Shows how to create a simple XOML program
• SimpleScript – Shows how to add a simple script
• SoundEffects – Shows how to play sound effects
• Styles – Shows how to use styles to style a group of actors
• Templates – Shows how to use templates to create multiple actors at the same time
• Templates2 – Shows how to create actors from templates from actions
• TiledBrushes – Demo that shows how to use tiled brushes to create effects
• UI_Canvas – Shows how to use the Canvas UI container control
• UI_Complex – A more complex UI example that shows a large complex virtual user interface
• UI_Grid – Shows how to use the Grid UI container control to host pre-set UI elements
• UI_Grid2 – Shows how to create a UI Grid component automatically from data
• UI_ImageView – Shows how to create an ImageView container UI control. The ImageView container supports pinch zoom / pan
• UI_Listbox – Shows how to use the Listbox container UI control to host preset UI
• UI_Listbox2 – Shows how to use the Listbox container UI control to host dynamic UI
• UI_Slider – Shows how to use the slider UI component
• UI_StackPanel – Shows how to use the StackPanel UI container control
• UI_TabBar – Shows how to use the TabBar UI container control to host different views of information
• UI_Textbox – Shows how to use the Textbox UI component to allow the user to enter information
• UI_TextView – Shows how to use a Textview UI control
• UI_WebView – Shows how to use a web view UI control to show web content
• UI_WrapPanel – Shows how to use the WrapPanel container UI component
• Variables – Shows how to use XOML variables
• Video – Shows how to display video
• VideoCam – Shows how to stream the video cam to an image and then map that image to actors
• XMLVariables – Shows how to use XML variables in XOML to pull specific information from XML files

New XOML / Lua API Documentation

The XOML and Lua API have been fully documented in an over 200 page manual that accompanies the SDK. The latest version of this manual is also available at AppEasy XOML User / Programming Guide PDF. The C++ documentation has not yet been updated with all of the latest changes so will not be available for some time.

Apple iOS Wizard

You will find that a new tool has been added to the IwGame Engine called the Apple Wizard. This handy little tool is ideal for beginners or event veterans who sometimes forget the long winded and overly complex procedures involved in generating signing certificates requests, creating developer / distribution certificates, provisioning devices, creating App ID’s etc.. Well this little tool will walk you through the whole process so it can be done in minutes.

Support for Video Camera Streaming

You can now declare a new VideoCam tag in XOML which enables you to stream the users front / rear camera to an image then display that image as an actor. Check out the VideoCam example for a cool demo.

Audio Integration

We’ve moved sound effects into the XOML system properly so you can now include compressed wav files into your apps without the need to put them through the Marmalade resource manager. You can even host them on a web server and download them as and when required, just like any other resource.

Remote Requests

We’ve made it possible to construct POST and GET requests in XOML and send and receive responses from XOML / Lua. This is a very interesting new feature that enables communication with web based services declaratively.

Orphan Actors and Sprites

A number of users have made comment regarding not being able to depth sort child sprites, well we’ve found a workable solution for you that doesn’t break our API. You can now set actors as “Orphans” by adding Orphan=”true” to their declaration. An actor that is orphaned will be taken out of the normal sprite parent / child hierarchy allowing it to be depth sorted with parent regular actors

Percentage Based Positioning

It became apparent to us that as we had a percentage based sizing system in IwGame that we also needed a percentage based positioning system too, allowing truly device screen independent layouts. Actors can now be marked as percentage based by adding PercPos=”true”. When set, the actors position will be taken as a percentage instead of an absolute coordinate.

Multi-touch Actors

Actors can now handle up to 5 simultaneous Begin / End touch and Tapped events in XOML. This enables you to create some very interesting styles of app and game play as you can monitor and react to 5 touches at the same time.

Proper User-Agent

IwGameAds now gets a proper browser user-agent from the system for Android and iOS using the new UserAgent EDK extension. This should help increase ad fill rates substantially.

XML Pools have Gone, Woopeee!

I was never keen on the global XML pool system so we destroyed it, well not completely, we wanted to keep XML memory pooling but make it an automated process. The XML parser will now pre-scan an XML file and calculate how many tags / attributes are present then allocate just the right amount of pool memory.

Cool Brushes

Image brushes can now use clamping or tiling. Also, you can now set the UV’s of an image brush directly using the new UV attribute which accepts 8 numbers (topleft-uv, topright-uv, bottomright-uv, bottomleft-uv)

Web View Reworked

The Web View control has been reworked and can now display dynamic html content that can be set via XOML, Lua and C++.

Actions and Command

Actions and commands now accept XOML variables as parameters. Many new actions and commands have also been added, expanding the functionality of XOML substantially.

XOML Variables

XOML variables have had many changes including:
* Variables can now be made persistent so theri values are saved and restored between game sessions
* XOML array variables can now be populated from comma delimited data, elements will be split at commas
* Conditions can now be used on arrays for string searches, number comparisons etc..
* Added new system variable array called touches. This array of integers represents the x, y, touched status of 5 simultaneous touches

As you can see there’s been a huge number of changes, good luck with the update and happy coding.

Oh, please direct all XOML / Lua questions to our AppEasy forum at

AppEasy for Marmalade Now Available

AppEasy for the Marmalade SDK Has Arrived

We have made a special version of AppEasy that allows Marmalade SDK developers to develop AppEasy mobile games and apps using a combination of AppEasy and the Marmalade SDK.

What is AppEasy for Marmalade?

AppEasy for Marmalade is a software development tool and set of libraries that are designed to bring cross platform native mobile game and application development to people from all walks of life. Our goal is to enable anyone (regardless of expertise) to develop their own apps using AppEasy and the Marmalade SDK for fun or for sale on a variety of app stores, including the Apple App Store, Google Play, Amazon Market and beyond.

How do we plan to accomplish this? AppEasy uses an easy to learn mark-up language similar to HTML but designed specifically for producing game and application content. For example, it is possible to create game characters complete with physics
and collision in only a few lines of mark-up. Its also equally possible to create complex user interface controls that are bound to remote data. We also cater for the more experienced developer that would like more control over their app. Our rich mark-up language (XOML) has support for a wide range of tasks including working with variables, events, actions, commands, programs, calling Lua scripts and much more.

IwGame Engine Libraries and headers are also provided that enable Marmalade developers to access the power of AppEasy from C/C++.

AppEasy is compatible with all Marmalade compatible platforms. AppEasy Project Manager is currently compatible with Windows XP / Vista and Windows 7

Who is it for?

AppEasy for Marmalade is designed to enable anyone that has basic knowledge of Microsoft Visual Studio to develop and deploy their own games and apps onto mobile phones and onto mobile app stores.

How Much Does It Cost?

At the moment AppEasy for Marmalade is currently free to use for all Marmalade SDK developers.

Where Can I Get It?

You can download the latest build of AppEasy for Marmalade from This beta release is locked to the root of the C drive so ensure that you unzip the file to C: or AppEasy may NOT work.

Where can I get Support?

Our web site provides lots of information to help get you started. AppEasy is also fully documented (see the docs folder in the AppEasy installation) as well as over 60 examples located in the examples folder. We also provide a support forum for all AppEasy users at

AppEasy Beta Begins – The new Easy way to Create Mobile Apps and Games

AppEasy Logo

We have some wonderful news. Today we finally began closed beta testing of our up and coming Marmalade / IwGame powered cross platform app development system AppEasy. AppEasy allows you to develop games and apps using mark-up language similar to HTML but designed specifically for high performance native games and apps. You can also use the optimised Lua API to enhance apps and games developed using AppEasy. You can find out more about AppEasy by visiting our “work in progress” web site at AppEasy puts mobile app and game development into the hands of everyone.

We have decided to double the number of users that can join our beta test program. If you would like to join then please register your interest at

Mobile Game Engines: Interviews with Mobile Game Developers Book coming Soon

Jason Brownlee of MobileGamesEngines has written a new book based on his interviews with mobile game engine users. One of our very own interviews based on the Marmalade SDK will appear in the book. The book will be available very soon.

For more info take a look at Interviews With Mobile Game Developers web site.

IwGame Engine v0.3 Released – The 36 hour game

New here? What’s IwGame? IwGame is an open source free to use cross platform game engine for iPhone, iPad, Android, Bada, Playbook, Symbian, Windows Mobile, LG-TV, Windows and Mac, built on top of the Marmalade SDK. You can find out more and download the SDK from our IwGame Engine page.

Well, Dan said a few weeks ago that “it’s only until you eat your own dog food that you know you have to improve the taste of it”. I thought about this and decided that we really needed to create a game using the engine to show its various features in action. So with this, I began work on a game (currently unnamed), but decided that the game would take a few weeks to finish off, so moved over to producing a completely new game from scratch but with a simpler design. The end result was a game that was created in less than 36 man hours, including art production, coding, design and scripts (I was aiming for 24 hours but I came across a a few nasty bugs that took a fair bit of time to fix). In addition,. I underestimated how difficult it would be to put levels together without an actual editor. I will very likely build an actual editor into the cOnnectiCons game itself to allow players to create their own levels. So the game ended up with 20 levels, with an additional 20+ levels coming later.

You can take a quick look at cOnnecticOns at and here are a few screen shots of our 36 hour game cOnnecticOns:

Connecticons screen shot

Connecticons screen shot

Connecticons screen shot

Connecticons screen shotConnecticons screen shot

Connecticons screen shot

Connecticons screen shot

We have already started submitting the game to app stores, so when we release the source “Don’t go getting any ideas lol”. The source will be provided as a learning exercise, and not for someone else to make a quick buck off.

Ok, now that’s out the way, lets take a brief look at the changed that have arrived in IwGame v0.3:

  • Support added for particle based actors via CIwGameActorParticle and CIwGameActorParticles as well as XOML via ActorParticles and Particle tags. Particles can be defined individually or in batches using random parameters. Particles have position, linear velocity, angular velocity, scale velocity, colour velocity, depth velocity, velocity damping, lifespan and repeat
  • Support for Marmalade fonts has been added via CIwGameFont wrapper and a new XOML Font tag
  • All rendering now uses IwGx instead of Iw2D. This offers more control over rendering as well as makes the code more portable / versatile in the future
  • All internal rendering upgraded to sub pixel coordinates offering MUCH smoother rendernig
  • New 2D rendering class added CIwGameRender2d. This cklass allows batch rendering of primitives and rendering of text CIwGxFontPreparedData prepared text
  • New very powerful template system added to XOML. The template system allows you to create a complex piece of XOML using paramaters that can be passed in when the template is instantiated. Templates can also be instantiated from code using CIwGameTemplate::Instantiate()
  • CIwGame::addScene() can now auto bring a scene to the front of scene stack
  • New global actions added to XOML – Launch, setBGColour, SetCurrentScene and BringtSceneToFront
  • Actors and sprites now have a depth property allowing you to add 3D depth to them
  • Actors and sprites now have an origin attribute
  • Support added for sprites and actors for none uniform scaling
  • Support added for linked actors. A linked actor will utilise the transform, colour and visibility of the actor it is linked to. In XOML, you can use the new LinkedTo tag to set linkage or the more natural and readable method of defining actors within actor tags. This system allows complex multi-patr actors to be created and animated
  • Actors now support OnCreate and OnDestroy events in code and in XOML
  • Scenes now support OnCreate, OnDestroy OnGainedFocus and OnLostFocus events in code and in XOML
  • New text based actor and sprite types added CIwGameActorText and CIwGameTextSprite.
  • Animation system now supports linear, quadratic, cubic and quartic on / out easing in code and in XOML. In addition value interpolation can be enabled / disabled
  • Animations now support absolute and delta values
  • Animation timelines now support OnStart, OnEnd and OnRepeat events in code and in XOML
  • CIwGameAudio::PlayMusic now supports repetition with additional parameter in XOML
  • New CIwGameSlotArray class added for efficient resizable arrays
  • Actor Box2D collision system was broken and inefficient. The system has been completely reworked and now uses the new more efficient CIwGameSlotArray
  • CIwGameBox2dBody now has new awake and active methods
  • CIwGameCamera now supports velocity, damping and touch panning. Touch panning will pan the camera to follow the users finger
  • More than one scene can now receive input events using the new AllowFocus functionality in code and in XOML
  • New findClosestActor and findFurthestActor methods added to CIwGameScene
  • CIwGameBitmapSprite now supports colour per vertex
  • CIwGameSpriteManager supports enabling / disabling of batching and a new centre of projection property for depth used by depth sprites
  • CIwGameInput reworked to better support multi-touch
  • PlayTimeline, StopTimeline and SetTimeline now supports a second parameter which points to the scene or actor that the timeline change should be made to
  • Actors can now be marked for hit testing in XOML
  • Image files can now be loaded directly from XOML without the need for Marmalade resources files
  • CIwGameScene and CIwGameActor based objects are now marked as destroyed when they are removed so they cannot be found in a scene or actor search
  • CIwGameXmlNode now supports cloning
  • Bug Fix: Actors now take into account their visibility when being hit tested
  • Bug Fix: CIwGameActor::setCollidable no works
  • Bug Fix: StartTimeline action now restarts a stopped timline properly
  • Bug Fix: Clipping rect is now transform by the scenes transform (will not clip correctly against rotated scenes however)
  • Bug Fix: XML parser fixes
  • Bug Fix: CIwGame game scene switch scene bug fixes
  • Bug Fix: CIwGameAds::ErrorFromResponse fix that were causing some valid ads to be in error
  • Bug Fix: CIwGameAnim fixes
  • Bug Fix: Polygon based Box2D bodies now fixed
  • Bug Fix: Sprite rendering transform fixed
  • Bug Fix: CIwGameBitmapSprite with no loaded image no longer crash
  • Bug Fix: CiwGameString crashes fixed (were causing rare problems with XML system)
  • Bug Fix: Fixed issue with CIwGameXmlAttribute::GetValueAsColour not checking for correct parameter count
  • Bug Fix: On device scene shut down camera deletion fixed

Ok, that’s a shed load of changes, but I can assure you that they are all for the better. IwGame is now a professional grade and fairly stable engine that can be used to create games in as little as 36 hours!

Lets take a look at some of the new additions in more detail.


I want to start with my utmost favourite change to 0.3 which is templates. I am so in love with templates that I feel like I could almost marry one! They saved me so much time when developing cOnnecticOns. Templates allow you to create large sections of XOML as templates then instantiate those large
pieces of XOML somewhere else using custom parameters that you pass to the template when you instantiate it. Lets take a quick look at a super simple example:

<Template Name="ActorTemplate">
        <InertActor Name="Explosion$name$" Image="$image" Position="$pos$" Scale="$scale$" Depth="$depth$" Layer="1" AngularVelocity="0" />

Here we define a template called ActorTemplate that contains a basic InertActor definition. You may notice some strange markers in there surrounded by double dollars signs ($name$, $image$,$pos$, $scale$ and $depth$).

Now when we instantiate this template somewhere we would use:

<FromTemplate Template=”ActorTemplate” name=”actor1″ scale=”1.0″ pos=”300, 150″ depth=”1.0″ image=”sprites1″ />

The above XOML command will instantiate whatever is in the ActorTemplate template passing all of its parameters, replacing the double dollar definitions inside the template (Hmm, sounds very much like calling a function? Which I guess in some ways it is)

Templates can be as massive and as complicated as you like, allowing you to design and instantiate some very complex objects with very few lines of XOML.

Rendering Engine Upgrade

Up until version 0.29 of the IwGame Engine we used Marmalade’s Iw2D engine as the rendering core. As of v0.30 we have switched to Marmalade’s IwGx rendering system as it offers much more versatility as well as brings the engine into the realms of 3D rendering, which is where we will eventually be steering the engine.

To facilitate this change over and to keep the game engine code nice and readable, all rendering has been abstracted away into a nice simple class called CIwGameRender2d. CiwGameRender2d is and will in future be the centre point for all rendering that takes place within IwGame.

At the moment CiwGameRender2d offers:

  • Batch and none batch sprite rendering of quad based polygons
  • Rendering of prepared text from the Marmalade IwGxFont system

In the near future we will be adding support for various other types of primitives, 3d models and hopefully our own custom shaders etc..

Lastly, all rendering now uses sub-pixel accuracy which looks much much smoother.

Text and Fonts

IwGame now supports definition of Marmalade fonts and custom rendering of those fonts using a new text based sprite and actor. Text based sprites and actors are treat just like any other sprite or actor objects, so they can be spun, scaled, linked, colour changed etc.. Unlike generic actors text based actors can be instantiated without deriving your own class from CIwGameActorText

3D Sprites / Actors

Another one of my favourite additions to 0.3 is 3D sprites. All sprites and actors can now have a depth value (think iof this as a z value) that allows you to project sprites into 3D.  This system is great for create parallaxing effects etc..

Oh and sprites / actors also get an adjustable origin and none uniform scaling

Linked Actors

Actors can be created within other actors to form a parent / child relationship. Inner actors will be linked back to their containing actor forcing them to be transformed by their parent actors. This system allows you to create a very powerful intuitive multi-part actor system complete with animations per actor part. Note that all positions, depths etc will be relative to the container actor, so for example, if the parent actor has a Depth value of 1.0f and the child actor has a Depth value of 1.0f then the child’s effective Depth will be 2.0f. Here’s an example showing parent / child actors:

<InertActor Name="Level1" Style="LevelButtonStyle" Position="0, 0" OnBeginTouch="BeginTouch11" OnTapped="StartLevel1">
    <ActorText Name="Record1" Style="LevelButtonTextStyle" Colour="255, 80, 80, 255" Position="0, 0" Text="0" Depth="0" />
    <ActorText Style="LevelButtonTextStyle" Position="0, 60" Text="Round 1" Depth="0" />
    <InertActor Name="LevelComplete1" Size="74, 67" Image="sprites2" SrcRect="582, 423, 148,134" Position="60, -20" HitTest="false" Depth="0" Timeline="tick_scale_anim" />

In the above XOML the parent actor level1 contains three children actors that will all follow theLevel1 actors visual transform.

Particle System Actors

This actor is special in that it is optimised for creating, displaying and updating a complete system of sprites (kind of like its own sprite manager). The advantage of this actor is that it does not have to deal with each particle as a separate actor object. The CIwGameActorParticles actor supports both manual and auto generation of particles. Auto generation can be controlled using a number of a control parameters.

Particles have a number of properties that can be adjusted:

  • Visual
  • Position
  • Velocity
  • Velocity Damping
  • Gravity
  • Scale
  • Scale Velocity
  • Scale Velocity Damping
  • Angle
  • Angle Velocity
  • Angle Velocity Damping
  • Colour
  • Colour Velocity
  • Colour Velocity Damping
  • Depth
  • Depth Velocity
  • Depth Velocity Damping
  • Active state
  • Visible state
  • Lifespan – Duration of particle in seconds
  • SpawnDelay – The amount of time to wait before spawning for the first time
  • Lives – Number of times the particle will re-spawn (-1 for infinite)

The particle actor system allows auto generation of particles within certain limits as well as manual generation. Patricles can be defined and placed both in code and in XOML.

Animation Frame Easing

Animations now support in and out easing on a per frame basis using the “Ease” attribute of the frame tag or in code. Valid values of easing include:

  • linear – No easing
  • quadin / quadout – Quardatic in / out easing
  • cubicin / cubicout – Cubic in / out easing
  • quarticin / quarticout – Quartic in / out easing

Time lines now in the Events System

Its now possible to attach actions to timeline events such as OnStatr, OnEnd and OnRepeat. So for example, each time an animation repeats you could play a sound effect or maybe when an animation finishes yu kill destroy the actor or start a particle system off going etc..

Animations now support delta / absolute coordinates

Every animation can now be specified as absolute or delta. An absolute animation will write its interpolated frame values directly into the target objects properties (such as position), whilst a delta animation will update the current target properties. So for example, a delta animation for position would adjust the position by dx, dy, where dx and dy is the current interpolated frame value.

Automatic Touch Panning for Cameras

Cameras now have X and Y axis touch panning. When a camera is touch pan enabled it will track the users finger drag on screen to determine a velocity to move the camera by. Touch panning can be enabled on the X an Y axis independently.

Other cool changes

Multi-focus scenes – More than one scene can now receive input events
Local images can now be loaded from XOML

There are many other changes but I don’t really have the time to go through them all. There’s also a mound of bug fixes that weer found during development of cOnnecticOns.

We will be releasing the full source to cOnnecticOns later this week along with an additional 10-20 levels.

Marmalade SDK v6.0

I was pleased as punch this afternoon after I visited Marmalade’s web site. Why you may ask? Well, the simple answer is that they have updated their road map giving us a sneak preview of what’s to come this year. The main thing that I am happy about is the fact that the first release due in Q1 is entitled “Web Marmalade”. I’m going to go out on a limb here and assume that this is targeting the web as deployment platform, which is even more awesome than the $25 credit card sized Raspberry Pi! (Think that we are going to have to name this one Awesomade!).

Anyways, hers a short extract from Marmalade’s release page:

“Hybrid Applications, Enhanced Native UI and support for new platforms.”

Yummy, eh? Well what could these features mean?

  • Hybrid Applications – Could we be talking hybrid web / native applications? Does this mean some kind of integration with Google’s Native Client (NaCl) – Like the way Google used the chemical name for salt, makes it nice and memorable. or maybe Marmalade can target HTML 5 some how?
  • Enhanced native UI – I think that we can safely assume this will include support for many more native controls?
  • New Platforms – Ok, it’s obvious what this means, but which platforms? Would be fantastic to see support for Raspberry Pi and Windows Phone 7, although I think WP7 is a closed system so maybe not. What other platforms could we see Marmalade support?

Feel free to leave your own speculations as a comment.

IwGame Engine v0.29 Released – XOML is evolving

New here? What’s IwGame? IwGame is an open source free to use cross platform game engine for iPhone, iPad, Android, Bada, Playbook, Symbian, Windows Mobile, LG-TV, Windows and Mac, built on top of the Marmalade SDK. You can find out more and download the SDK from our IwGame Engine page.

The Universe conspired against me this week, first of all landing me with a nice flu, followed directly by some horrible sickness bug that featured projectile vomiting of the likes only seen in movies such as the Exorcist! Thankfully the Universe decided to give me a break this week so an IwGame Engine update got finished.

Most of the changes this week are XOML related as this is the general direction we want to take the game engine. A good mix of XOML mark-up and solid coding should make games and media apps very quick and easy to develop.

Oh and we got a new logo for the IwGame Engine woohoo! Feel free to use the logo in any of your IwGame powered products, or if you want to link to us.

Ok, onto the list of iwGame Engine changes for v0.29:

  • New style system added to XOML. Actors and scenes can now use a style to reduce repetition
  • Actors and scenes now handle events such as OnSuspend, OnTapped, OnBeginTouch etc.. When an event fires it executes a collection of actions
  • Actions added to XOML to allow definition of collections of actions that can be executed. Many default actions are suppported such as ChangeScene, KillScene, PlayTimeline, PlaySound etc.. Custom actions can also be added toextend the system
  • CIwGame now handles touch begin touch, end touch and tapped events
  • CIwGame now has new Postdraw() method for adding in custom post draw rendering
  • Actors can now be made tappable and now handle OnTapped(), OnBeginTouch() and OnEndTouchEvents()
  • Actors have new HitTest() method that can be used to check if a point is inside the actors visual
  • XOML now supports creation of cameras
  • XOML now supports creation of variables and update of variables using actions, supports string, bool, int, float, vec2, vec3 and vec4
  • XOML files can now load other XOML files with new LoadXOML tag as well as LoadXOML action
  • Scenes now support a type field
  • CIwGameBitmapSprite now supports image transforms (flips. mirrors etc) which can be also applied to actors visuals using FlipX and FlipY attributes
  • You now change the current time of a CIwGameAnimInstance and CIwGameAnimTimeline
  • Bug Fix – Actor visibile state now works properly
  • Bug Fix – CIwGameShape::setShape() now works
  • Bug Fix – Transform is now reset after CIwGameAdsView finishes rendering
  • Bug Fix – JPEG file detection fixed, was not detecting certain types of JPEG files
  • Bug Fix – CIwGameString::FindNext() crash fixed

Quite a few changes and bug fixes. Note that someo f the bug fixes directly affected IwGameAds so an update to that API will be released shortly.

Lets take a look at the changes in more detail.

XOML Variables

XOML got variables, but why? Well, there are a number of reasons:

  • We want to be able to define values that can be read by the main code
  • We want to change these values via actions
  • When we implement the UI system we are looking to add data binding capabilities that will rely on values

You can declare a variable in XOML like this:

    <Variable Name="PlayerName" Type="string" Value="Player One" />
    <Variable Name="PlayerScore" Type="int" Value="0" />
    <Variable Name="PlayColour" Type="vec4" Value="255, 128, 64, 8" />

You can later modify the value of that variable using a SetVar action, more on this later.

Each scene contains its own variables collection and the global resource system also contains a global variables collection.

XOML Styles

XOML now supports the styling of actors and scenes using the new Style tag. XOML styles enable you to create a set of properties and values that are common across a range of objects then apply tat style the to them all. Hers a quick


<Style Name="BasicActorStyle">
    <Set Property="Size" Value="60, 60" />
    <Set Property="Angle" Value="0" />
    <Set Property="SrcRect" Value="0, 0, 36, 40" />
    <Set Property="Image" Value="Sprites" />
    <Set Property="Timeline" Value="Player1Intro1" />
    <Set Property="Shape" Value="PlayerShape" />
    <Set Property="Box2dMaterial" Value="BounceyBall" />
    <Set Property="CollisionFlags" Value="1, 1, 1" />

<TestActor Name=”Player2″ Style=”BasicActorStyle” Position=”0, -150″ />

The TestActor Player2 will be assigned all of the values in the properties defined in the style saving you a whole bunch of typing as well as making your mark-up much more readable and easier to maintain.

XOML Events And Actions

Actors and scenes now support various events that can fire off user defined actions. The following events are currently defined:


  • OnSuspend – Called when a scene is suspended
  • OnResume – Called when a scene is resumed


  • OnTapped – Called when the user taps an actor
  • OnBeginTouch – Called when the user begins to touch an actor
  • OnEndTouch – Called when the user stops touching an actor

More will be added as we think of them or when requested. You can also add your own custom events youself. Check out the CIwGameActor class for a reference on how to do this.

Events wouldn’t really be much use unless we could carry out some kind of action when the event occurred. Actions are defined in XOML using the Actions tag, heres an example:

<Scene Name="GameScene3" Style="GenericSceneStyle" OnSuspend="SuspendActions">
    <Actions Name="SuspendActions">
        <Action Method="SetTimeline" Param1="SceneTransition1" />
        <Action Method="PlaySound" Param1="explosion" />

You actually create a group of actions that are all executed when the action is called by an event.

The following actions are currently supported:

  • ChangeScene – Changes the currently focused scene to the specified scene
  • SuspendScene – Suspends the specified sceme
  • ResumeScene– Resumes the specified sceme
  • HideScene– Hides the specified sceme
  • ShowScene– Shows the specified sceme
  • ActivateScene – Activates the specified sceme
  • DeactivateScene – Deactivates the specified sceme
  • KillScene – Destroys and removes the specified sceme from the game, all contained resources amd actors will be also be destroyed
  • HideActor – Hides the specified actor
  • ShowActor – Shows the specified actor
  • ActivateActor – Activates the specified actor
  • DeactivateActor – Deactivates the specified actor
  • KillActor – Kills and removes the specified actor
  • PlayTimeline – Plays the specified timeline. If no timeline is supplied then the current actor / scenes timeline will be restarted (depends on where the action was defined)
  • StopTimeline – Stops the specified timeline. If no timeline is supplied then the current timeline will be stopped. (depends on where the action was defined)
  • SetTimeline – Changes to the specified timeline. If no timeline is supplied then the current timeline will changed and restarted. (depends on where the action was defined)
  • PlaySound – Starts playing a sound effect
  • PlayMusic – Starts the playing specified music file
  • StopMusic – Stops the music player playing
  • LoadXOML – Loads a XOML file into scene or globally. If a scene is provided then the XOML will be loaded into that scene
  • SetVar – Sets the value of a variable

Again, more will be added as we think of them or when requested. You can also add your own custom actions youself. Check out the CIwGameXomlAction_Actors class for a reference on how to do this.

Coupled together the events and actions system provide a very powerful way of creating fully interactive content without having to write a single line of code.

Loading Other XOML Files

It is now possible to load other XOML files from a XOML file using the new LoadXOML tag. Heres an example:

<LoadXOML File="Common.xml" />
<LoadXOML File="Sceme2.xml" />
<LoadXOML File="Scene3.xml" />

You can also (as shown in the actions section) load a XOML file from an action.

Using this system you can create fully interactive navigation based content. Think adventure games, books, magazines and informational apps etc..

Scene Cameras

Cameras can now be defined in XOML and attached to scenes. You can also switch a scenes camera using the animation system.

Image Transforms for Sprites and Actors

Sprites and actors can now use an image transform allowing you to flip the source image used to render the object. The ne FlipX and FlipY attributes are now available in XOML.

Well thats it for this update. IwGame now has some very cool features that should hopefully make game / app development much easier and quicker for everyone.

We are going to assess the possibility of wrapping up Marmalades cool UI system with XOML very soon, will keep you all posted on how that goes. I am also looking at producing a new article on in-app purchasing with the Marmalade SDK, which will form the basis of in-app purchasing for the IwGame engine.

IwGameAds SDK – Free Open Source Cross Platform Ad Engine for Mobile Games and Apps

We’ve received a fair few requests to extract the ad engine from the IwGame engine so that it can be easily used in existing products or products that do not want the fully fledged game engine. So we decided to go ahead and create a new API that supports just the ad engine. Its new home is at and its now called the IwGameAds SDK. The SDK currently has support for 12 ad providers including:

  • Inner-active
  • AdFonic
  • Vserv – Also provides support for InMobi, BuzzCity, JumpTap, ZestAdz / Komli Mobile and Inner-active
  • Mojiva
  • Millennial Media – Also provides support for AdMob, Amobee, JumpTap and Mojiva
  • AdModa

Features include:

  • Native and cross platform
  • Free and open source
  • Fully documented
  • Support for multiple platforms (iPhone, iPad, iPod, Android, Bada, Playbook, Symbian, WebOS, Windows Mobile, Mobile Linux, LG-TV, Windows and Mac OS)
  • Asynchronously request text, image and html based ads from a variety of ad providers
  • Automatic extraction of ad data, such as image url, click url and text
  • Provision for targeted ads by age, gender, location etc..
  • Integrated ads view that can display animating ads to the user as well as detect clicks and launch the external URL / app that deals with the click destination
  • Cache and display multiple ads from multiple providers
  • Eye catching animating ads system that is currently generating 3%-8% CTR
  • Ad mediation using the priority based IwGameAdsMediator class
  • Very simple to install, set-up and use

We have not removed the ad API from the IwGame engine, this is just an additional SDK for those that want to use the ad API away from the game engine.

IwGame Engine v0.28 Released – Box2D Physics Integration has Arrived

New here? What’s IwGame? IwGame is an open source free to use cross platform game engine for iPhone, iPad, Android, Bada, Playbook, Symbian, Windows Mobile, LG-TV, Windows and Mac, built on top of the Marmalade SDK. You can find out more and download the SDK from our IwGame Engine page.

IwGame Game Engine Update

The magical elves of Pocketeers Land have been incredibly busy hammering out the latest update to the IwGame game engine and here it is. We’ve had a lot of requests for Box2D integration so we shunted it in there and managed to integrate it into the XOML mark-up language as well.

Here’s the list of changes for IwGame 0.28:

  • Image, resource group and timeline managers have been collapsed into a single resource manager. All calls to scene and global resource managers should go through getResourceManager()
  • All resource types can now be marked as managed
  • New Box2D IwGame classes added
  • Box2D integrated into the scene, actor system as well as XOML. Box2D can be disabled by undefining IW_GAME_BOX2D in IwGameBox2d.h
  • New shape system added IwGameShapes that allows you to define box, circle and polygon shapes, also available in XOML
  • XOML tag names and attrbutes are now case insensitive
  • Scenes XOML now supports Gravity and WorldScale
  • Actor XOML now supports new tags Box2dMaterial, Shape, COM (centre of mass), Sensor and CollisionFlags
  • Timelines can now be shared across different actors and scenes without them playing back too fast and not updating properly
  • CIwGameActor now has a new mthod removeVisual() which removes the actors visual from the scenes visual sprite manager
  • ToLower() and ToLower() methods added to CiwGameXml. These methods will convert all tag name and attribute names to lower or upper case (values are left untouched)

Yes, we did go ahead and remove all of the different types of managers and rolled them into a single resource manager. We also got rid of case sensitivity for tag and attribute names, which should save many of you the pain of tracking down case issues when writing XOML. I for one welcome the change :)

I was playing with time lines yesterday and discovered that if I attached the same one to more than one object, it got updated multiple times during a single frame, which causes the animationto play back too fast. A fix has now been added for that, so time lines can now be re-used across multiple actors and scene.

Now on to the meatier changes

Box2D Integration in Detail

Ok, so Box2D integration requests approached critical mass so we went ahead and integrated Box2D into the engine and the XOML system. The tst bed now shows anew scene (GameScene3) which has a solid floor, 2 walls and a bunch of actors that are dropped into the scenes. As you can see from the tst bed the physics is working pretty well. Lets take a quick look at the Game3Scene in XOML:

<Scene Name="GameScene3" CanvasSize="320, 480" FixAspect="true" LockWidth="false" Colour="255, 255, 255, 255" AllowSuspend="false"> <Box2DMaterial Name="Solid" Type="static" Density="1.0" Friction="1.0" Restitution="0.1" /> <Box2DMaterial Name="BounceyBall" Type="dynamic" Density="1.0" Friction="0.9" Restitution="0.6" /> <Shape Name="PlayerShape" Type="box" width="60" height="60" /> <Shape Name="Wall" Type="box" width="20" height="320" /> <Shape Name="Floor" Type="box" width="320" height="20" /> <Timeline Name="Player1Intro1" AutoPlay="true"> <Animation Anim="PlayerImageAnim" Target="SrcRect" Repeat="0" StartAtTime="1"/> </Timeline> <TestActor Name="Floor" Position="0, 200" Size="320, 20" Angle="0" SrcRect="0, 0, 32, 32" Image="Block" Shape="Floor" Box2dMaterial="Solid" CollisionFlags="1, 1, 1" /> <TestActor Name="LeftWall" Position="-140, 0" Size="20, 480" Angle="0" SrcRect="0, 0, 32, 32" Image="Block" Shape="Wall" Box2dMaterial="Solid" CollisionFlags="1, 1, 1" /> <TestActor Name="RightWall" Position="140, 0" Size="20, 480" Angle="0" SrcRect="0, 0, 32, 32" Image="Block" Shape="Wall" Box2dMaterial="Solid" CollisionFlags="1, 1, 1" /> <TestActor Name="Player1" Position="-50, -200" Size="60, 60" Angle="0" SrcRect="0, 0, 36, 40" Image="Sprites" Timeline="Player1Intro1" Shape="PlayerShape" Box2dMaterial="BounceyBall" CollisionFlags="1, 1, 1" /> <TestActor Name="Player2" Position="0, -150" Size="60, 60" Angle="0" SrcRect="0, 0, 36, 40" Image="Sprites" Timeline="Player1Intro1" Shape="PlayerShape" Box2dMaterial="BounceyBall" CollisionFlags="1, 1, 1" /> <TestActor Name="Player3" Position="50, -200" Size="60, 60" Angle="0" SrcRect="0, 0, 36, 40" Image="Sprites" Timeline="Player1Intro1" Shape="PlayerShape" Box2dMaterial="BounceyBall" CollisionFlags="1, 1, 1" /> <TestActor Name="Player4" Position="0, -1000" Size="60, 60" Angle="0" SrcRect="0, 0, 36, 40" Image="Sprites" Timeline="Player1Intro1" Shape="PlayerShape" Box2dMaterial="BounceyBall" CollisionFlags="1, 1, 1" /> </Scene>

In the above XOML scene we declare two materials, one for our solid environment pieces (floor and walls) and then another for our bouncy players.

Next we define a shape for our player, a shape for our floor and s shape for our walls.

Lastly, we create actors that represent our floor, left wall, right wall and 4 player actors, assigning the correct shapes and materials.

The above creates a scene with animating interactive physics objects

Box2D integration will be expanded in future updates to more features to IwGame and XOML.

If you want to learn more about the internals of the Box2D integration then take a look at the IwGameBox2D source files.

Shapes in XOML

You now create shapes in code or by using XOML mark-up. Take a look at the new shape classes in IwGameShapes.h. Below is an example showing a few shapes defined in XOML:

<Shape Name="PlayerShape" Type="box" width="60" height="60" /> <Shape Name="AlineShapel" Type="circle" radius="20" /> <Shape Name="Platform1" Type="polygon"> <Point Value="-100, -100" /> <Point Value="-100, -200" /> <Point Value="100, -100" /> <Point Value="100, 100" /> <Point Value="-100, 100" /> </Shape>

Shapes can be used to define physical collision boundaries for the integrated physics system. Eventually IwGame’s new path system will utilise shapes (when its implemented)

New Resource System

The new resource system now handles all resources of any type, so all the old separate resource managers have gone. To ensure that developers do not have to be too careful with naming resources, different resources can share the same name. However, this does mean that when you ask for a resource you do need to specify its type. Here’s a few examples:

CIwGameImage* image = (CIwGameImage*)IW_GAME_GLOBAL_RESOURCES->getResourceManager()->findResource(“Sprites”, “Image”);
CIwGameAnim* animation = (CIwGameAnim*)IW_GAME_GLOBAL_RESOURCES->getResourceManager()->findResource(“PlayerImageAnim”, “Animation”);

Note that the 2nd parameter specifies the type of resource, in this case it is an Image and an Animation.

Valid type names are as follows:

  • Game – Game objects
  • Scene – Scene objects
  • Image – Image objects
  • Timeline – Animation timeline objects
  • ResourceGroup – Resource group objects
  • Animation – Animation objects
  • Shape – Shape objects
  • Box2dMaterial – Box2D material objects

This does not include any of your own custom types that you add to the system yourself.

Well, that’s it for this update. We are very likely moving onto creating the editor to accompany the engine as our next task so IwGame engine updates may come a little slower.