Without realising it I spent most of the weekend working on Dirchie Kart, Thursday and Friday afternoons were short but fruitful code sessions on my new “Ghost racer based best racing line state machine AI”.
Yesterday was spent tuning the AI into the game and today was mostly garbage collection optimisations on the XBox 360 version, seems when I fixed my memory leak problem I created a garbage collection one instead.
The new opponents are surprisingly robust and challenging… probably too challenging for anyone new to the game (Something I’ll have to work on). They can’t use weapons yet, that’s another kettle of fish I’ll deal with later, for now I’m going nut out some more game-play by blowing the crap out these poor defenseless versions.
I’ve got some fire back in my belly for this project, it was lacking for a while there… stay tuned for some alpha test code soon.
I achieved one more step along the path to Dirchie AI nirvana this afternoon by implementing a time trial mode with a recorded ghost of your last best lap.
I was having all sorts of trouble getting the ghost to sync with the lap time, he was always a bit faster than you even if you beat his lap time. The solution was to put the game back into fixed time step mode (so your update method always runs at 60fps).
Good ole Shawny Hargreaves has a great article explaining how XNA handles it.
What does the ghost have to do with the AI? I’m planning on using the best ghost data as the optimum racing line for the AI drivers. How exactly I do this… I don’t know…. yet.
Inspired by the dodgie movie Death Race which I watch on the flight back the other week, I’ve re-jiggered the mechanics in the game.
Each kart has a health meter (the hearts for now) separate to the coins, once the health reaches 1 the boost is disabled on the kart. Oh there’s a smoke emitter hooked up to the health as well (The red Dirchie is damaged in the pic below). I’m about to implement a pit lane for each track which will re-charge the health and supply ammo.
You’ll also notice the skid marks are much nicer now, I’ve integrated them into the track texture better using a multi texturing technique.
The other day I converted a formula I found on Wikipedia into XNA C# code, basically I wanted to turn the 360 degree direction of a controller stick into a pure colour hue.
It’s a bit of a weird formula but it works a treat.
public static Color ColourFromAngle(float angle)
{
float a = angle / 60.0f;
int h1 = (int)a;
int h = h1 % 6;
float f = a - (float)h1;
float p = 0;
float q = 1.0f - f;
float t = 1 - (1 - f);
switch (h1)
{
case 0: return new Color(new Vector3(1, t, p));
case 1: return new Color(new Vector3(q, 1, p));
case 2: return new Color(new Vector3(p, 1, t));
case 3: return new Color(new Vector3(p, q, 1));
case 4: return new Color(new Vector3(t, p, 1));
case 5: return new Color(new Vector3(1, p, q));
}
return Color.Red;
}
Didn’t have a real good sleep last night, I was dreaming about .NET garbage collection optimisations all night after spending about 12 hours yesterday on them.
The good news is that I’ve cleared them up, the bad new is that they weren’t all that big a problem in the first place… the reason it was glitching on my PC was background processes spiking not garbage collection… bloody Vista!
Anyhow the up side of this work and some transformation updates is that Dirchie Kart is now running at a silky smooth 60 frames per second with 3 player split screen on the XBox 360 (need to buy another controller so I can test 4 player).
I’ve got plenty of spare CPU and GPU time for the rest of the features, which is a pretty good place to be at this stage of the project.
I’ve also recently implemented:
- 5 original Mushroom Cup tracks from the SNES "Super Mario Kart" (for testing only)
- Jump pads
- Boost pads
- Land mines
- Item Pickups (that don’t give you anything just yet)
We’re slowly getting there, stay tuned.
Recently I’ve been searching for inspiration to take Dirchie kart to the next level, after helping Fordy with his crazy ROM hacking exercise to extract the graphics from the SNES version of Final Fantasy 6, I thought,"I wonder if someone has done the same for the original Mario Kart?".
Lo and behold someone has and put them up on the web in convenient 1024 x 1024 png images, perfect to slot into Dirchie Kart.
I’m not planning on using them in the final product just to tune the game mechanics, if I can make it fun with these tracks then I’ll have a good idea how to make fun tracks of my own.
There’s even the battle mode tracks as well, I’ve got plenty to play with stay tuned…
Last Friday the poXBox returned home, so first thing I did was fire up Dirchie Kart which was what it was running when it died.
It ran with no hastles and the proceeding multi-player session Kiwi and I had a bit later on that arvo confirmed that the new optimizations I’ve implemented are working like a charm.
Not only did it return in a very timely manner it also came back quieter. It’s not exactly quiet, quiet but it makes a lot less noise than it use to, it’s just quieter than the PC now.
Luckily they also replaced the drive which had started making all sorts of groans and moans.
All in all it was a pain in the arse but not as painfully as it could have been!
I had been holding off doing a full cel shaded effect for Dirchie Kart, it’s been done before and I was hoping to come up with something more original.
I figured it suits the graphic style so much I’d better have a look… It looks so good particularly with the vertex animations that it’s definitely got to stay.
With the announcement that Microsoft are going to sell the XNA community games over XBox live I figure it’s time to reveal the super secret skunkworks XNA project I’ve been working on.
Up to 1 to 4 player split screen, co-op or competitive cart action on XBox or PC. Most of the graphics are just place holders at the moment, but I’ve got some pretty good tech going on in the shaders that open the door to some game play ideas.
Every object in the game can:
- Be animated by one of many vertex shader routines.
- Have the amplitude and frequency of this animation individually controlled.
- Have it’s a colour saturation manipulated (from grey scale to colour).
- Mask out areas of the texture to a colour (ie specific parts can change colour).
Game modes I want to include:
- Paint the town, where everything starts gray scale and you have to paint the level with your Dirchies colour (maybe have a specific colour that you have to collect first).
- Race…standard Kart affair but with more bad guys.
- Battle, you need to keep your Dirchie meter above zero (Dirchie meter indicated to other players by your saturation level)
- Survival, help each other reach the end of a level filled with bad guys.
- DDR, Dirchie Dance Revolution, something where you collect notes or something that make the level dance… I dunno.
The other thing I want to introduce is a award/punishment/vote system so you can bag each other out at the end of each round.
If you’ve got any suggestions for game modes, weapons or awards/punishments leave me a comment.
Didn’t sleep too well last night, my mind was racing after an intense afternoon in HLSL (High Level Shader Language) developing a new shader I had thought up over the weekend.
I’m thinking about putting together an entry for the new XNA Dream-Build-Play competition. One of the feedback concepts I dreamt up was to pack the area with static characters and objects which start off black and white, these animate and gain colour the better you perform.
Being a one man team there’s no way I’m going to be able to animate all these objects in max, so I came up with a vertex shader to do it, a few sin waves and matrix calcs later it was all working (I say that but it pushed my matrix math and HLSL skills to the limit).
You have to use your imagination with these static images but imagine the coloured ones bopping and swaying in time to some music.