Archive for October, 2006

Tuesday, October 31st, 2006

Once again, I’ve stumbled on some cool HLSL (High Level Shader Language), but haven’t had time to seriously read it!!!

Rather than bookmarking it selfishly, I’ll continue my trend of blogging about it.  Fire and forget blogging – ROCK ON!!!

So here we go…

“XNA – Parallax Mapping” tutorial

Over at Ziggyware I found an XNA based tutorial for a Parallax Mapping Shader.  Advanced stuff by my reckoning!

Check out the “XNA – Parallax Mapping” tutorial here

“Human Skin shader” sample

I can’t remember how, but I also stumbled on what looks like some seriously hard-core shader action at “J.I. Styles | Online portfolio”.  It’s not XNA specific, but the HLSL (*.fx) file is there to download.  The sample is an awesome Human Skin shader!  Impressive!  Out of my league, but impressive!

Check out ”Adventures in HLSL pixel shaders” here

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

Tuesday, October 31st, 2006

I see David “LetsKillDave” Weller has posted a short and sweet blog introducing us to some changes to XNA and how to start converting from Game Studio Express Beta 1 to the very imminent Beta 2.  This is the 1st guide I’ve seen on the subject - good stuff Dave!

Check it out here

Also, he keeps us all on the edge of our seats saying:

If you’ve read this far, you’re probably thinking, “So when will beta 2 be available?”  The answer is…look for my next post that will come within the next 24 or so hours


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

Thursday, October 26th, 2006

I’m a bit slow posting on this one, but in case you hadn’t heard already, it’s coming, and it’s coming soon.  Should be out in a couple of weeks.


No word on what’s new in the Beta 2, but it’s probably a fairly safe bet that the “Content Pipeline” will be included.  At least that’s what everyone’s wishing for.  ;)

The XNA Team blog has the announcement.  Check it out here.

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

Tuesday, October 24th, 2006


I promised I’d start sharing some snippets of source, so here’s the HLSL Shader code (an *.fx file) I use for rendering my Aircraft.  (as requested by Omegaman)

Those familiar with the XNA “Spacewars” sample will see an uncanny the resemblance to the sample’s Ship.fx file.  In fact it’s probably barely changed. Perhaps some trimming here and there, but I really can’t remember.

It’s pretty scary HLSL for a beginner like me.  I’d love to be able to explain it to folk, but frankly I barely understand it myself!  ;)

(next time hopefully I’ll be posting some HLSL I can at least reasonably explain)

I will try and describe its characteristics though:

  • It lights & shades the model with a provided Ambient color, a Directional light and a Point light.  Directional light is a color of light cast in a particular direction, from no particular point in space.  In other words, its brightness is the same no matter where the model is in space.  Point light however is a color radiating out from a point in space, so the closer the model is to it, the stronger the effect.
  • SkinTexture is the painted skin of the model…duh!
  • ReflectionTexture is special kind of texture – a TextureCube.  I haven’t really experimented with it but I believe the texture passed would be a mock up of the typical world around the model, and it would be rendered as ‘good enough’ reflections on the model.  I say ‘good enough’ because you’d probably have a static TextureCube of a typical sky, clouds and ground, rather than dynamically create one with the exact rendered background and moving clouds.  To do so, might be possible, but I imagine a performance killer if you had to do it on every frame.
  • I think the NormalMap stuff might be redundant actually.
//Input variables
float4x4 world;
float4x4 inverseWorld;
float4x4 worldViewProjection;
float4 viewPosition;
float4 Ambient;
float4 DirectionalDirection;
float4 DirectionalColor;
float4 PointPosition;
float4 PointColor;
float PointFactor;
float4 Material;
texture SkinTexture;
sampler Skin = sampler_state
Texture = (SkinTexture);
texture NormalMapTexture;
sampler NormalMap = sampler_state
Texture = (NormalMapTexture);
texture ReflectionTexture;
sampler Reflection = sampler_state
Texture = (ReflectionTexture);
struct VS_INPUT
    float4 ObjectPos: POSITION;
    float2 Tex : TEXCOORD0;
    float3 ObjectNormal : NORMAL;
struct VS_OUTPUT
float4 ScreenPos: POSITION;
float2 Tex: TEXCOORD0;
float3 WorldNormal: TEXCOORD1;
float4 PointDirection: TEXCOORD2;
    //Move to screen space
    Out.ScreenPos = mul(In.ObjectPos, worldViewProjection);
    float4 WorldPos = mul(In.ObjectPos, world);
    float4 WorldNormal = mul(In.ObjectNormal, world);
    //Pass on texture coordinates and normal
    Out.Tex = In.Tex;
    Out.WorldNormal = WorldNormal;
    //Direction of point light to this vertex
    float4 lightDir;
    lightDir= PointPosition - WorldPos;
    float dist = length(lightDir);
    lightDir = lightDir/dist;
    //Store attenuation in w
    lightDir.w = saturate(1/(PointFactor * dist));
    Out.PointDirection = lightDir;
return Out;
float4 DirectionalLight(float3 WorldNormal)
    return DirectionalColor * saturate(dot(WorldNormal, normalize(DirectionalDirection)));
float4 PointLight(float3 Normal, float4 PointDirection)
    return PointColor * saturate(PointDirection.w * dot(Normal, normalize(;
float4 AircraftPS( float2 tex: TEXCOORD0, float3 WorldNormal : TEXCOORD1, float4 PointDirection : TEXCOORD2) : COLOR
    WorldNormal = normalize(WorldNormal);
    float4 Directional = DirectionalLight(WorldNormal);
    float4 Point = PointLight(WorldNormal, PointDirection);
    //Specular map is in alpha of diffusemap and material
    float MattFactor = Material.a * tex2D(Skin, tex).a;
    //Add it all up
    float4 retval;
    retval= saturate(
                Material *
                (                                        //Remove alpha channel from texture
                    ((Ambient + Directional + Point) * float4(tex2D(Skin, tex).rgb, 1)) +
                    (1-MattFactor) * texCUBE(Reflection, WorldNormal)
    return retval;
// Technique Section for Aircraft Effects
technique Aircraft
pass Single_Pass
        ZENABLE = TRUE;
        CULLMODE = CW;
        VertexShader = compile vs_1_1 AircraftVS();
        PixelShader = compile ps_2_0 AircraftPS();

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

Tuesday, October 24th, 2006

I have updated the Latest Screenshots page with some shots of my game’s new smoke effects in action. (aka. Particle System)

Check them out over here!

Dusk smoke
Day smoke

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

Tuesday, October 24th, 2006

I just uploaded another new build over here.  The aircraft now billow smoke as they take damage.


p.s.  still no explosions yet.

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

Friday, October 20th, 2006

Bit of a mouthful, but here’s the deal.

Evidently an earlier Microsoft Security Patch (MS06-051) broke the just released BF2142 for a few unhappy souls.  Jeesh,  talk about bad timing, eh!!!

So the good news is Microsoft have just released a new hotfix that fixes the problem.

Get it here.

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

Monday, October 16th, 2006

I’ve uploaded a new build over at the Latest Build page.

New stuff?

  • Shooting actually damages things!!!
  • Plane collisions = certain death.
  • Keyboad controls changed to be more intuitive.
  • MultiSampling (aka. Antialiasing) now optional via configuration.

More info on the Latest Build page.

There are no explosions yet, but head on over and give the new build a try!  :)

I’d really appreciate some feedback, particularly around the keyboard controls.  I mostly use the XBOX 360 controller anyway,  and I’m a bit close to the keyboard problem(?) to have a realistic opinion myself.

I have also updated the Latest Screenshots page, so check out the goodness!

Title screen and menu


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

Wednesday, October 11th, 2006

I’ve been asked in a blog comment whether I’m giving out the source.

I’m afraid,   no, sorry.   :(

Y’see, this is kind of a personal project and learning exercise for me. I first coded this exact game idea when I was 13 (that’s 23 years ago) in BASIC, but performance got rotten on those ancient “Home Computers”. And it certainly wasn’t 3D.

Now I’m much more capable and having another go…for fun.    ;)

I’m am certainly happy to share snippets and attempt to answer questions though!!!

Any special requests?

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

Wednesday, October 11th, 2006


I’ve added a small menu to the Title screen.  You can now choose in-game whether to play in the bright sunny daylight setting, or moody dusk.


There is a slight problem with my alignment of the menu overlay, causing a visible edge.  I rushed it – will fix.

Get it at the Latest Build Page.

p.s.  the download is now smaller, because there’s only one executable, where before I’d put in a dusk exe for the keenest customers.

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