Making Use of an Old Hard Drive

I have an old desktop computer that I’m slowly dismantling and decided to turn the hard drive into a desktop backup unit.

I bought a cheap USB 3.0 hard drive from ebuyer which I used to house my old drive.

For £12.99 it came with:

  • The hard drive enclosure
  • A power cable
  • A USB 3.0 cable
  • Some screws
  • A screwdriver

Putting the old hard drive into the unit was simple and only took a few steps, even if the text on the instruction ‘manual’ wasn’t very confidence inspiring…

An uncomforting instruction manual

Firstly I put the hard drive into the hard drive bay like so:

My old hard drive in the new hard drive bay (without the enclosure case)

Then I pushed this bay into the enclosure chassis and secured the lid on the back of the unit with a couple of screws.
The hard drive is now in the enclosure, and the back panel has been screwed into place

Next I stood the unit into the stand and plugged in the power. All that was left to do was plug in the USB cable and I was done!

The completed hard drive enclosure, standing on my desk

Simple!

3D Model Renderer

I have built a software renderer in C++. I use the GDI+ library to draw to the screen. The renderer can load a model that is stored in the .MD2 format (Quake 2) and draw it to the screen. I can create a range of different lights in different colours to light the model.

Features:

  • Load .MD2 models

The software renderer loads .MD2 files into memory. I store this information in my my custom model, polygon and vertex classes.

  • Draw models to the screen

The model is drawn to the screen using the GDI+ library. The program makes use of a number of optimisations, such as backface culling.

In order to draw to the screen, the model must go through a number of transformations first, known as the rendering pipeline:

Camera transformation
Firstly I apply a camera transformation to the models vertices. This takes the position and direction of the camera and calculates where everything in the scene is relative to the camera.

Perspective transformation
Next I apply a perspective transformation to the model, this transforms the models 3D co-ordinates into 2D co-ordinates to be drawn on the screen.

Screen transformation
Finally I apply a screen transformation to the model, this accounts for the fact that the size of the window is not a perfect square (the aspect ratio of 800×600 is 1.3 for example). This prevents distortion of the image.

After the three transformations have been applied, the model is ready to be drawn to the screen. I do this by drawing each polygon with my own custom SetPixel function, which draws each pixel individually and allows me to interpolate colour values.

(Each of these transformations is stored as one or more matrices in my custom matrix class.)

  • Model Rotation

By applying rotation matrices to the loaded model I am able to rotate it in the X,Y or Z directions (or any combination of the three!)

  • Backface Culling

My software renderer calculates which direction the polygons in my model face, if they are facing the opposite way to the camera, then they will not be drawn. This speeds up the process of drawing the model.

  • Lighting

My renderer makes use of numerous kinds of light, including: ambient lights, directional lights and spot lights.

Ambient Lights
Ambient lights affect all polygons equally, they are sometimes referred to as ‘background light’. They appear to light the model from every direction with the same amount of light. Ambient lights can be set to any colour.

Directional Lights
Directional lights have a direction in 3D space and come from infinitely far away. Directional lights can be set to any colour.

Spot Lights
Spot lights have a position in 3D space and emit light equally in every direction.

I used Visual Studio 2010 Ultimate to write this program in C++ with the GDI+ API.

GameCity5 GameJam!

Last weekend (Friday 29th October 6PM – Saturday 30th October 6PM) I attended the GameCity5 GameJam in Nottingham!

We had 24 hours to create a game based around the concept of either ‘weight’ or ‘wait’. I had already agreed to be in a four-person team with my friends Laurie Brown, Dan Foster and Jeffrey Whitehead.

We created a four-player game using C# and XNA based around a maze which only allowed the player to move when the maze was green. If the maze was red and you moved, you would be penalised by being unable to move for a short period of time. If it was orange, you could move, but the grid could turn red at any moment! The players had to race to get stars and the first player to collect ten stars won.

The feature I was most pleased with was allowing each player to choose a different avatar. We created over 20 small images which could be used as avatars (and all the letters of the alphabet and numbers as well). Players could then choose any one of these to use as an avatar to represent them in the maze. Of course we had to put a time limit on this part of the game because of all the vain players we had playing the game!

The players controlled the game with XBOX 360 controllers plugged into a PC.

I certainly learned a lot about working in a small team to complete a project within a tight time schedule and the game ended up being fun to play considering we created it in 24 hours!

Here are some photographs my friend, Robert MacLean, took from the event:

GameCity5 GameJam

Me standing next to a Game City sign

GameCity5 GameJam

Programming after midnight in a hotel suite!

 

 

 

 

 

GameCity5 GameJam

Programming after midnight in a hotel suite!

GameCity5 GameJam

Debugging

 

Refuelling with pastries and sandwiches in the morning!

Refuelling with pastries and sandwiches in the morning!

GameCity5 GameJam

Breakthrough!

 

 

GameCity5 GameJam

No doubt very tired by this point!