Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

3. March 2013


After a 4 month pause, there has been a new Moai release.  They also removed sign up requirements to download the SDK ( which was misleading before, so nice move ) as well as added nightly builds for those that like to walk on the wild side.


The biggest new features are android keyboard support ( finally! ), better threading and off screen frame buffering.  The full changelog is below


tTerrainMask () to MOAIPathFinder; renamed setTerrainScale () to setTerrainWeight ()
* Some work has been done on threading. Check MOAIThread.
* added support for default texture; finished async load; samples for async texture load
  and default texture
* added support in MOAIDataBuffer to detect zip files, inflate on load; added inflate on load
  support to MOAIDataIOTask
* moai coding style guide in .doc format
* first phase of offscreen rendering architecture completed
* added setClearColor () to MOAILayer
* samples to test multiple viewports inside an offscreen buffer
* integrated sfmt random number generator
* Merged playnomi contribs to MOAIImage, MOAIImageTexture, MOAIParticleSystem and MOAIParticlePexPlugin


by Adam Villalobos ( )
* Adding GCM support ( replacing C2DM ) to Android host.
* Adding file not found log if a texture file fails to load
* Fixing build errors for DataTaskIO
* Fixing issue with setting visibility not properly updating dependencies
* Fixing bug with Font reloading on Android
* Added Android keyboard support


by John Copic ( )
* Adding sfmt lib to android build.


by JoakimBlomberg ( )
* Script node apply of attributes should unpack attribute id or it will not be applied


by Bogdan Tatarov ( )
* adding MOAIUnitzSound::_getFilename()


by mxttie ( )
* updated box2d physics sample adding mouse manipulation using mouse joint


by Tommo Zhou ( )
* fix edge case that new-created-paused action cannot receive further update
* fix: MOAIImageTexture not override OnInvalidate


by Antonio ( )
* Initial Camera Support for iOS


by sporksmith ( )
* Log file-open failures


by Clement Farabet ( )
* Fixed VSYNC issue for OSX host.
* Added missing files to iOS (XCode) project.


by Francisco Tufro ( )
* Several fixes in build systems for all platforms
* New release script in bin/distribute


by Stephen Belanger ( )
* Recommended to enable this with C-Ares


by Ben Borowski ( )
* Adds call to FMOD update to iOS sample project.


by Robert Wahler ( )
* GlutHost will run "main.lua" if host binary is called without arguments
* add Lua global 'arg' that mimics the lua/luajit built-in global 'arg' to GlutHost


by Alexey Zankevich ( )
* MOAIJsonParser fix - checking if lua number is integer has been added
* Fixed MOAIEnvironment.screenDpi nil issue for Android
* Fixed MOAIEnvironment.screenDpi nil issue for iOS host


by Seebs ( )
* Clarify description of textbox color escapes, fixing one typo and reducing confusion
  between number of bits and number of values represented.
* Terser output
* add (untested) support for controlling GL blend equations.


by ChairGraveyard ( )
* Add support for collideConnected flag to MOAIBox2DWorld::_addRopeJoint
by out-of-pixel ( )
* Fixed last Key Error from MOAIAnimCurve


by superquadratic ( )
* Fix Clang 4.2 (Xcode 4.6) Compiler Warnings


They also changed the file structure as follows:

bin/ Development binaries for Windows and MacOSX, Linux will be added soon
docs/ Documentation for this release and attribution images
hosts/ Source and IDE projects for the different platform's hosts
include/ Include headers
lib/ Compiled (static and/or dynamic) libraries for all the supported platforms
samples/ Moai SDK feature samples


Head on over to the Moai website to download.

News ,

28. February 2013

I have decided to take a closer look at the Loom game engine that I mentioned recently, as I am an absolute sucker for new game engines, especially ones that are currently free.  You can consider these posts a cross between a diary and a review as I dive in to what it's like using Loom.  Of course, I am also documenting the process, so if you are just getting started with Loom hopefully these posts prove useful for you.


Alright, let's jump right in.


Quick summary to those that didn't read the above link.  Loom is a 2D game engine, based around a custom scripting language Loomscript, which is a bastard love child of ActionScript and C#. Behind the scenes it is written in C++ over the Cocos2D-x library (and others) and you can get full access to the source code. Full disclosure, I've never actually used ActionScript before, but I have a fair bit of JavaScript and C# experience as well as a copy of the book The ActionScript 3.0 Bible so hopefully I can puzzle things out as I go.


Getting Started -- Installation and creating your first application


First things first head on over to site sign up and download Loom.  Be sure to use a valid email address and password, you are going to need them later.  Log in and download the version most applicable to you.



In this particular case, I'm using MacOS, but it should simply be a matter of substituting the words "command prompt" wherever you see "Terminal".


Now that it's installed, welcome to an interesting part of Loom.  It is command line driven.  During installation it will have installed itself to somewhere in your systems path (/usr/bin/loom in my case on Mac OS), simply open a terminal/command prompt and change to the directory where you want to create a Loom project.

Now type loom login

When prompted for credentials, use the username and password you signup with.  If all went well you should see:



If you don't get Login successful! well, good luck finding out if has good support or not. :)


Now we actually want to create a project.  From the same terminal window type:

loom new ProjectName

like so:



Voila, a new project should have just been created for you.


Now simply change into your project directory and type loom run

Loom will now download the latest SDK and compile your code like so:



And assuming everything went well, your skeleton application will run:


And you've just created and run your first loom application in about 4 minutes work.


Now for the first annoyance… for some reason, after calling loom run once you close your application window, the script is hung.  You need to CTRL+C to stop execution of the script in your terminal window.  Small oversight, but kinda irritating… at first it just seemed like it was simply hung up, especially as my LoomTest application didn't get focus on execution, so I wasn't even aware it was running at first!


Anyways, that's a pretty small beef and something easily fixed in time.



Setting up an Editor


Command line tools are all nice and good, but I am spoiled from years of Visual Studio development… I like working in an IDE or at least an editor.  Fortunately Loom has configurations for a very good one available, Sublime Text.


This part is completely optional, but I am now going to configure Sublime Text to work with Loom.

Initially all I am going to do is add LoomScript syntax highlighting, I don't really mind switching to a terminal window to build/run my application.  To do so, head over to this thread and download the linked bundle zip file.  I assume you have already installed SublimeText, if not, do so now.

Extract the zip file.  Inside the extracted folder is another folder called LoomScript.  Copy it.

(The following is MacOS specific)

Open Finder then hit Command Key + Shift + G

In the field enter ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/

Paste the folder LoomScript in this directory.

Now start Sublime Text and select File->Open… and navigate to the folder you created your Loom project in.  If should look like this with complete syntax highlighting.



This mostly just gives pretty syntax, if you want closer to a full IDE experience, be sure to read this post! apparently have a full IDE in the works, but for now, IDE should prove a usable solution.  I am going to continue investigating getting code completion working though, a feature I really like.


Learning Loom


This part may not seem immediately obvious… so now you have your game created, how do you actually go about learning Loom?  

Well, there are two ways.  First off, there are a series of examples you can download and dissect from right here.

Second, in your terminal, change to your project directory and simply type loom docs 

The documentation will then be loaded in your default browser like so:



Well, we are now setup and running with our first primitive app.  That's enough for now, in the next part I will get down to writing some actual code.


You can read the next part right here

27. February 2013

With the fundamental shift from a fixed to a programmable pipeline, finding modern style OpenGL resources can prove a bit tricky.  Therefore I have put this page together to show a collection of useful modern GL related links, books and materials.  If I missed something you believe I should add, please let me know!


Tutorials, Wikis and eBooks

The OpenGL wiki, probably the place you should start.  Contains documentation on most of OpenGL as well as complete references for both OpenGL functions and GLSL shader programming.

Specs and documentation for OpenGL.  Loads here but a bit… stark.

A series of 40 OpenGL tutorials including lighting, shading, normal mapping, skeletal animation and more.

Actually an ebook, covers most of OpenGL

Another series of OpenGL tutorials covering a range of subjects and bordering on being an ebook.

A series of OpenGL tutorials for OpenGL 3.3 and higher.  Broken into basic, intermediate and misc categories.

Another ebook on OpenGL, some on 3.3, some on 4.0.  Makes use of freeGLUT and GLEW.

A series of GLSL tutorials.  GLSL is the shader language used with OpenGL.

An intro to modern OpenGL.

Ozone3d offer a range of tutorials on a number of OpenGL subjects ( as well as Direct3D tutorials if you are interested ).

Typhoon Labs GLSL tutorials ( PDF format ).

nVidia have a half dozen tutorials available at the above link, as well as a number of tools such as the NVIDIA PerfKit and Cg and FX Composer.

AMD's (ATI) developer page.  No tutorials, but a number of useful applications for developers.

Using OpenGL with SFML.

Using OpenGL with SDL

LazyFoo's OpenGL tutorials.  Some are OpenGL 2.1 era while later ones are more modern style.

A work in progress series of OpenGL 4 tutorials.  Only the tutorials with working thumbnails currently exist, but certainly one worth keeping your eye on!

Another series of tutorials for OpenGL 3.3 (and higher).  Pretty good collection of materials covered from beginner to intermediate topics.

The title says it all. Covers writing OpenGL code that can run on multiple platforms with minimal changes.

Code Samples

A series of code samples to go along with the tutorial series from  Cover setting up Xcode, Visual Studio and Linux, as well as texturing, model loading, cameras, matrices and more.

A series of well commented modern OpenGL samples that make no use of an external library.  Includes some advanced samples such as a Voxel rendering engine.  Note, these tutorials aren't hosted on GameFromScratch, we simply provide a table of contents and description of each in one place.

OpenGL samples from the author of the GLM library mentioned below.  Website explaining what is contained is available here.





GLFW is a cross platform open source library for handling window creation and management as well as dealing with input.


GLEW stands for OpenGL Extension Wrangler and it makes working with OpenGL extensions easier.  It makes it easy to querying if a device supports a given extensions as well as calling that extension a much simpler process.


GLUT stands for OpenGL Utility KIt and it is for creating and handling Windows like GLFW as well as keyboard, mouse and joysticks in a cross platform manner.  It is not being actively developed, so other options are probably better choices.  The last release was in 1998.


Is an open sourced implementation of GLUT under more active development than GLUT.


Simple DirectMedia Layer is a 2D game programming library that can be used to create windows and handle input, as well as simplifying many 2D graphic tasks.


SFML is a 2D game programming library built over OpenGL.  Like SDL it can be used for window creation, input, audio and more along side your OpenGL library.

OpenGL Mathematics

Header file only C++ mathematics


As you may have guessed at this point, OpenGL has no facilities for creating windows or handling input, sound, networking, etc.





OpenGL Programming Guide: The Official Guide to Learning OpenGL Version 4.3 (8th Edition)  (Safari Link) OpenGL 4.3

OpenGL SuperBible: Comprehensive Tutorial and Reference (5th Edition) (Safari Link) OpenGL 3.3

OpenGL 4.0 Shading Language Cookbook (Safari Link) OpenGL 4.0



Language Bindings



OGLPlus is a C++ wrapper for OpenGL 3.x and higher.


OpenGL, OpenAL and OpenCL wrappers for .NET languages such as C# and


OpenGL, GLU, GLUT wrapper for Python.


OpenGL bindings for Java.


Lightweight Java Game Library, a Java layer over OpenGL, OpenAL, OpenCL as well as additional input support.

( There are many many many more language bindings/wrappers for OpenGL for dozens of languages.  These are some of the most common ).



See Also


OpenGL ES 2

OpenGL ES 2 is the most modern reference implementation for OpenGL on mobile or embedded devices.  It's derived from OpenGL 2 and is very similar but varies in some ways from desktop OpenGL.


WebGL is OpenGL ES 2 for the web, it is a JavaScript based library.  WebGL support in modern browsers is getting better, but is by no means universal, nor is the performance consistent between browsers.


On open source implementation of the OpenGL standard, currently compatible with OpenGL 3.1.


OGLPlus is a C++ wrapper for OpenGL 3.x and higher.

26. February 2013


Just saw this pop up on Reddit and I thought I would share.  Yesterday a new engine was released, Loom.  (Nothing to do with the excellent game from LucasArts).image  Loom works on Mac and Windows and can target Mac, Windows, iOS and Android.




Loom is a new game engine 2D game engine, written in C++ and powered by their own custom scripting language, which is a mix between C# and ActionScript.  Looking at the code samples, this engine is obviously built over top of the Cocos2D game engine, which is one of those love it or hate it APIs.  Built around a command line interface, you can rapidly create and debug projects.  Additionally it includes a gameplay framework, UI library, Tweening library, Chipmunk physics, unit testing and more.





Licensees get the complete C++ source code and right now, licenses are free.  Eventually indie licenses will be 500$, and going up from there, so if you are interested, be sure to snatch up a license now.  You can read full details about the licensing here.


There are a good number of demos available with source code.  They also offer paid support, which is always handy.


You can learn more about the Loom engine at  Clever name that… Sign up for a free license here.


25. February 2013


Samsung and Chillingo have launched their 100% indie campaign.



Basically they are offering developers (initially) 100% of revenue of games sold in their app store.  As of writing, there are just under 7 days remaining to submit the (note, not your) application if you are interested.


I have a couple Samsung phones and I have to say, I never liked their app store. That said, if you are developing or developed an Android game, I can think of few reasons not to submit it.  Another sales outlet is always a nice thing, as of course are 100% royalty rates.


Very few details exist right now, so be sure to read the fine print… when you find it.  You can sign up here.


Month List

Popular Comments

Node server side handling of Handlebar templates
Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

25. June 2012


In my prior post introducing the bones of our YUI based level editor, I showed the following way of loading in a template from the server:

initializer:function(){ var that=this, request ='/scripts/views/templates/person.Template',{ on:{ complete:function(id,response){ var template = Y.Handlebars.compile(response.responseText); that.get('container').setHTML(template(that.get('model').getAttrs(['name','age','height']))); } } }); }


This works, but it is less than ideal.  There are alternatives, but each has a downside.  You can compile the template into a JavaScript string, but then, what is the point of creating a template in the first place?  The nice thing about a template is, it is basically just HTML with a small bit of specialized markup in it.  You can send that template to a designer, who can then make modifications to your UI without knowing anything but basic HTML.  Of course, nothing is preventing you from going through the compilation step with the finished result, but this will be a massive time sink on your productivity. 


Probably the best answer, is to compile the templates on the server.  I didn’t go this route because frankly, it made for a really lousy tutorial.  It would basically take the same amount of code for JUST loading dynamic templates, as it would take for all the rest of the project combined!  This IMHO added a needless level of complexity to the tutorial and would only confuse people.  However, loading from the server is *IS* a better way to do it, and I was considering making an additional post for people interested in doing it that way.


Nicely, I don’t have to, someone else has done it for me! Smile


In this thread (about this thread… a real Conception moment here)  on the YUI forums, user Satyam has taken the ball and run with it!  So if you are interested in how you would implement templating on the server side, be sure to check it out.  The nice part about implementing it server side is, you still get your markup nicely separated from the rest of your code, however, you eliminate the asynchronous call to fetch the template from the server.  Thanks Satyam.


This, is the modifications he made to server.js to support loading of templates server side, while this is the modification he made to the view.  It is certainly more complex, but it is also a much cleaner implementation.

Programming ,

blog comments powered by Disqus

Month List

Popular Comments