Finally Game / App Editor Started

Note to self, update my blog more often. These days my blog seems to have turned into an AppEasy update feed, well I want to change that and start blogging about other things (besides AppEasy).

Well, this blog post is not completely devoid of AppEasy news as the game editor will target AppEasy to begin with.

Today I want to blog about a new game editor that I have started work on (its a bit of a pet project because I’m getting fed up of writing game or app specific editors). The editor is tentatively called Groove Game Editor which will have the following features when finished:

  • Completely customisable – You can define all of the types of objects that can be edited along with all of the properties for those objects using an input XML file
  • Placement, scaling, rotation of game objects on a large virtual canvas
  • General layout, tile and zone maps
  • Automatic atlas generation
  • Resource management
  • Music and sound effects
  • Physics
  • Actions, events and triggers
  • Key frame animation editor
  • Lua scripting
  • Support for all XOML types out of the box
  • Support for HTML5, Marmalade Quick, Cocos2d-x, Corona, Gideros and other game / app development SDK’s and systems
  • Binary, xml and JSON export

Thus far I have implemented the customisation system which enables developers to create a single XML file that describes the following elements to the editor:
Enumerations – You can use these to define sets of possibilities, e.g.

Here’s an example that shows an enum for the Joint Type used by XOML joints:

[sourcecode language=”xml”]
<Enum Name="JointTypeEnum" Info="Physics joint type">
<Property Name="weld" />
<Property Name="distance" />
<Property Name="revolute" />
<Property Name="prismatic" />
<Property Name="pulley" />
<Property Name="wheel" />
</Enum>
[/sourcecode]

You can later use this as a type for object properties

Object Types – These represent specific types of objects that can be edited, for example Actors, Scenes, Images, Programs, Actions etc are each single types, e.g.*

Heres an example of a Box2D material:
[sourcecode language=”xml”]
<Type Name="Box2dMaterial" Base="Common" Info="Box2D material resource" Colour="#ffe4ff00">
<Property Name="Type" Type="Box2dMaterialTypeEnum" Category="General" Value="" Info="Type of material" />
<Property Name="Density" Type="double" Category="General" Value="1" Info="Material density" />
<Property Name="Friction" Type="double" Category="General" Value="1" Info="Materials coefficient of friction" />
<Property Name="Restitution" Type="double" Category="General" Value="0.1" Info="Materials coefficient of restitution / bounciness" />
<Property Name="IsBullet" Type="bool" Category="General" Value="" Info="Treat object as moving at high speed" />
<Property Name="FixedRotation" Type="bool" Category="General" Value="" Info="Prevent rotation of body" />
<Property Name="GravityScale" Type="double" Category="General" Value="1" Info="Amount to scale gravity" />
</Type>
[/sourcecode]

As you can see you can define the name of the type, the base, which is kind of like a base class in C++, the type inherits all properties of the base. Info is used for tool tips and the colour is the colour that will be used to display objects of this type in the resource view. There are other properties but I wont go into them right now. Within the TYpe tag is the properties, thee define the properties that can be edited along with their types, the category they appear under and the tool tip

Type Groups – Type groups are used to group together types that share similar function, e.g.

[sourcecode language=”xml”]
<Group Name="Basic Actors">
<Type Name="ActorImage" />
<Type Name="ActorConnector" />
<Type Name="ActorText" />
<Type Name="ActorParticles" />
</Group>
[/sourcecode]

Here we group together four different types into a group called Basic Actors. We can later use these to set up menu groups and other interesting stuff

Menu Groups – Finally we have Menu Groups. These are used to define how the user can create hierarchical data. Each menu group defines a list of types that can be creayed when the user attempts to create a child object within its hierarchy, e.g.:

[sourcecode language=”xml”]
<MenuGroup Name="NewAnimationChild" Context="Animation">
<Section Name="">
<Type Name="Frame" />
<Type Name="Atlas" />
</Section>
</MenuGroup>
[/sourcecode]

Here we create a Menu Group called NewAnimationChild that contains two possible types (Frame and Atlas), these are the only two possible types of objects that an Animation object can contain. The Context attribute specifies what type of object will use this menu for creating new child objects in its hierarchy. The Section tag specifies the name of the sub-menu that the type should appear under. In this case the section name is blank so Frame and Atlas will appear in the root.

Most other items and other parts of the editor will be defined in this customisable editor file.

The editor is not currently in a usable state and only has the following functionality:
* Allows editing using all custom types, enumerations and menu groups that are specified in the editors definition XML file
* Loads files that are based on the editors definition XML file
* SUpports all AppEasy XOML types and enumerations using colour coding

Next on the list is export to XML. However, before I do that I need to get objects that are specified inside templates working. The problem I face is that the editor creates UI that allows you to edit specific types. For example, a bool type will use a check box and an enumeration will use a drop down list. Problem with this is that objects that are defined inside a XOML template can have parameters that are template parameters (strings), so the UI needs to change for all objects that are sat inside a template to allow these parameters to be modified. Problem is that Windows Presentation Foundation (WPF the technology that I am using to create the editor) uses data binding to specific types. I need to figure a way around this. I have a few ideas that I can try.

Once I have export working I will release a version for those that are interested in taking a look to play around with. For now I will leave this screen shot that shows my porgress so far:

Groove game editor
Groove game editor

AppEasy 1.4.5 now available – In-app Purchasing

AppEasy Version 1.4.5 is Now Available

AppEasy the cross platform mobile game and app development system for iPhone, iPad, Android and Windows that is aimed at all levels of experience releases latest update

AppEasy version 1.4.5 is now available for download from here.

Please upgrade to the latest version. Note that before updating, close down your current version of AppEasy, rename c:\AppEasy to c:\AppEasy2, install and run AppEasy 1.4 then copy any changes / certificates from c:\AppEasy2 to c:\AppEasy. Note that if you install the update before renaming c:\AppEasy then simply exit the AppEasy project manager, rename the folder and run AppEasy again.

Changes include:

Core Engine

  • If child actor layer not set then it will be assigned its parents layer
  • Added new Market XOML tag. This provides access to the Market which can be used to define products that can be purchased via in-app purchasing (Android, iOS, Windows (simulated on Windows))
  • Added new system array index (10) – This represents the ID of the last purchase attempt using Market
  • Added new action called Purchase which allows you to purchase an item defined in the market
  • BUG FIX: SetKeyFocus not working when supplying actor for P1
  • BUG FIX: DebugText action output nothing when no parameter 2 specified
  • BUG FIX: Camera permission added to AndroidManifest

Market

The new Market enables in-app purchasing for iOS and Android devices as well as simulated in-app purchasing under Windows simulation. The market and its products are declared in XOML. ere is an example:

[sourcecode language=”xml”]
<Market Name="Market1" ………….. >
<Product Name="Coins1" Id="1" iOSId="com.pocketeers.coins1" AndroidId="coins1" Consumable="true" Price="0.99" />
<Product Name="Coins2" Id="2" iOSId="com.pocketeers.coins2" AndroidId="coins2" Consumable="true" Price="1.99"/>
<Product Name="Coins3" Id="3" iOSId="com.pocketeers.coins3" AndroidId="coins3" Consumable="true" Price="2.99"/>
<Product Name="Coins4" Id="4" iOSId="com.pocketeers.coins4" AndroidId="coins4" Consumable="true" Price="3.99"/>
<Product Name="Levels1to10" Id="5" iOSId="com.pocketeers.levels1to10" AndroidId="levels1to10" Consumable="false" Price="0.99" />
<Product Name="Levels11to20" Id="6" iOSId="com.pocketeers.levels11to20" AndroidId="levels11to20" Consumable="false" Price="0.99" />
</Market>
[/sourcecode]

Purchasing can be done via actions or script, e.g.:

[sourcecode language=”xml”]
<Actions Name="MakePurchase">
<Action Method="Purchase" P1="Coins1" />
</Actions>
[/sourcecode]

function PurchaseCallback(status, product_id)
    print("Purchased - " .. product_id .. " - " .. status);
end
function MakePurchase(_scene)
    local product = market.find("Levels1to10");
    market.purchase(product, PurchaseCallback);
end

Note that the Market is currently an alpha component and is still undergoing testing. If you try it out then please let us know if you have any problems.

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

Lua API

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 http://www.appeasymobile.com

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 http://www.appeasymobile.com/forum

IwGame Engine – Using Templates Tutorial

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.

A forum poster asked a question recently that made me realise that XOML Templates can quite easily be overlooked as a means for creating re-usable actors and such, so I thought to help make Templates more visible that I would create a very quick tutorial showing how to use them.

To begin with, lets take a look at what a template actually is and does. A template is a XOML tag that allows you to define generic XOML that is not instantiated immediately, yuo can think of a Template as a blue print for something that you will later instantiate into your game or app world. A template also takes any number of parameters that can be passed when you instantiate the template.

When creating items inside a Template, template parameters are defined using a template parameter name that is enclosed inside double dollar signs ($$), for example $position$. When you later instantiate the items within the template the parameters within the template will be replaced by values that are passed to the template.

Lets take a quick look at creating an actor / child actor with a template

[sourcecode language=”xml”]
<Template Name="TankTemp">
<TankActor Name="$name$" Style="TankActorStyle" Position="$pos$β€³ >
<TankActor Name="$name$_sel" Style="TankActorSelectedStyle" Position="0, 0β€³ />
</TankActor>
</Template>
[/sourcecode]

Here we create a template called TankTemp that defined an actor with a name of $name$ and a position of $pos$. Note that because these two parameters are enclosed in $$ they are classed as template parameters.

Now to instantiate this elements within this template in XOML we use the following:

[sourcecode language=”xml”]
<FromTemplate Template="TankTemp" name="Tank" pos="310, -120" />
[/sourcecode]

The above code will instantiate the following code:

[sourcecode language=”xml”]
<TankActor Name="Tank" Style="TankActorStyle" Position="310, -120β€³ >
<TankActor Name="Tank_sel" Style="TankActorSelectedStyle" Position="0, 0β€³ />
</TankActor>
[/sourcecode]

To instantiate a template from C++, we firstly need to find the template, build the parameters then instantiate the template passing in the parameters:

[sourcecode language=”cpp”]
// Find the tank template
CIwGameTemplate* temp = (CIwGameTemplate*)scene->getResourceManager()->findResource("TankTemp", "template");
if (temp != NULL)
{
// Create a set of XML attributes that will replace the template parameters
CIwGameXmlNode* replacements = new CIwGameXmlNode();
replacements->Managed = false;
CIwGameXmlAttribute* attrib;

// Set name template parameter
attrib = new CIwGameXmlAttribute();
attrib->Managed = false;
attrib->setName("name");
attrib->setValue("Tank");
replacements->AddAttribute(attrib);

// Set position template parameter
attrib = new CIwGameXmlAttribute();
attrib->Managed = false;
attrib->setName("pos");
attrib->setValue("310, -120");
replacements->AddAttribute(attrib);

// Instantiate the Tank template
temp->Instantiate(scene, replacements);

// Clean up replacement attributes
delete replacements;
}
[/sourcecode]

IwGame Engine v0.35 Released – Multi-touch User Interface, XOML Programs, 9-Patch Rendering and Arrays

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.

Its been a while since we last released an update for IwGame but 0.35 is finally here. Our plan for this update was to enabled IwGame as a viable app development SDK as well as game development. With the new addition of the user interface we feel that we have made a great stride towards that aim.

Here is the latest list of changes:

IwGame 0.35 Changes:
* XOML schema added. This enables error checking, intellisense and auto completion when creating XOML
* New user interface system added, enabling IwGame as an app developemnt platform. IwGameUI has the following features
* Static and proprtional sizing an margins
* Buttons / toggle / sticky buttons with OnToggledOn and OnToggledOff events
* Labels
* Text input boxes
* Sliders (horizontal and vertical)
* Canvas – Allows organisation of content on a large scrollable canvas area as well as docking of content to edges
* Stack panels and wrap panels (horizontal and vertical) allow organisation of content in vertical and horizontal stacks
* Wrap panel (horizontal and vertical), works much in the same way as an orinary stack panel exceot content that overflows the edge of the panel will wrap down to the next line or across to the next column
* Listbox (horizontal and vertical) allows organisation and selection of content using sigle and multi-select. Can use templates and bindings for automatic binding of data to the list box
* Grid allows the display and navigation of two dimensional data, each column or the whole grid can be bound to data and templates.
* Image view that allows the display and navigation of large images (supports panning and pinch zoom), can also contain any other UI or actor
* Text view that allows the display and navigation of text (supports panning and pinch zoom)
* Web view – A wrapper for Marmalades Web API. Multiple web views cn abe instantiated inside the UI
* TabBar (horizontal and vertical) – A tab bar allows the display of multiple pages or views of content. The tab bar can be orientated horizontally or vertically. Tab bar can appear at top, bottom, left or right of control area. View swicthing can also be animated using a selection of preset animations or using your own custom animations.
* All UI elements are supported in XOML, fully bindable and integrates directly into all other systrems including the animation system.
* Container UI elements will clip children. Container actors also allow the specification of a clip margin.
* Scrolling and zooming supports iOS style spring effect to place contents back into position when going over boundaries
* All UI elements support hide and show timelines
* Rendering system now supports 9-patch rendering using 9-patch brushes
* Sprite system now supports 4 parameter skewing
* IwGameInput system reworked to make it more multi-touch friendly
* XOML now fully supports multi-touch events (up to 5 simultaneous events)
* Event bubbling added, enabling touch events to travel up to parent actors
* Actors and scenes now support proportional sizing
* Actors now support margins and docking to screen edges
* Actor touch events now provide the touch index that causes the event
* Sprites / actors can now scale their opacity by their parents
* Delta animations targeting position, scale, rotation, colour and opacity will apply the update from the original value that was assigned to the actor
* Actors now support simple bindings. Simple bindings are a simple binding of a variable to an actors property without having to create a full bindings list
* Actors can now be created from a brush. Using brushes instead of images, allows you to create image based actors without having specify a visual size
* Scenes and actors now support dynamic resizing and orientation changes
* Support for array variables added
* System XOML variable array added. Allows you to query current display width, height, mode, device type, multi-touch / compass, accelerometer, keyboard support. Also provides a rating hint as to the size of the display, which you can be used to determine size of fonts etc
* New program / command system added, This new system is a very powerful way of creating game or app flow logic in XOML
* New DebugText action that displays the value of a XOML variable / text to the debug output
* New ChangeProgram action that allows the modification of running programs
* New CIwGameAnimUtil class added that enables creation o simple timelines in code
* Images now support filtering and format conversion in code and in XOML
* CIwGameRender2d now supports rendering of images fom short vectors. These types of images will not use the data cache
* Actor / sprite rendering optimised to cut down processing of actors / sprites not on screen or visible
* Sprite system completely changed to support heirarchical rendering
* Text rendering optimised when not rotated
* Fonts, images and XOML files can now be conditionally loaded
* Scene FixedAspect and LockWIdth have been deprecated. Scenes now use the new CanvasFit option which supports canvas fitting to Width, Height, Both, None and Best Fit
* Physics can be disabled for a complete scene to reduce processing
* IwGame class now uses layer ordering to determine priority of touch events
* Re-arranged XOML tags and tag attributes, placing more commonly used tags / attributes earlier to speed up XOML parsing
* Touch focus is now released when user touches an actor and moves their finger away from the actor by more than double the radius. Touch focus is also released when camera is panned in scenes that have touch panning enabled.
* Frame rate cap has been removed
* BUG FIX: When releasing scene touch panning on an actor it no longer takes it as a tap on the actor
* BUG FIX: Mip-mapping globally disabled as it was causnig many rendering artefect issues
* BUG FIX: camera touch pan scaling, camera pan now follows finger accurately
* BUG FIX: Attempting to instantiate a template inside an actor crashed has now been fixed
* BUG FIX: Fixed issue with bool variable add method
* BUG FIX: CIwGameActor::setAngularVelocityDamping() fixed
* BUG FIX: Fixed issue where releasing a scene touch pan on an actor will send the OnBeginTouch event to the actor

As you can see that’s an immense bunch of changes. if you have been following the real-time updates in the forum then you will probably be aware of many of these changes: I can tell you one thing for sure, I did not enjoy updating the documentation

Lets take a more in-depth look at some of these new changes:

User Interface

The biggest change in 0.35 is the additional of the user interface system IwGameUI. Our aim was to create a user interface system that was good for both app and game development. With this aim in mind we believe we have created a user interface system that is better, more versatile and more extensible than currently available user interface systems.

Here are the main features of IwGameUI:

  • Data binding (two way in some cases). Data binding allows you to map XOML variables / arrays to UI elements and when those variables change the changes are reflected in the user interface components
  • 14 different kinds of controls (buttons, icons, labels, text boxes, list boxes, grids, sliders, canvas, stack panels, wrap panels, image views, text views, web views and tab bars)
  • Support for events and actions, such as handling button toggling, selection and value changes.
  • Fully integrated into IwGame’s animation system
  • Styling and templating
  • 9-patch rendering which allows you to render clean looking buttons / borders without losing resolution
  • Supports modifiers and other customisations, allowing you to augment the behaviour of UI elements
  • Supports proportional sizing
  • Supports dynamic orientation / screen size changes
Ywo example projects have been included with 0.35 that show a basic UI and a cmoplex UI. Yuo can see a video of the complex UI atΒ http://www.youtube.com/watch?v=ZImWhKwV1tA

Heres a quick example of a little bit of UI defined in XOML:
[sourcecode language=”xml”]
<StackPanel Background="PanelBrush" Orientation="horizontal" Size="-95, 100" AlignV="middle" Margin="0, 0, 10, 10">
<Icon Background="Button1Brush" Margin="20, 0, 0, 0" />
<Icon Background="Button2Brush" Margin="20, 0, 0, 0" />
<Icon Background="Button3Brush" Margin="20, 0, 0, 0" />
<Icon Background="Button4Brush" Margin="20, 0, 0, 0" />
</StackPanel>
[/sourcecode]

This bit of XOML will create a stack panel that contains 4 icons stacked horizontally at the side of each other. Notice that the width of the stack panel is set to –95. The new negative sizes represent proportional sizing, with –95 meaning either 95% of the parents container size or if no parent, 95% of the screen size.

Programs and Commands

Whilst the events / actions system is great for handling the event based parts of your game we felt that we needed a new system that would allow some kind of game / app logic scripting that would enable developers to define sets of complex functionality that can be ran at any point during the apps lifetime. Obviously as we are programmers we felt a program / command style system would feel most natural. We also felt that we needed a versatile system that the developer could completely customise to suite their needs, so we added the program system. IwGame’s program system allows developers to create complex programs from a list of hierarchical commands. Commands are executed in the order in which they are declared until the end of the program is reached. Commands can also executed concurrently, allowing the program to run multiple commands together each frame. Lets take a look at a quick program example:
[sourcecode language=”xml”]
<Program Name="Main" AutoRun="true" Priority="true">
<Command Parallel="true">
<Command Method="show_video" Param1="IntroVideo" />
<Command Method="run_actions" Param1="StartAnimation" Param2="Door" />
</Command>
<Command Method="show_speech" Param1="0" Param2="Hey how ya doing?" />
<Command Method="show_speech" Param1="0" Param2="Tap that door" />
<Command Method="wait_tapped" Param1="Door" />
<Command Method="set_property" Param1="Timeline" Param2="RemoveItemAnim" Param3="Door" />
<Command Method="wait_tapped" Param1="ID Card" /> <Command Method="add_inventory" Param1="ID Card" />
<Command Method="load_scene" Param1="Scene2.xml" />
</Program>
[/sourcecode]

We define a program named β€œMain” and tell I to automatically run when the scene is loaded. We set the program as a priority program, which means it is executed before all other programs.

Next we add a command that executes two other commands in parallel. This will show an intro video and start a door animation. Once complete the player will be shown the β€œHey how ya doing” speech and so on and so forth.

As you can see using the program system it becomes an incredibly easy process to define complex logical game and app flow.

Multi-touch in XOML

XOML now supports multi-touch events for actors. Actors can now respond to up to 5 simultaneous taps, begin and end touches. For example, you could control 5 actors at the same time on screen in a game, or create a cool user interface element that utilises more than one finger, like we have done with pinch zoom image and text view controls.

Proportional Sizing, Docking, 9-Patch Brushes and Orientation Changes

We now support proportional sizing of actors and margins, allowing you to create game and app layouts that are completely screen size independent. Actors can now be docked to the edges of the screen and canvas containers. 9-Patch brushes now allow the rendering of images where you want to retain the clean 1:1 pixel border around an image. All actors and scenes can now detect and handle orientation changes. Any actors or UI elements that are declared as proportionally sized will automatically be resized for you when the screen resolution changes. In addition, if no size is specified when creating an actor the actors assigned brush size will be taken as its visual size. We recommend that you create all actors from brushes to take full advantage this feature.

Array Variables, System Variables and Simple Bindings

XOML now supports the creation and definition of array variables. The bindings system also works with the array system. To access a particular element of an array to a property you would use variable_name:array_index, instead of simply variable_name.

A new system array has been added by default to the XOML system. This allows you to query certain aspects of the system such as display size, support for multi-touch etc..

Actors can also use simple bindings. A simple binding is a binding without a bindings collection which allows you to bind a single variable to a single actor property, e.g:

<ActorText Name="NameLabel" ......... Binding="[Text]ProfileName:2" />

In the above example we bind the 3rd index of the ProfileName array to the Text property of NameLabel.

Event Bubbling

Actors now support bubbling of touch events. Actors can be marked to receive input events from their child actors

Actor and sprite optimisations

We have gone through and optimised the actor and sprite systems to cut down a lot of rendering and processing of actors / sprites that are clipped or off screen.

Scene Virtual Canvas Sizing

We have changed the way a scenes canvas sizing is set-up to make it more versatile. You can now choose the method by which iwGame scales your scenes to the final display as well as choose the scenes origin

Image filtering and format conversion

When images are declared in XOML you can now specify if they should be filtered when rendered. You can also specify the format that you would like the image to be converted to before uploaded to texture RAM, reducing the size of your texture RAM usage.

Licensing Terms Updated

The licensing terms for IwGame Engine usage has been changed. Whilst there are other minor changes, the main change is:

You may not use the IwGame Engine or any of its parts to create products that can be used to create other apps and games for mobile devices without express prior written notice from an executive of Pocketeers Limited with the correct authority to grant authorisation.