Thought for the Dazed

I've had to give up that Distance Learning course as I was having trouble seeing the teacher.

Flickr
www.flickr.com
RobMiles' items Go to RobMiles' photostream
Twitter
C# Yellow Book

Search entire site
Tuesday
Apr232013

Heartotron Wins Microsoft UK Global Game Jam Competition

StoreScreen

I always tell students to enter all the competitions they can because, you never know what might happen. You probably won’t win. But then again, if you don’t enter you definitely won’t win.

Simon, David, David, Lewis and myself formed a team to take part in the Global Game Jam earlier this year. The theme was heartbeats and, after a little discussion, we decided that a game which pits your heart against all kinds of incoming bad things might hit the spot. Our game was made even more interesting because we also managed to capture heartbeats and synchronise the gameplay to them, which was nice.

After the competition was over David and Simon kept working on the game, submitted it to Windows Store and then entered it in a Microsoft competition.

And we won. A Windows Phone, some cash, a T shirt, a nice pen and key ring each. And a chance to go down to Reading to visit Microsoft UK. Amazing.

I’m actually feeling kind of guilty at this point. After Simon and David took over I didn’t really contribute a great deal to the on-going project. But my background music is in there and they have still based the game on some of my suggestions. I think I was the one that said “We should colour the blood some shade of red….”

If you own a Windows 8 device you can get hold of our prize winning entry by searching the store for “Heartotron”. If you think you can do better, then enter next time….

Thanks so much to Microsoft to organising the competition and choosing our entry. Great stuff.

Monday
Apr222013

Rather Useful Seminar: Start your own business

image

If you want to find out more about starting your own business and how to develop ideas, then you should come along to the Rather Useful Seminar on Wednesday this week. Liz Johnson of the university Knowledge Exchange will be giving tips on product development and business formation.

If you’ve got some applications out there, or an idea for a product, or are looking for a way to get started, then you will find the presentation extremely valuable. Especially if you are thinking of setting something up over the summer break.

The session is on Wednesday 24th April at the usual Rather Useful Seminar time, 1:15 pm, in the usual place, Robert Blackburn Building LTD.

Sunday
Apr212013

Make a Font from your Handwriting

FontDemo

I came across this a while back, via a tweet from Ed and the website The Cheese Thief. Today I actually got around to playing with it. It works rather well, as you can see above.

All you have to do is download the form, fill in the boxes, scan the form and send it to the web site. You get back a TrueType font of your own handwriting. All for free. Go here to make your own personalised font.

Saturday
Apr202013

Sprites and Distances

Space Killlers Backdrop

At the moment quite a few of the first year are working on a “Space Killers” game. Above you can see my sample screenshot from the specification. You can see that my graphical design abilities are around the same as usual.

The idea is that the player (the green object) must survive in brightly coloured space while all around are trying to kill. Collision with any game object is instant death. Survive until the clock counts down to zero and you are rewarded with another level with more, and nastier, things in it.

One of the game objects is the “Master”. This is the one that looks a bit like a fried egg in the above screenshot. (Note to graphics department, fix that please).

Anyhoo, a Master sprite will sit and do nothing unless you get too close. Then it wakes up and chases you. To make this work the game needs to be able to work out how far the master is from the player. In my solution I have a sprite class:

public class Sprite
{
    public Texture2D SpriteTexture;
    public Rectangle SpriteRectangle;
    public Vector2 SpritePosition;
    public Color SpriteColor;
}

This contains stuff that we need to position and draw the sprite. The Update method for the parent sprite just uses the position vector (which I use to decide where the sprite is on the screen) to set the SpriteRectangle value (which I use to decide where to draw the sprite).

public virtual void Update(SpaceKillersGame game)
{
    SpriteRectangle.X = (int)(SpritePosition.X + 0.5f);
    SpriteRectangle.Y = (int)(SpritePosition.Y + 0.5f);
}

My sprite also contains another method, DistanceFrom, which is used by code in the Master sprite to decide how close it is to the player.

public float DistanceFrom(Sprite otherSprite)
{
    float dx = SpriteRectangle.Center.X -
               otherSprite.SpriteRectangle.Center.X;
    float dy = SpriteRectangle.Center.Y - 
               otherSprite.SpriteRectangle.Center.Y;
    return (float) Math.Sqrt((dx * dx) + (dy * dy));
}

This is how it works. It turns out that the Rectangle class contains a Point value which gives the coordinates of the centre of the rectangle. I can use the X and Y components from this to work out the difference in x and y between the two rectangles. I can then use Pythagoras Theorem to work out the distance between the sprites. Pythagoras said “The sum of the squares of the sides of a right angled triangle is equal to the square of the hypotenuse”.  My code works out the sum of the squares and then takes the square root of this to work out the distance value.

image

Hopefully the above diagram will make it all clear. If not, just enjoy the pretty colours.

My Master sprite then contains the following statement in its Update method (Update is called on the sprite to make it update itself. It is given a reference to the game that is currently active).

if (DistanceFrom(game.Player) < MasterRadarRange)
{
    ChaseActive = true;
}
MasterRadarRange is a value which controls how far the Master can “see”. If a player gets closer than the radar range the flag ChaseActive is set to true, which triggers the chase behaviour in the Master sprite.
Friday
Apr192013

Useful 3D Printing Text

image

Chris (the author the above) was kind enough to send me a copy to take a look at. You can download your own from Amazon for the princely sum of 2 pounds 22 pence. If you want to know what 3D printing is all about, how it works, and some ideas about how you could build a business based on 3D printing technology I reckon it is well worth a look.

This kind of text is perfect for electronic publishing as the field is very fast moving and I hope that Chris is able to keep it up to date. The writing style is conversational and the content is packed with little nuggets of information that must have taken quite a while to put together.