Fun Friends for Functions, Part 2: Handling Exceptions

Previously we looked at how you can bind a function to a set of arguments and then call the resultant function at some time in the future. This technique is very powerful, but as-is it is a ticking bomb. As Amy points out in her blog post on exception handling, you always need to be…


Why the ‘arguments’ object is bad, Exhibit #3,745

Having just written a post with an example of how to use the arguments object, you might question my choice of title for this blog post. In my not-so-humble opinion, the ‘arguments’ object in ECMAScript is only useful for one thing: The ‘arguments’ object should only be used by infrastructure functions that simply perform book-keeping…


Fun Friends For Functions

And now for a more techy post. In ECMAScript, functions are considered first-class objects. “What,” you might ask, “differentiates a ‘first-class’ object from a merely ‘economy-class’ object?” Well, the main thing is that functions in ECMAScript are treated just like any other type of data (strings, numbers, arrays, etc.) in that they can be assigned…


Maintaining Callback Semantics

One of the key programming concepts in HDi is the use of asynchronous processing with callback functions. The HDi platform exposed to title authors is not multi-threaded (which helps reduce the complexity of writing applications), but many of the functions of the player are asynchronous in nature. For example, all the I/O in HDi (both…


Sliced bread ain’t got nuthin’ on this!

Forget being the best thing since sliced bread – this is the best thing ever. Well maybe not quite that good, but it’s still darn cool! Finally – FINALLY! – you can get decent IntelliSense for JScript inside Visual Studio! Holy hotcakes, Batman! This is so awesome you have to download Visual Studio 2008 Beta…


Using Timers Effectively in HDi

The use of timers in HDi applications is very common, and there are a few things you should keep in mind when using them to avoid performance issues when playing back your title. I will categorise these as: The autoReset problem The closure problem The re-use problem The general-abuse problem   The AutoReset Problem This…


Simple ACA dumper

Quick one today – if you have an ACA with some files in it, you can use the createaca tool (provided as part of the Jumpstart Kit) to list the files inside it. Trouble is that the output is not very helpful; it contains too much information. So here is a simple JScript file you…


Helpful Tracing Routines

Last time we looked at conditional compilation, and how using it with HDiSim could aid with interactive debugging of runtime exceptions. But as useful as interactive debugging is, there are three major cases where it is impractical or impossible: When the bug is timing related, and using a debugger masks the bug; or Reproducing the…


Using Conditional Compilation in HDi

One of the cardinal rules for developing HD DVD applications is, “let no exception go unhandled.” The reason for this is simple – if you fail to handle an exception, the player will kill your application and stop the disc. This leads many developers to wrap entire functions in try / catch blocks, which solves…


A Game of Chance that Pirates like to Play

Ahoy there me laddies! Yarrrr you better be readin’ this blog then matey, or you’ll be feelin’ the lick o’ the cat come nightfall! No, it’s not Talk Like a Pirate Day; it’s Let’s Post Another HDi Game Day. The other week I posted an HDi sample based of the old arcade game Space Invaders….