Wednesday 29 September 2010

Meet Swordy

Today saw the start of a new journey for me. A new journey that will see me learning new things, and thus proving an old dog can learn new tricks.

A friend is teaching me to program in C# (C Sharp) and how to write games using the XNA framework for the Xbox 360.

So sitting in the Costa Coffee franchise at work like true geeks we sat with coffee’s (or in my case tea) and out laptop and netbooks having a hands on introduction to games programming.

stickyIt was in this initial session that I came up with what I am convince will become a classic video game character of the 21st Century Swordy. Swordy was created out of necessity of needing a sprite to move around the screen when a direction arrow is pressed.enemy

But in true video game tradition Swordy needed a nemesis, and so in an equally rushed drawing I came up with a badly drawn ghost from Pacman as Swordy’s nemesis.

In our little hack-a-thon (if you can call a session of hogging the comfy seats in the coffee shop for just over an hour of geekiness a hack-a-thon) the enemy homed in on Swordy. Which when moving Swordy around the screen gave an almost Robotron like feel to the basic program being developed. If you remember in the classic game Robotron the enemies homed in on the players character. And to get this AI (if you can even call it AI) is an amazingly simple bit of code. Which I give the extract for below:

foreach (character e in enemy)
{
    e.update(gameTime);
    if (e.getpos().X < swordy.getpos().X)
    {
        e.movex(1);
    }
    if (e.getpos().X > swordy.getpos().X)
    {
        e.movex(-1);
    }
    if (e.getpos().Y < swordy.getpos().Y)
    {
        e.movey(1);
    }
    if (e.getpos().Y > swordy.getpos().Y)
    {
        e.movey(-1);
    }

}

Basically for each enemy we compare it’s position to that of Swordy and move the enemy closer towards Swordy. Which as I said has the effect on screen of making it look like the enemies are homing in on Swordy.

Anyway that makes it look like I know what I am talking about, which I don’t. I’m just impressed (easily I know) with how well the Robotron homing enemy effect looks with such simple code. The whole area of enemy AI is a complicated one and has evolved over the years, to which point in modern big budget games the AI can be pretty sophisticated.

Anyway that about sums up todays lesson, I’m looking forward to next weeks now.

Sunday 26 September 2010

First Impressions Of The Galaxy S

Last weekend I had to take my middle son back to uni. It was during the trip that I got to see his new mobile, which was a Samsung Galaxy S, a member of the Google Android phone family.

The phone itself is bigger in size than the iPhone 4 that I have, but feels lighter in the hand.

My son showed me it recording video, which looked good on the screen. And I have to say the the oled screen looks good. Well when it is not viewed in direct sunlight. Then the screen is unreadable, it appears blank!!!

My son tried to use the Google Navigation app to guide us to his new house he was renting. But for some reason the GPS just didn’t seem to work, and failed to lock on to any signal to get its position. However I put this down to the fact that the phone had literally zero power left, so was not able to power the GPS part.

Over all from the short period that I had with the phone, and my discussions with my son about it, I have to say I do like the Galaxy S. It is a nice phone, and if I had a chance to buy an android phone then this would be a strong contender to see me part with my cash.