Moai SDK 0.7 is now available for download. The big change this release is a reworking of the virtual file system. In the last release we provided a baseline implementation of PhysFS. As we spent more time with PhysFS we realized that it wasn’t a match for what we wanted and decided to implement our own virtual file system instead.

If you look at the 0.7 beta source tree you’ll see a new library called ‘zipfs.’ This is our replacement for PhysFS. It is written in C and very much a low level, stand-alone library. Unlike PhysFS, which imposes its own file system model based on search paths and multiple working directories, zipfs allows the user to mount an archive on a virtual path that simply extends the native posix-style file system. Once mounted, the archive may be navigated like any other directory. The other difference between PhysFS and zipfs is that zipfs provides a ‘lookalike’ implementation of the stdio library functions that deal with files as well as replacements for some of the posix directory and working directory functions. In addition, zipfs provides a simple, iterator-based API for reading directory contents. We’ve gone ahead and tailored Lua 5.1.3 to replace the stdio file routines with their zipfs equivalence. We’ve also exposed zipfs through MOAIFileSystem. This means that all of the default Lua io functions should work ‘out of the box’ with both standard and virtual directories. While we have not yet patched libcurl or sqlite to use zipfs, doing so is simply a matter of doing find/replace for the subset of stdio we care about. I should stress here that zipfs itself is based on stdio and should therefore be compatible with most operating systems. In the event you do not want to use a modified version of Lua, simply link Moai against an unaltered (or differently altered) Lua source. You may then opt to eschew the use of zipfs altogether or alternatively bind in your own replacement for Lua’s io library at runtime (without changing Lua’s source). To make zipfs work with Lua, we also had to implement vfscanf. This is still a work in progress and has a long way to go to be anywhere near the ANSI spec. For example, character set matching is not yet supported. We’ll be fleshing it out more as we have time (or the need becomes pressing). For now, be aware and use with caution. (Or add the fixes yourself and send us a pull request!) A few other things to look for in this release: We’ve extended the Box2D wrapper to include better support for joints and their interfaces. The joint implementation hasn’t been fully tested but should match (or improve on) the previous version. If you try it and notice strange behavior, let us know. The OpenGL resource objects have been modified to enable handling a lost GL context. In addition we’ve extended the ability to unload stale resources (to handle low memory warnings) to all GL resources. In the previous release this was only available for textures. Also, MOAIGfxDevice now publishes a ‘resize’ event when its dimensions are changed (one way to handle orientation it to allow the Moai UIView to rotate then simply change the dimensions of the MOAIGfxDevice by calling AKUResize). Finally, look for basic Game Center support in this version of Moai. The current implementation supports Game Center leaderboards. We integrated it to use in Wolf Toss, which should be going beta any day now. Here’s a more comprehensive set of release notes. Of course, for the whole story look at our git logs.

- Implemented release/renew cycle for OpenGL resources to handle lost context scenario - Replaced physfs with zipfs - Patched Lua 5.1.3 file io to use stdio 'lookalike' functions from zipfs - Partial implementation of vfscanf via zipfs_vfscanf - Fixed viewport layers transform bug for offscreen buffers - Fixed MOAICameraFitter to properly recognize world space bounds - Added moai-untz target to osx sample host - Added basic Game Center support (leaderboards) - Added toolbar to MOAIWebView (ios) - Fixed MOAIWebView to appear correctly in both portrait and landscape modes (ios) - Extended Box2D wrapper to better expose joints API - Added resize event to MOAIGfxDevice