Booty5 – Free HTML5 Game Engine

I’ve finally branched out into HTML5 game development, I’ve been avoiding it for years but finally took the plunge. Funnily enough my first creation with HTML5 is the Free Games Bandit, a service to help game developers get their mobile games noticed. I found myself actually enjoying working with JavaScript, CSS and HTML5. I’ve changed my whole mindset regarding HTML5, where I once saw it as a tool for creating gimmicky web site widgets I now see it as a valid way to make games and proper slick interactive web sites.

With the previous paragraph in mind I have begun the long journey of creating an HTML5 game engine, which I have randomly named Booty5 and is hosted on Github. I’ve already made some headway putting together the basics of scene / actor management, support for sprite atlases / sprite animation, Box2D physics and animation via GSAP etc..

My plans for the engine in the future are to support a majority of features from the AppEasy Core SDK. I am also in the process of extending the Goji Editor to enable support for building, testing and deployment of HTML5 games.

You can find out more about the free game engine here

HTML 5 Gotchas

On this page I will place all of the gotchas that I come across during my HTML 5 developments.

IndexSizeError: Index or size is negative or greater than the allowed amount

I got this error Firefox and a similar error in Internet Explorer whilst drawing an image to the HTML 5 canvas using drawImage(). The problem turned out to be trying to draw a portion of an image that was outside its bounds. I was drawing what I thought was an 800×600 image, which was actually 798×600 so the source rectangular area that I was drawing was off the edge of the actual image. Doh!

HTML5 cheat sheet

This page is basically a dumping ground for all the useful bits of info that relates to HTML5 development.

Useful HTML5 semantic elements

    <article> – Defines an article in the document
    <aside> – Defines content aside from the other page content
    <footer> – Defines the footer for a section in the document
    <header> – Defines the header for a section in the document
    <nav> – Contains page navigation links
    <section> – Defines a section in a document

HTML 5 Journey Part 1 – What is HTML 5 tutorial

I’ve always liked web development (from a gaming perspective), but not to the same extent as I have good old solid native development with C++. The main reason being “JavaScript”. To be honest, I did JavaScript years and years ago and it terrified me, I couldn’t get used to not having pointers and variables that have a set type amongst other things. The main problem however for me has always been speed, if I want to make a game I want to provide a good interactive experience without loads of lag, slow frame rates and dodgy access to things like audio playback and input. So, for years I avoided client side JavaScript and the DOM and went with Java Applets, which seemed great, nice and quick, good frame rates, can render 2D and 3D, access to I/O etc.., but if I remember correctly there were browser security issues, oh and it crashed (or refused to load) across different browser versions. After a while mucking around with applets I went to Microsoft Silverlight, followed it for a few years, made some nice things with it but then Microsoft dropped support for it in favour of HTML 5! (How can I ever forgive you Microsoft!) Now everyone and their grand mothers seem to be bending over backwards to support HTML5, so I feel like its time to finally take a good look at this newish technology and see what I can do with it.

This blog series is going to cover my noobish attempts to learn how to use HTML5 / JavaSctipt with possibly a little PHP back-end junk thrown in. At the end o the blog series I will probably revisit the series and tidy up so I can mislead as few developers as possible!

Right waffle over, on with something useful.

What is HTML5

Well, I’ve purchased various HTML5 books and started to read them, missing my C++ and the Marmalade SDK already. I’ve come to the conclusion that HTML5 is a bunch of things:

  • Well it uses HTML5 mark-up to begin with, but some new cool tags have been added to provide access to stuff like a drawing canvas and video playback
  • Cascading style sheets (CSS3), this is a language that you use to add style to the various HTML page elements
  • JavaScript, this is the language used to manipulate the HTML of the page and what not

How do I create an HTML 5 page?

Simple, create a text file using any old text editor (I use Notepad++ as it has syntax highlighting for HTML, CSS and JavaScript) and called it something,html. You can open this file in a browser to view the page which as Mrs Brown says is nice.

Here’s an example HTML5 page that does absolutely nothing useful:

[sourcecode language=”html”]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML5 for absolute noobs (I appear in browser bar)</title>
</head>
<body>
<h1>HTML5 for absolute noobs header</h1>
<p>
HTML5 for absolute noobs paragraph
</p>
</body>
</html>
[/sourcecode]

What does all this junk mean? Lets take a look at it in sections.
Line 1 – This tells the browser that this is an HTML 5 document
Line 2 – The html tag tells the browser that the stuff in this section contains HTML
Line 3 – The head tag contains things like the page title, which scripts and style sheets to include
Line 4 – The meta tag describes metadata such as the character set that the document uses
Line 5 – The title tag is the title of the page, this is usually displayed in the browser title bar
Line 6 – Closes the head tag
Line 7 – The body tag contains the main body of the document, basically all of the text, images and so on
Line 8 – The h1 tag designates whatever is inside it as a level 1 header and will be styled as such, usually large and bold unless redefined with a style
Line 9 – The p tag begins a new paragraph on the page
Line 10 – Some content to display in the paragraph
Line 11 – Ends the paragraph
Line 12 – Ends the main body
Line 13 – Ends the html document

How do I add some style to my web page?

Well to begin with we will add some style to the previous example to make it look a little colourful. We will use what’s called inline styling. This is when you are too bone idle to create a style sheet and link it into your document. Lets take a look at an impossibly useless example:

[sourcecode language=”html”]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML5 for absolute noobs (I appear in browser bar)</title>
</head>
<body>
<h1 style="color:green;">HTML5 for absolute noobs header</h1>
<p style="color:blue;">
HTML5 for absolute noobs paragraph
</p>
</body>
</html>
[/sourcecode]

if you are as observant as I then you may notice that two lines in the code have changed:
Line 8 – We have added an attribute called style then stuck some stuff into quotes. We basically tell the browser to change the colour of the text in the h1 tag to green
Line 9 – We have also added the style attribute here, but changed the text colour to blue instead

How do I style stuff using CSS instead of inline styles?

Most web developers prefer to use a style sheet to style elements of the web page, which I am guessing when my web page becomes bulky and very scarey will make it much easier for me to change the look of my web page without having to go through and change every single style that I set. A style sheet is basically a text file with the extension .css that you include in your html document. You include a style sheet like this:

[sourcecode language=”html”]
<head>
<meta charset="utf-8">
<title>HTML5 for absolute noobs (I appear in browser bar)</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
[/sourcecode]

Inside our header tag we have added a link to a style sheet called styles.css. When the page is loaded this style sheet will be loaded and all styles within it will be applied to elements of the page. If the style sheet does not contain styles for elements that are on the page then they will get the good old default ugly style. Lets take a look at an example style sheet:

[sourcecode language=”css”]
h1 {
color: green;
}
p {
color: blue;
}
[/sourcecode]

In the above style sheet we list the h1 tag and then place a bunch of attributes that we want to redefine along with their values separated by the colon character inside braces. The only problem with this is that it will change the colour of all h1 and p tag content that’s on the page, which is great if that’s what you want, but not so good if it isn’t.

To get around this you can name your elements and then simply define a style for the named element. Lets look at an example:

[sourcecode language=”html”]
<h1 id="header1">HTML5 for absolute noobs header</h1>
<h1>I refuse to have style!</h1>
[/sourcecode]

[sourcecode language=”css”]
#header1 {
color: blue;
}
[/sourcecode]

We have named the first h1 tag header1 using the id attribute. We can refer to this named element in the css file by placing a hash character in front of the name.

There’s a ton of other stuff that you can do with CSS from what I understand, but I’m not clever enough to go into that just yet, maybe in a later article.

How do I get some JavaScript code into my web page?

There are two ways, you can use inline JavaScript, this is code that you write directly into the html document, which can get rather messy. Theres also the much cleaner and user friendly way of including a JavaScript file into the document rather like we did with the style sheet. Lets take a look at inline JavaScript first. Run the following html:

[sourcecode language=”html”]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML5 for absolute noobs (I appear in browser bar)</title>
</head>
<body>
<h1 id="header1">HTML5 for absolute noobs header</h1>
<p>
HTML5 for absolute noobs paragraph
</p>
<script>
document.getElementById("header1").style.color = "blue";
</script>
</body>
</html>
[/sourcecode]

At lines 12-14 we have inserted a script tag containing a single line of script. The script itself looks for an element called header1 then changes the color attribute of its style to blue.

Now lets take a look at an example where we use common sense and decide to put our code into a separate script file. Create the following two files (test.html and code.js) then open the html file in a browser:

[sourcecode language=”html”]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML5 for absolute noobs (I appear in browser bar)</title>
</head>
<body>
<h1 id="header1">HTML5 for absolute noobs header</h1>
<p>
HTML5 for absolute noobs paragraph
</p>
<script type="text/javascript" src="code.js"></script>
</body>
</html>
[/sourcecode]

[sourcecode language=”html”]
document.getElementById("header1").style.color = "blue";
document.write("Hello World");
[/sourcecode]

At line 12 of the html file we have still got a script tag, but instead of placing our script inside the script tag, we have moved it out into its own file and included the script file into the html document.

Well, I’ve had enough for one evening, my feet ache. I stand at my desk instead of sitting because I’m into self punishment. I hope to cover something a little more interesting next time, maybe take a look at the DOM.

Oh, do I care about typos and bad spelling / grammar? No, if I did then I would have become an English teacher and not a programmer!

AppEasy Core SDK is now open source!

If I remember correctly I promised a while back that I was going to open up the source to the AppEasy Core SDK. if you don’t know what that is then its a FREE open source cross platform game and app engine for mobiles and desktop that can be re targeted to work on anything you like as long as you implement the platform abstraction layer. At the moment, a Marmalade SDK layer is implemented so you can use it right out of the box. You will however need a Marmalade license to use it, although having a Marmalade license will give you deployment access to a vast range of platforms so its well worth it. if not then simply implement the platform layer for whatever platform(s) you desire. If you dont fancy any of that and just want to use Lua and XOML then you can always give the AppEasy service a try, which lets you deploy apps to iOS / Android and Windows desktop without the need to compile and re-write code etc..

AppEasy Core SDK is basically the big professional and powerful child of the old IwGame Engine. The IwGame Engine started as a tutorial project that I started a few years ago that was meant to teach developers how to use the Marmalade SDK. However, Marmalade has no out of the box game engine so IwGame evolved into a fully fledged game / app engine to fill that gap, although it was hastily developed and built directly on the Marmalade platform. I’m very much a recycler, so that’s not how I generally like to write an engine, I like to have a clear separation between engine and platform so it can be re-targeted at different platforms quite easily. I also wanted to get rid of the obscenely long names and add some proper structure / documentation to make the whole thing more easily understandable.

Well I think I accomplished all that and more, I also added many new features and fixed a mass of bugs along the way. When I get the time I will be replacing the old IwGame Engine page with an AppEasy Core SDK page, for me IwGame needs to be buried now I think.

I also developed a game / app editor called Goji Editor that lets you develop full on games and apps within the editor and export to AppEasy, Marmalade Quick and other engines coming soon, including HTML 5.

AppEasy Core SDK has the following core features:

General Features
– FREE and open source! (MIT)
– Can directly use data exported from the Goji Editor (http://www.gojieditor.com)
– Can be targeted at any development system / SDK by implementing the platform layer
– Marmalade SDK platform already implemented, giving you access to many platforms out of the box
– Develop using XML, Lua and / or C++
– Easy to learn mark-up driven language called XOML that enables rapid development
– Support for Lua scripting
– Styles and Templates
– Local and web based assets
– Proportional sizing and positioning
– Auto screen sizing and device orientation lock
– Local storage access
– Multi-touch input
– Accelerometer and compass support
– Smooth sub-pixel rendering and batch rendering for speed
– Touch panning and pinch zoom
– Persistent data
– HTTP POST / GET defined declaratively
– Access to video camera streaming
– Define actions that can be carried out when events occur

Game Features
– Polygonal based sprites and sprite depth
– texture atlases and batching
– Support for Scenes (game world / app canvas) and Actors (game / app objects)
– Images, fonts, compressed WAV sound effects and and MP3 music
– Animation
– Box2D Physics (fixtures, shapes, materials, collisions and joints)
– Video Playback

App Features
– Create simple or complex user interfaces
– Full support for simple and complex data bindings
– Data definition and organisation
– Access to local and remote data
– Support for SQLite

User Interface Features
– Text input boxes
– Buttons / Check boxes
– Labels
– Icons
– Sliders
– Panels (StackPanel, WrapPanel, Canvas)
– Grids
– Image / Text View – Support for pinch zoom and pan
– Web View (display web content)
– Tab Bars
– Video Overlays
– Sliders
– XML data bindings
– Multi-touch based user interface (up to 5 simultaneous touches)

Monetisation Features
– Ad integration
– In-app purchases

Advanced Features
– XOML Variables
– Modifiers
– XOML Programs and commands
– Inline scripts

Social Features
– Facebook API support

API documentation
API documentation is located at http://www.appeasymobile.com/appeasy-api/

The AppEasy Core SDK comes complete with:
– PDF documentation located in the Docs sub folder
– Extensive doxygen code documentation
– An example app that contains 70 examples demonstrating many parts of the SDK
– An example game
– XML schema for XOML

Whilst free support is not provided, a community support forum is available at AppEasy Community

You can download AppEasy Core SDk from Github

Goji Game and App Editor beta is now available

The Goji Editor has finally entered beta and is now available for download from www.gojieditor.com.

What is the Goji Editor?

One of the more difficult processes involved in developing applications and games is how to create and organise the content. By organising content we refer to managing all of the elements that make up the game or app, such as images, sounds, brushes, physics materials, level layouts, user interface layouts, scripts and so on. The Goji Editor primarily helps you to quickly create and test game levels / app layouts and organise the lifetime of resources as well as test in real-time across different screen resolutions.

Goji’s secondary function is to enable full game and app production using available game and app development systems such as AppEasy / IwGame Engine, Marmalade Quick, Corona, GiderOS, HTML5 etc,.,. Goji aims to be as platform and development system agnostic as possible to ensure that exported data can be used by any development system and on any platform.

What does the Goji Editor look like?

Goji Editor Screenshot

Who is the Goji Editor for?

Goji has been designed primarily for designers and developers that create apps and games for mobile and desktop systems. However, Goji is flexible, supporting a huge canvas area and could be used in any capacity that involves organising and laying out graphical information spatially. Goji is also a great learning tool for students that are interested in learning the process of putting together apps and games in an environment where they can make changes and see the results of those changes very quickly.

What are Goji’s features? 

  • Create and organise game level levels and app layouts into scenes and actors

  • Export to many different game and app engine / programming language formats, including AppEasy / IwGame Engine, Marmalade Quick, JSON, XML (HTML5, Corona and GiderOS coming soon)

  • Export in multi-resolution friendly format, allowing exported data to be used on any sized display

  • Assisted layout editing, including tools to enable easy layout / layout management, bookmarking, edge / vertex snapping, directional cloning and so on

  • Full drag and drop support, drop entire folders of resources onto Goji and Goji automatically sorts them all for you

  • Support for import of SVG, Texture Packer and other formats

  • Support for physics including fixtures, joints and the ability to test physics

  • Definition of gaming logic and play using events and actions lists

  • Support for Lua / Javascript and other language editing, includes syntax highlighting, code folding and search / replace

  • Interactive play mode that launches the game using the built in engine or other engines, also shows coloured debug output

  • Create complete working / runnable projects

  • Support for user properties

Notes:

  • TexturePacker is a tool that is used to combine many images into a single image, usually referred to as a sprite / texture atlas. Packing images into a single image improves rendering performance.

  • SVG (Scalable Vector Graphics) format is an XML based format that is used to represent two dimensional vector art work. Goji imports the following tags svg (scene), g (layer), image (actor), rect (shape) and path (shape or geometry). SVG is used by packages such as Inkscape and Adobe illustrator

Future features

Features that are currently in development or will be available in the near future include:

  • Export for Corona, GiderOS and HTMl5

  • Complex actions lists

  • Support for animation creation using timelines

  • Deployment to iOS and Android devices

  • Support for audio, video, web views, in-app purchase, ads and many more additional services

How do I download the Goji Editor?

At the moment the Goji Editor is in open beta and is free to use, however the Goji Editor will eventually become a paid product in the future. To download the Goji Editor please register and sign in then click the download menu to be taken to the download area where you can download a beta copy of the Goji Editor.

 

Marmalade Offering FREE licenses


Get Marmalade SDK for FREE

Marmalade the developers of one of the most powerful cross platform mobile and desktop development systems the Marmalade SDK are now offering FREE licenses. Marmalade are committed to ensuring that developers have the tools to deploy to established and emerging platforms first.

What is the Marmalade SDK? The Marmalade SDK is an awesome easy to use cross platform SDK that enables cross platform development for smart phones, tablets and emerging technologies such as smart TV. Marmalade supports unified development and testing across iOS, Android, Windows Phone 8, BlackBerry PlayBook / OS 10, Bada, Windows, Mac OS X and soon Tizen.

Marmalade comes in three flavours:

  • Marmalade C++ – Develop and test 2D / 3D apps and games using a mature C++ API that covers everything from 2D / 3D graphics and audio to native UI and unified in-app purchasing
  • Marmalade Quick – Develop and test 2D apps and games using a very easy to use Lua API that covers everything 2D and audio to physics and unified in-app purchasing
  • Web Marmalade = Develop and test HTML based apps and games using a very easy to use JavaScript API

All of the above enable testing right on a Windows or Mac desktop, with easy device deployment.

Changes are Coming Soon

Very soon IwGame will be transformed into a new form known as the AppEasy Core SDK. AppEasy Core SDK is the new version of the IwGame Engine that has been tidied up and made portable, making it easily portable to other platforms. Initially AppEasy Core will support the Marmalade SDK as a target platform with support for the following platforms being added over the coming months:

  • Cocos2d-x
  • iOS native
  • Android native
  • Windows XP/7/8 native
  • Windows Phone 8 native
  • BlackBerry OS 10 native
  • HTML 5

Our aim is to bring XOML to as many platforms as possible, making mobile app and game development as easy as possible for everyone.

We will also be creating AppEasy players for all of the supported platforms to enable C++ free development for everyone.

To keep tabs on the progress of our project take a look over at http://www.appeasymobile.com

New Marmalade SDK FAQ

I trawl the Marmalade SDK forums from time to time and I see many questions that come up from time to time. In an attempt to answer those questions and cut down Marmalade forum traffic I have started a Marmalade SDK FAQ that should hopefully help fellow Marmalade developers find answers to commonly asked questions without having to wait for forum responders or search high and low through the SDK documentation / web.

The new FAQ is located at http://www.drmop.com/index.php/marmalade-sdk-faq/

It is also available in a more compact and readable PDF format from http://www.drmop.com/Marmalade_SDK_FAQ.pdf

Pocketeers Limited is taking on New Mobile Projects


Pocketeers Limited Mobile Developer Logo
Pocketeers Limited Mobile Developer

 

Need a mobile game or app developed across multiple platforms (iPhone, iPad, Andriod,Bada, PlayBook etc..) at little extra cost? Or maybe you need a rapid prototype of your next game or app idea creating as proof of concept?

Pocketeers Limited a UK based mobile app and game developer (established in 2002) responsible for the creation of the IwGame Engine are looking to take on additional gaming and app projects. Pocketeers will consider any size project, but will favour those projects that utilise the IwGame engine / Marmalade SDK. Pocketeers have worked with clients large and small including the likes of Electronic Arts, Destination Software, Ideaworks, Honey Badger Studios, Tournay Software, and others.  Pocketeers provide a full range of services including design, coding, art work, audio and testing at very competitive prices.

For more details you can contact Pocketeers Limited via the web at http://www.pocketeers.co.uk/?page_id=8