Wednesday, January 06, 2010

This blog has been rather quiet... largely because I've been working on Square Off. All of my blogging power has been channelled that way. Check out the Gnomic Studios site for more information.

Monday, September 29, 2008

Things have been moving along in the as-yet-unnamed 2d project. Whilst making the particle system I came up with a small template class that I think is really rather useful. I needed a way to blend between a list of values of arbitrary type. The only type specific functionality required was a linear interpolation (Lerp) function... so a delegate was required. The beauty of it is that the Lerp method signature is pretty standard across the XNA framework, so I stuck with that. Here's the code (damn I really need a better way to post code):

// Generic class to store a list of times & values and
// interpolate between them.
public class FunctionLinear<T>
{
// The method signature for interpolating between two values of T
public delegate T Lerp<T>(T a, T b, float amt);

// Lerp function provided by the user
Lerp<T> Lerper;

// The sorted list of items
SortedList<float, T> Items = new SortedList<float, T>();

public FunctionLinear(Lerp<T> lerpMethod)
{
Lerper = lerpMethod;
}

public void AddItem(float time, T item)
{
Items.Add(time, item);
}

public T GetValue(float time)
{
if (Items.Count == 0)
return default(T);

// Determine the Items before and after the given time
int i = 0;
while (i <> Items.Keys[i + 1])
i++;

if (i >= Items.Count - 1)
return Items.Values[i - 1];

// Get proportion between values
float amt = (time - Items.Keys[i]) / (Items.Keys[i + 1] - Items.Keys[i]);

// Call the interpolator
return Lerper(Items.Values[i], Items.Values[i + 1], amt);
}
}

Thats it. As an example, here's how you would use it to create a function that describe a square in 2 seconds:

FunctionLinear f = new FunctionLinear(Vector2.Lerp);
f.AddItem(0.0f, Vector2.Zero);
f.AddItem(0.5f, Vector2.UnitX);
f.AddItem(1.0f, Vector2.One);
f.AddItem(1.5f, Vector2.UnitY);
f.AddItem(2.0f, Vector2.Zero);

Monday, September 15, 2008



Since I'm majorly embarrassed at how few posts make it to this blog, here's a little snippet of what I've been doing. Work on my XNA 3d engine has stalled, due to being temporarily replaced by the above 2D project.

I am lucky enough to work with 8 digital artists. Hearing about a local game competition (gamejam.org) got us inspired. A few of us decided to give it a go but realised that there was no way near enough time to get it done. Then our Dream Build Play dreams suffered the same fate. So, in the interest of this project at least seeing some light of day, above is a sneak preview of... (CENSORED). Sorry, the name is too cool to let out of the bag yet. No doubt I'll reveal it in a future blog post, and I'll get permission from the artist to blog about this project.

Tuesday, June 10, 2008

XNA Engine and ContentBuilder

Back in the days of XNA 1.0 I made a class to help me load content at runtime. The approach taken was to use the MSBuild engine to construct a Microsoft.Build.BuildEngine.Project containing all the content items and use it to build them. At the time, it was pretty cool. Then, along came XNA 2.0 and the ContentProcessorContext.BuildAsset() method, which made my ContentBuilder class totally useless. Or so I thought.

Fast forward to present and I'm attempting to build some sort of an XNA engine. I'd really like to be able to use an external tool (eg 3DS Max or Blender or a custom scene editor) to kick off the content build and then run the game directly (no VS builds!). And guess what... my existing ContentBuilder class is perfect for the task! At least, in my head it works beautifully.

Oh, and the engine features (some planned, some existing) are:
- Use JigLibX physics
- Use GraphiXNA rendering library
- Use XNAnimation library
- 3ds Max scene exporter
- C# scripts for controlling scene nodes (and other stuff)
- Editor for building the world and authoring scripts

Let me know if you have any feature suggestions or if your interested in checking it out once it's done.

Wednesday, February 14, 2007



Check it out!!! Coffee Jar Slide, live at Mojos... the debut CD launch. Thanks to everyone that came down.

Sunday, December 10, 2006

Just a little reminder to myself to check out this 3DSMax9 exporter for XNA... looks good

http://www.mindcontrol.org/~hplus/graphics/kwxport.html

Monday, September 18, 2006

Well, if you can forgive me for stating the obvious, I now have a blog.

I don't know how it happened. It wasn't that I really wanted one, I just went to post on hollywoodkidz and what do you know... BAM!, and I'm blogging.

At least now there is something here. Don't get yer hopes up about too much more.