Phil Wallach

I follow where my mind leads …

Phil Wallach header image 1

IMPERIAL GALAXY

December 10th, 2007 · No Comments

We’ll be launching the open beta test of IMPERIAL GALAXY, the science fiction massively multiplayer online game on Facebook, on Monday 17 December at 12:01am US Eastern time, which is 4:01pm AEDT. The www.imperialgalaxy.com website will also be live at that time.

I’ll be sending invitations to all my friends as soon as the Beta goes live, and it will be in the Applications directory and so on.

We’re very excited about IMPERIAL GALAXY. The background of the game is based on Garth Nix’s forthcoming novel A CONFUSION OF PRINCES (due out in 2009) and we’ve been playtesting it for the last three months. The game itself has been under development in its pre-Facebook incarnation for more than three years.

So a week from now, you can join the Imperial Navy and with your friends go forth to reclaim the lost Rozaxra Domain from Sad-Eye and Deader aliens, Mrouzh Rebels, Naknuk Secessionists, pirates, rebels and other star-scum. To your ships, my friends!

→ No CommentsTags: Imperial Galaxy

OpenLaszlo: how you get there is more important than where you are going

August 29th, 2007 · No Comments

WHAT BROKE

This is the old version of the method.  It finds some specific views and scans their datapaths, to see if any entries match.  This version mostly worked fine, but occassionally it would fail, and finding the cause of the failure was proving difficult.

    <method name="check_ok" args="from, to">
        <![CDATA[
        for (var i = 1; true; i++)
        {
            var match = to.classroot.datapath.xpathQuery(
                'matches/match[' + i + ']/text()');
            if (match == null) break;
            for (var j = 1; true; j++)
            {
                var type = from.datapath.xpathQuery(
                    'types/type[' + j + ']/text()');
                if (type == null) break;
                if (match == type)
                    return true;
            }
        }
        return false;
        ]]>
    </method>

WHAT WORKED

I finally tracked down the problem; it occured whenever “to” was not replicated (i.e. there was only one).  So I assume that the replication manager was confusing my view navigation, as the number and type of views to navigate changed.

The solution is shown in the code below.  Basically I navigate the dataset directly, and avoid any view navigation.  Nothing can go wrong, right?

    <method name="check_ok" args="from, to">
        <![CDATA[
        var e  = to.datapath.dupePointer();
        e.selectParent(2);
        e.setXPath('matches');
        if (e.selectChild())
        {
            do
            {
                if (e.getNodeName() == 'match')
                {
                    var c  = from.datapath.dupePointer();
                    c.setXpath('types');
                    if (c.selectChild())
                    {
                        do
                        {
                            if (c.getNodeName() == 'type')
                            if (e.getNodeText() == c.getNodeText())
                                return true;
                        }
                            while (c.selectNext());
                    }
                }
            }
                while (e.selectNext());
        }
        return false;
        ]]>
    </method>

→ No CommentsTags: OpenLaszlo

OpenLaszlo: saving LzLoader

August 22nd, 2007 · No Comments

One thing that tripped me up early on is a know bug in the OpenLaszlo loader.  Basically, if a view is destroyed before the resource completes loading, then the loader chokes and nothing more is heard from it. 

Unsurprisingly, this is very very bad.

The bug is documented here:
    bug: destroy before resource is loaded leads to full load queue and hang

The fix is noted in the bug report.  Basically the following code is added to the application.

    <script>
        LzMakeLoad.unload = function ()
        {
            this.loader.unload( this.loader.mc );
        }
        LzMakeLoad.destroy = function (recur)
        {
            this.loader.unload( this.loader.mc );
            super.destroy( recur );
        }
    </script>

→ No CommentsTags: OpenLaszlo

OpenLaszlo: who’s watching the loader?

August 21st, 2007 · No Comments

Being able to see when LzLoader is active is very useful when an application is under development. The following code displays “Loading” whenever the loader is active.

The display is text. The text has an ‘id’ of ‘loading’ and ‘visibility’ set to false.

<text id="loading" x="10" y="10" visible="false"
    fontsize="12" fgcolor="white" fontstyle="bold">
  Loading
</text>

The display is controlled in an idle handler. The visible property of the display is set depending on the number of open connections in the loader.

<handler name="onidle" reference="LzIdle">
  <![CDATA[
  loading.setVisible(LzLoadQueue.openConx > 0);
  ]]>
</handler>

The display shows you when the loader, and therefore the application, is busy. You can see how well load-spreading strategies like OpenLaszlo: background loading of images are working. It is a window into a part of your application that is normally hidden.

→ No CommentsTags: OpenLaszlo