C/C++


10
Oct 06

Stuck in Limbo

I’m looking forward to getting stuck in Limbo. He’s looking for C++ programmers, but I was first struck with how perfectly this game could be done in Flash. With Flash’s new filters and improved performance, I’d guess he could get the exact same results, cross-platform and with a lot less development pain than C++.

It’s a great example, though, of the kind of results we’ll see as more people with classic art and graphic design backgrounds (with a sprinkling of programming experience) are brought into the gamedev fold. The in-development footage on his sight is hauntingly beautiful, and an inspiration to say the least. Makes me remember those first few hours playing Out of this World, still one of the few games to deliver so much on so little.

Speaking of Out of this World, I’ve always thought it’d be awesome to see that game remade in Flash (it’s largely rotoscoped with a vector-like graphic style, very applicable to Flash development). Hell, if it fit on a 1.44MB floppy and ran on a 286, surely it can run full-speed in Flash on a modern day machine? Those are the kind of side-scrollers people need to be making… there’s a lot of life left in that very simple mechanic! (And the side-scroller view? Well, that aesthetic has worked for “comics” for a hundred years.)


8
Sep 04

Resource Management

There have been some posts recently to GD-Algorithms concerning resource management. This happens to be an area I’ve investigated recently as part of my Sandbox project (which, btw, is becoming more of an excuse to experiment with different design patterns than actually doing game-code at the moment).

I’m going to define a resource manager as needing to have the following qualities:

  • Provide universal access to all modules needing to retrieve externally persisted data (resources).
  • Ensure that resources exists as a single, shared instance in memory.
  • Ensure that resources are properly garbage-collected as necessary.
  • Allow resources to be retrieved/referenced by unique key.

These requirements immediately evoke several classic design patterns that we should be leveraging. First, the universal access requirement means that the resource manager should be a singleton. Second, the two requirements of shared instance and garbage-collected means smart pointers. Finally, retrieving by unique key smells of some variation on the factory method.

Continue reading →


1
Aug 04

Events

Continuing to push forward on the Sandbox game framework. Attempting to tackle the event system. I see three different techniques to choose from for the event system: Windows-style messaging, Java-style listeners, and the Chain-of-Responsibility pattern.

Windows-style messaging takes the form of a message handler function (WndProc under Win32) that receives all of the messages. This function is then responsible for dispatching them appropriately, usually through a large switch statement. By default, your message handler will be notified of all messages without have to specifically express interest for them.

Java-style listeners are very lightweight but are hard-coded, not dat-driven. In this case you create a class that handles a specific message (or group of related messages). The class handles the messages by implementing a specific interface for specific messages, i.e. handleMouseMove, handleMouseDown, etc. This interface works for implementing UI widgets but does not handle soft-binding of messages at run-time, or scenarios where senders and receivers are unaware of each other.

This is where the Chain-of-Responsibility pattern comes into play. This pattern separates sender from receiver. It also allows event handlers to prematurely discontinue the handling of events by simply not pass the event further down the chain. This seems like the preferred approach.

Well, not much more to say right now. The implementation is not finished so it may end up looking different. And it’s 3:40am, so it’s time to stop posting…