Archive for February, 2009

A Foray Into Haxe

February 28, 2009

When I look back on the various things I’ve written over time, I can see that a person might get the idea that I’m like Jeremy the Crow from the Secret of NIMH.  (I’ll give you bonus points if you get that reference without having to research it.)

Today, I started evaluating Haxe for use as a development environment for games.

First, a word about Haxe.  It will make applications for multiple “platforms” (I know that some folks object to the word platform in this sense.  I also don’t care what some folks object to.), which include JavaScript, Flash, Neko, and PHP.  I had to look Neko up, decided I didn’t care about it today, and looked at Javascript and Flash.

I discovered that while Haxe can be used to target these several types of output, the idea that you will write code a single time and simply switch what you are compiling it for is a laughable pipe dream.  It uses different APIs based on your output, so if you make something that targets flash, you won’t be able to compile it for javascript, and so on.

Not to say that you couldn’t write the core of the game without either API, and then writen the rendering code specific to the platform, but that’s the same no matter what multi-platform language you are using.

For flash output, Haxe takes care of the code part. The image resource portion (which is paramount in the game of HamQuest) has to be stored in a separate resource swf that the haxe compiler can bring in and use.  Fortunately, swfmill exists and is pretty simple to use for a quick little resource swf.

I built the quick “Hello World” app. Worked.

I built the quick “Draw a Rectangle” app.  Worked.

I built a quick “Show an image loaded from a resource swf”. Worked.

The only thing I have left to do is ensure that I can get keyboard input, but based on what I have seen as examples elsewhere on the web, it looks like I can do it just fine, but I’m not going to assume anything prior to getting really started.

As far as the Haxe language itself: its yet another CBL (curly brace language), and reminds me of every other CBL I’ve used.  Seriously, the various features of the language reminded me of features in other languages, joined together into this mongrel language.  I can easily see the influence of Java, JavaScript, ActionScript, C#, C++, and C.

Additionally, there are a couple of weird wrinkles Haxe has of its own (or at least, I haven’t seen these exact language features anywhere else).

First, the “for” loop isn’t the normal structure of “for(index=0;index<10;++index)”, and instead looks like “for(index in 0…9)”, and additionally has iterator objects that can be used in place of the 0…9 construct.  Basically, this is similar to the JavaScript “for(var i in obj)” construct, and basically means all “for” statements are really “foreach” statements, which I can deal with.

Second, the enums are kind of weird, but in a way that is potentially very powerful.  Time will tell if and when I make use of their flexibility.

Thirdly, in addition to being able to make instant objects “var obj={“x”:10,”y”:20};” as in JavaScript, there is an extension to this that allows a shorthand kind of inheritance.

So my initial impression is: Haxe is a mongrel CBL (which isn’t a bad thing) with a “funny” for, and a few quirky features I’m likely not to use, at least not initially.

Hunt The Wumpus, Take 2

February 28, 2009

The widgetbox widget is still in process of being approved.

Also, I only just today realized that widgetbox cannot make facebook applications at the moment.  Fortunately, my two fb apps though there are still alive and well on fb.

So, I have moved HTW to a place on playdeez.  Likely, I’ll just facebook-ify it myself, since I have spent the 15 requisite minutes learing FBML, which is an awful like HTML with a number of “fb:xxx” tags replacing the otherwise well known tags.

A Temporary Diversion

February 27, 2009

As a brief interlude from any solid HamQuest related work, I am working on a quick port of Hunt The Wumpus to WidgetBox.

Currently, only moving around works, so you can get eaten by the wumpus, fall into a pit, or get swept away by the bats, but you can’t shoot the wumpus and win. That’ll be the last bit.

The final destination of the HTW widget is facebook.  I did a brief search on both widgetbox and facebook, but did not turn up any wumpus hunting.

The game is based on the BASIC source code from Gregory Yob. It is done using javascript and HTML.  To give it a more “authentic” look I went with <PRE> tags for almost everything.

Derailed in a hard, hard way.

February 22, 2009

So there I was, happily making progress on the flash version of HamQuest using NeoSwiff.

I got to the point where I was rendering a room on the screen, and so I wanted to make a simple “use the arrow keys to move from room to room” to check and see that everything was working correctly.

That’s when I found out that I could not automatically grab the keyboard focus for my game.  Seriously…

Not a problem, I figured… I can make a “click here to start the game” thing, which will have a side effect of grabbing input focus.

Having worked around that issue, I came up against a deal breaker:

For whatever reason, I cannot detect the arrow keys.

So, with a heavy heart, I have to step back and evaluate what I’m going to do with this new problem.

One thing that I won’t do is change the keys. If I can’t use the arrow keys, then the game won’t be in neoswiff.

Fortunately, with the port I was doing, I made the portion of the game I completed into way less of a “VC# 2005 using generics” solution, so whichever way it grows from here should be easier.

Just frustrating, though.

Lesson: make certain you can get the input you want before starting work.

Wii and Profiling PlayDeez.Com Traffic

February 14, 2009

Great news everyone!

One, my wife and I got a Wii. We just have Wii sports and Wii play at the moment, but as soon as a Wii fit becomes available, we’ll be getting that as well.

Other than that, it is probably unlikely to get a whole slew of games for it, other than downloading some classic games.

Two, I have put hit counters on the pages of PlayDeez.com.  They are invisible (I did a homebrew completely easy to spoof solution, but I don’t plan on keeping it around forever, so it doesn’t matter).

Why do this?

I knew that my website got a small smattering of hits each day, around 50 or so.  I wanted to know where those hits were going, since every page has a game on it, this will tell me which of my games are the most popular.

While I plan to let it go for a while longer, the answer is pipes/hexircuit, with Connect! being a close second.  Jetlag comes in third, and then click the yellow rhombus.

The reason that pipes is the big winner is mainly because I have it on widgetbox, and hence on facebook.

I do this so that I can know where my time is best spent.  Apparently the answer is pipes.

In other news, the HamQuest port is going nicely.  I’ve nearly got item populating, and creatures is next.  Believe it or not, the work from there to the end is rather simple.

I’ve also been giving a bit of thought to Medieval Micromanager, and some to Island Interloper.  I think MM is more likely to get some time spent on it first, but I’ve also got the Adventure Maker to finish up.

HamQuest 1.0.0.2 Released!

February 7, 2009

You can get it here:

http://www.playdeez.com/hamquest.html

The fixes are pretty minor, mainly tweaks and polish.

However, game balance may have been affected by one of the changes.

I changed the breakage percentages for weapons and armor.  I cut it in half.

The most powerful weapon in the game had a 20% chance of breaking, and thus wouldn’t last very long.  Now it is 10%, and so it should last a while.

In an attempt to counter this change and rebalance the game, I cut the number of naturally occurring weapons and armor in half.  The chances of getting them in chests remains the same.

There is also some new minimap indicators that combine the different colored dots to indicate the contents of a room. It may help clear things up a bit, or it may completely muddy the picture. Time will tell.

I found the other day that HamQuest was finally listed on Softpedia, and so I’m happy about that.  Apparently all of my other games are listed as well, even though I didn’t submit them, but I’ll take that, too.

HamQuest Again

February 1, 2009

I was browsing my external harddrive the other day, and to my surprise, I found the installer for GlobFX’s NeoSwiff Express, which was a free tool that could be used to compile C# code into a .swf file.  NeoSwiff eventually disappeared, but since I still have the installer, I can still use it.

Which means that a port of HamQuest to flash is just that much easier.

The downside of using NeoSwiff express is the total lack of intellisense and the rudimentary IDE.  Fortunately, I’m used to rudimentary as I use Notepad++ to write JavaScript apps.

Another downside is that the C# is about the level of .NET 1.1, which means no generics (which HamQuest used quite heavily).

Also, the graphics system is kind of strange.  In order to make an image show on the screen, I have to create an Image class that is contained within a Visual object.  Once I have set what the image is, it is forever locked as that image until I dispose it.  It can be moved around and otherwise manipulated visually.  In any case, there will be a lot of use of Dispose, as I have not found another way to get rid of it.

I am forced to admit… as much as I like JavaScript, writing anything in it is a pain, especially if the plan is to use it in the big five browsers and have it look and behave equivalently.  It looks like I need to return to Flash.