Wazoo Enterprises

Having fun in game development!

Archive for February 9th, 2008


Using Boost to manage smart pointers

I’m sure the concept of a “smart” pointer was born from the frustration and tedium of tracking base object pointers in the C++ language. In a nutshell, smart pointers are pointers to dynamically allocated objects on the heap. They’re used identical to a “normal” pointer, however they properly delete the object they are pointing to when necessary. If your program triggers an exception, then a smart pointer will properly deallocate the used the memory on the heap. The shared_ptr object in the Boost C++ library internally uses a reference counting system in a non-intrusive fashion. In other words, the object will auto-update itself whenever its reference count needs to be updated, so that you don’t have to!

#include 

//create a base object for whatever..
class IBaseObject
{
  public:
    IBaseObject(){}
   virtual ~IBaseObject(){}
  //snip!
};

int main(int argc, char* argv[])
{
  // create a new IBaseObject instance with one reference
  boost::shared_ptr objA(new IBaseObject); 

  printf(”Ding! %i reference!\n”, objA.use_count()); // 1

  // assign a second pointer to it:
  boost::shared_ptr objB = objA; // should be 2 refs by now

  printf(”Ding! %i references\n”, objB.use_count()); // 2

  objA.reset(); //set the first pointer to NULL
  printf(”Ding! %i references\n”, objB.use_count());  // 1

  // the reference count will drop to zero
  // when objB goes out of scope

}

Slick is…slick?

While doing more research for LWJGL resources, I came across the Slick 2D game programming library for the Java language created by Kevin Glass. Bolted onto the Lightweight Java Gaming Library, Slick offers a very real solution to RAD game development. I mean, not only does LWJGL provide a fast path to game programming, but tack on a quality sprite manipulation library (among other things) and you’re in business.

Licensed under the popular BSD license, here’s a blurb on its feature list:

Current Features

* Images
o Image Loading (PNG, GIF, JPG, TGA)
o Image Transforms
o SpriteSheet handling
o Animated Images
o Programmatic image generation
o Rendering through OpenGL
* Fonts
o AngelCode font with kerning support
* Sounds
o WAV,OGG,XM support
o Music playback and looping
o Sound Effect playback
* Input
o Keyboard and Mouse event system
o Controller event system
* TileMap Support
o TilED Tile Map Loading
o Tile Map rendering
* Graphics and Geometry
o Java2D like graphics context
o Support for drawing and filling primitives
o Geometry primtives for collision

Ancient Civilization contest announced at YoYo Games

If you’re a fan of winning in the neighbourhood of $1000.00 for placing first in a game development contest, then head over to YoYo Games and register yourself for another contest they’re holding!

The Theme

Ancient Civilization! Not just the Romans, Greeks, and Egyptians, but also the Mayans, Aztecs, Vikings, and Celts (to name but a few). So many lands, empires, city states, peoples, cultures, beliefs, and symbols. So much food for your fertile imaginations.

As with the winter theme we’ve kept the constraints on competition games deliberately low, hopefully this will result in even more really creative games.

The games will be judged on creativity, originality, aesthetics, and game mechanics. With marks, as usual, for the best implementation of the theme.

A word of warning, we’re looking for fun games to play, not epics - if you feel your game’s strongest asset is its incredibly long and developed plot-line it most likely will not do well in this competition, be sure your games are fun to play from the outset. For the committed entrant the IGDA casual gaming 2006 white paper has an interesting (but long) analysis of what a good casual game should be (pdf).

Judging will be conducted by YoYo Games and Prof. Overmars. As with the last competition the community response will be taken into account when we come to judge the games (with special weighting given to play count and number of Diggs).

So even if you don’t enter the competition yourself, you can still contribute by trying out the games. However, we do ask that the entrants themselves do not rate competition games (on pain of disqualification!).

We’ve giving the developers a bit longer this time round; the contest will end on April 27th, 2008.

So pull down a copy of GameMaker7 (if you haven’t already) and get started!