Jul 12, 2011

INSTEAD(f) Postmortem

A few days ago I released the AS3 port of engine for text-based quests INSTEAD.
So, some of the results, the difficulties encountered and future plans.
The biggest problem was to understand how supply embed files to the lua interpreter.
Much easier than I thought.
First create a class that will initialize the VFS:
package
{
    import flash.utils.ByteArray;
    import flash.display.Bitmap;

    public class FS
    {
        [Embed(source='file.lua', mimeType="application/octet-stream")]
        public static const file_lua:Class;

        private static var _filesystemRoot:String;

        public static function filesystemRoot():String
        {
            return _filesystemRoot;
        }

        public static function Init(libInitializer:*):void
        {
            libInitializer.supplyFile("builtin://file.lua",
                          new file_lua() as ByteArray);
            _filesystemRoot = "builtin://";
        }
    }
}

Then we should initialize VFS and lua interpreter:
FS.Init(LuaAlchemy.libInit);
lua = new LuaAlchemy(FS.filesystemRoot());
The problem that I could not solve is to prevent page scrolling when scroll event occurs in flash.

Also had to add some functions in lua wrapper for AS3. The list will add later.

Future plans:
  •              implement support of INSTEAD modules;
  •              support for pictures in the inventory and main text block;
  •              change TextField to something better with html support.
Now the game is on:
http://www.kongregate.com/games/zaynyatyi/the-returning-of-the-quantum-cat
http://www.newgrounds.com/portal/view/574142