More XNA hacking

jwatte's picture

I've been hacking on XNA again. This time, I built a car simulation out of rays and a tire friction model. I'm using JigLibX for collision detection and force integration, but I'm not using the built-in car simulation, as it didn't get me the response I needed.

editor screen shot

Here's a screen shot of the editor mode of the game. Click to magnify. The controls are generated using reflection on properties of the entity and entity components in the game, and edited entities can be persisted back to the XML they came from. Woot! I'm a toolsmith again! Even though I swore I would stay away from it.

The property sheet is actually kind-of interesting. Rather than trying to make .NET WinForms and XNA live together (which is the subject of much debate on the XNA forums), I wrote a re-usable COM component (using ATL) where I can add controls, and groups of controls. All of it is then laid out into a native Win32 window. I then import this COM component into the Windows version of the build using CLR interop. Oh, and the group boxes also fold up if you double-click them, similar to 3ds Max.

The car is reasonably fun to drive. I've tuned it to be mostly "real" right now, which means the tires squeal a lot and it's not very good at turning at high speeds -- in fact, the driving wheels lose traction when running over bumpy terrain a lot. Arcade racing requires cheating to feel good, so I'll go from here into the unrealistic domain.

You may also notice that the license plate and windows are due to normal mapping, not geometry. The car paint shader I have is actually pretty nice; it has fresnel two-tone, normal mapping, gloss mapping and all that jazz. All it's missing is environment mapping, which I'll add at some point.

Previous game hacks I've attempted have pretty much failed when I got to character animation. Not because character animation is very hard (which it is), but because I've never had a good art pipeline that actually lets me take an animated mesh out of a DCC tool and into a rendering engine. I always run out of steam at that point. However, this time I have kW X-port which I've worked on in my spare time for the last two years or so. It actually is fairly solid -- as long as you keep the pivot of the character in the identity transform. I can live with that, I think.

And with cars, I won't even need animated characters, so there's a chance I'll actually get a real, playable game out of it, and not just a tech demo that loses its lustre once I've done the fun parts, and can see the long road of tedium between that, and a shiping game. The main problem I'm worried about now is art -- I'm not a good artist. We'll see how that goes.

Comments

Thats very cool. I decided

Thats very cool. I decided for myself to make a car-network-game using JigLibX:

Everyone gets a car and is able to drive around in an arena. The goal is to crash into other cars and be the last one who is 'alive'. - Something like FlatOut - http://www.youtube.com/watch?v=IS7EcfHjuGs

noone88