Archive for September, 2006

Friday, September 29th, 2006

Just a quick update tonight.

Things are progressing very well. I’m nearly back to the point I was at before rewriting for XNA.

Just the shooting to add and some minor glitches to fix.

However, along the way, I couldn’t help but throw in something new. So here’s a quick peak.

Thanks to the joys of Refactoring, XNA, HLSL (shaders) I now have I nice wee system for changing the look of the game for different environments. Click for a comparison screenshot showing the Spitty in bright daylight vs moody dusk. In particular, check out the way the lighting of the model itself is different.

Day
Dusk

Also note the glossy Cockpit. Difficult to appreciate with a still image, but in game you can clearly see it’s of a different material to the rest of the plane. Not transparent, but I don’t think it really needs to be for this game.

I’ve designed things such that I can switch between the two environments with one line of code!!!

Average Rating: 4.4 out of 5 based on 211 user reviews.

Monday, September 25th, 2006

Just a quick update on the Game dev progress.

Rewriting for XNA has been keeping me busy. Up till a couple of nights ago, it had felt very much like back to square one.

I’ve finally got past the initial slowness, and am starting to make forward progress again.

Milestones

  • The seriously stripped down XNA sample code is starting to feel like my own at last. I actually know where to look for stuff now without needing to search unfamiliar code.
  • I’ve integrated my Spitfire model.
  • So far, I’ve got by with the sample HLSL shader. By looking at the sample code, I’ve also worked out how to make the Cockpit look glassy. Not exactly transparent, but more reflective and probably good enough.
  • I’ve converted over my code for the movement, so the Spitty now flys and turns as it did before.

What’s next?

  • Incorporate or rewrite my Skybox code for the background.
  • Ditto for the CloudManager.
  • Then it’ll be time to incorporate some SHOOTING to keep the punters happy.

That’s about all I can think of for now.

Oh, and I have this week off work, so between holiday activities I’m hoping to get some good progress done!

Average Rating: 4.7 out of 5 based on 211 user reviews.

Thursday, September 21st, 2006

If you’re anything like me, you’ve probably got used to the trusty .NET Garbage Collector always being there, and never really needing to know more.  Gone are the days of languages like Delphi (where I learned OO) where you had to explicitly clean up after any object you created.  You learned by necessity to be wary and methodical and avoid those nasty memory leaks.

Now days the Garbage Collector makes life so much easier.  With Business application development, there rarely seems to be any need to even think about all your memory usage and the Garbage Collector.

With Game Development however, it’s important be aware again.  You really want to minimise any reasons for the Garbage Collector to charge in and do it’s business.

Case in point:  My CloudManager class (essentially a Particle System, not that I knew it at the time) used to cause awful stuttering in my game 10-20 seconds after starting the game.  The problem was that the Garbage Collector was kicking in and cleaning up after all those Cloud objects that had since expired, and been culled from the list.  The solution was quite simple really.  I changed the CloudManager to behave like a Pool of clouds.  Once the pool reached its maximum size, the cloud objects would be recycled rather than culled.  Problem solved!!!

Anyway, I’m getting off the point.  The point is Shawn Hargreaves (of XNA team fame) has put up a most excellent wee post about the good ol’ garbage collector.  In particular he talks about how the much anticipated XNA Content Pipeline will deal with GC. 

Of most value, to me personally was his short and sweet explanation of the Garbage Collector from a Game Development point of view. Nice to have small an understanding of these mysterious things.  ;)

Check out “Taking out the trash”.

Average Rating: 4.7 out of 5 based on 169 user reviews.

Monday, September 18th, 2006

I haven’t even studied the last ones yet, but this one looks like a good starter for Pixel Shaders specifically.

Average Rating: 5 out of 5 based on 178 user reviews.

Monday, September 18th, 2006

I stumbled on another XNA related blog that caught my eye.

360 Prophecy has put up some downloadable XBOX 360 graphics files, that are sure to come in handy when I really get serious about my game dev.

XBOX 360 Controller graphics

Good stuff, and yet another blog to keep an eye on. ;)

Average Rating: 4.7 out of 5 based on 234 user reviews.

Friday, September 15th, 2006

I mentioned earlier that the new XNA framework requires you to do things with Shaders, where before you didn’t have to.

This is all good, but yet another new thing to learn.

So I’ve been googling quite a lot lately. I can’t believe what a struggle it has been to find a decent beginner level tutorial out there!!!

Last night, I think I may have finally stumbled on a couple. I’ll look into them in the weekend, but they did at least start like a tutorial for beginners like me.

They are not XNA specific, but I don’t think that should matter. HLSL is not new, and it is a DirectX language – not C#.

One of them appears to be an excerpt from a book, and I don’t know how old or how relevant it is to DirectX 9’s HLSL.

Here are the links, on the off chance they prove useful…

There is also this one, but I find it goes too deep too quickly…

Average Rating: 4.6 out of 5 based on 196 user reviews.

Friday, September 15th, 2006

It’s been a while since I posted an update so here goes:

I’m in the process of converting my code over to use the XNA framework.  This has been pretty slow going I’m afraid.  Mainly because a little voice in my head keeps telling me “Just do it slacker, this’ll be easy”.  This was not the voice of Mr Common Sense - but I still listened to it, and the rest is history.

That’s not to say that XNA is harder than old-skool Managed DirectX that I was still a beginner at.  No, indeed it looks a whole lot easier in many ways.

The reason I’m finding things difficult is simply that I jumped in too deep from the start.  Instead of rattling off some simple “Hello World” apps, I chose to jump right in to the XNA sample game and extract from it’s architecture the nicest bits as a base for my rewritten game.  It’s not that difficult, so seemed sensible at the time. 

Here’s the catch.

In doing so I’ve spent more time getting to know someone else’s code, than learning the technology itself.  When you write code yourself it becomes ingrained in your brain.  When it’s someone else’s code, it simply takes time to become familiar with. No matter how good or well commented it is.

So that’s where I’m at.  I now have a nice base to work from, but it’s still very much back to square one.  I think I’m quite close to being able to render the Spitfire in the centre of the screen.  Kind of sad really.

The moral of the story?

“Little steps… LITTLE STEPS!!!”

Average Rating: 4.9 out of 5 based on 202 user reviews.

Wednesday, September 13th, 2006

My wife has been having issues with a Ventrilo (VoIP) server she uses while gaming with her buddies.  As you can imagine the whole space time continuum is in jeopardy here. ;)

It’s based in Australia, but the performance was always fine until a few weeks ago. It used to ping around 200 ms, but now it’s more like 5000 ms+ and totally unusable.

We have reasons to believe it is only affecting people using “ihug” as their ISP.  After weeks of silence IHUG are now claiming they’ve done all they can.  I don’t know enough about this stuff, so before we go switching ISP’s I’d like to see how the other ISP’s fare with this server. I’m wondering if perhaps it’s not only ihug, but all the ISP’s that rebrand Telecom’s wholesale ADSL deal.

All I need you to do is this.  From your home connection, at the Command Prompt:

  • ping vent.anzgw.net
  • tracert vent.anzgw.net
  • copy & paste the results to me as a blog comment, along with your ISP name, type (adsl/cable/wireless) & City. 

Thanks in advance.

p.s.  I have actually been really happy with ihug’s features, price & service to date.  But this one thing is a bit of a killer if the grass is greener elsewhere. 

Average Rating: 4.8 out of 5 based on 235 user reviews.

Monday, September 11th, 2006

I just love it when an opportunity comes up to go mad with Photoshop.

That opportunity comes up at least…er..well…twice a year when I have great fun doing invitations for my kids birthday parties.

It’s my son’s 4th birthday real soon, so here’s the imagery I bastardised for his invitations this year…

 

Click for the entire image

Click to see the Deluxe Booster Seat

Average Rating: 4.4 out of 5 based on 238 user reviews.

Friday, September 8th, 2006

Before I get started, I’d just like to point out that this snippet is not game development specific. It could be useful in any application.

Here we go then…

Lets say you have some asset, file, media, whatever that needs to be distributed with your application, and your application programatically loads it. You could just distribute it as a file in it’s own right, but you might like to consider embedding it in your exe.

Why?:

Convenience!!!

No need to copy this content to your Bin folder for runtime, debugging etc…

Minimise tampering.

What if it was your company’s logo, and people could tamper with the Image and change the branding of your application?
Or in the case of game development, you don’t really want your textures where cheaters can buggerize with them! You know, change the textures Alpha channel, so the entire texture is tranparent in the game.

Convinced? It’s very easy to do.

Add your content into your project.

Code Snippet - Embedded Resource Solution

In the files Properties change it to an Embedded Resource.

Code Snippet - Embedded Resource Properties

Now here’s a helper class for getting a Stream of the content.

 

using System;
using System.Text;
using System.Reflection;
using System.IO;
namespace MyProject.Helpers
{
    public class ResourceHelper
    {
        /// <summary>
        /// Returns a stream for the named embedded resource.
        /// </summary>
        /// <param name="nameSpace">The namespace containing the embedded resource. Case sensitive!</param>
        /// <param name="name">The filename of the embedded resource. Case sensitive!</param>
        /// <returns></returns>
        public static Stream GetEmbeddedStream(string nameSpace, string name)
        {
            Stream result = null;
            Assembly a = Assembly.GetExecutingAssembly();
            string resourceName = String.Format("{0}.{1}", nameSpace, name);
            result = a.GetManifestResourceStream(resourceName);
            return result;
        }
    }
}

Simply call the GetEmbeddedStream from your code passing the nameSpace & the name of the desired file.  (case sensitive)

e.g.

Stream myStream = ResourceHelper.GetEmbeddedStream("MyProject.Goodies.Images", "TheManWithTwoBrains.jpg");

Once you have a Stream you can use it with any class that lets you load from a stream.

That’s it! Enjoy. :)

Average Rating: 4.5 out of 5 based on 283 user reviews.