Karl in a comment asked what I'm doing for collision, so here's a brief run down.
I export the levels from Max as a simple XML file with triangles, load that and parse them into a friendly structure. I store all the parsed triangles in a balanced binary tree, subdividing cells on longest axis. I would use an octree, but that requires subdiving for effect, and I haven't yet invested in writing a triangle splitter.
My movable physical objects are all spheres.
After I move any of the physical entities, I do a constraint pass against the level, i.e. for each triangle, check to see if my sphere is intersecting with it. If it is, move me out of the triangle, using the direction I'm coming from, i.e. the direction from where I currently am, to where the intersection happened. This works just fine as long as none of the entities can move farther than their diameter in a single frame.
I do the same thing with any other dynamic physical barriers, but they are represented by boxes.
I also provide ray-tracing onto the level mesh, which allows for queries like, "find the closest point on the level beneath me".
Entity to entity collision is straightforward sphere to sphere intersection tests. Again, works just fine if no one can travel faster than their diameter in a single frame.
To avoid noise, separation between entities isn't direct collision response as it is with the level, rather it is applied as a separating force over time.
In effect, the wolves are flocking away from each other rather than strictly colliding. The thinking here is that it's better to have two wolves intersect briefly rather than bounce back and forth as they're corrected violently each frame. This also means that by and large they can't get each other stuck.
Saturday, March 03, 2007
Thursday, March 01, 2007
Let There Be Cowbell
As promised, here's a look at a few pretties. We have a level segment with a new palette, and a new badguy, the froggy. These are the entry level badguys, so they don't put up much of a fight. Still blow up nice though.
I've also snuck in the healing item in the game: mushrooms.
So, coming on from last time's discussion of mesh animation, this update shows more examples of it. All the effects and character animations are done in the mesh animation manner, and hopefully to a consistent style. I still like it, still planning on writing a more efficient Content Pipeline plugin to pack them for me.
The art style is still holding together, I think. There's enough range in it, that I think I can cover all the locales I'm thinking of, and the gradient in the character of the environments I hope to depict over the story. I wish I had some time to sit down and concept out, but honestly at this point it's more profitable to just plow along. It takes an hour or so to model a new badguy. Bouncing back and forth between code and art (ignoring the vertigo), it was about 5 hours to get the frogs up and running from scratch. It's still a discovery process though, so I'm not too hung up on polishing yet. Getting everything working is first priority.
I have the design for the first level laid out now. It happens entirely underground, in a Zelda like dungeon configuration, complete with boss character. I'll stay focused on getting that done before moving on with any other portion of the game. I'm considering putting it up for public download at that point, to get a little feedback on how it feels.
Depends, really, on how embarrassing the whole thing is by then.
Before anyone asks, there's nothing clever about the cave scene. Reflections are the good old fashioned "render everything upside down", and the caustics are nothing more than a bit of fancy texture scrolling, where the x component is a sin wave on the y component. Sometimes, you just don't need clever to be fancy.
I'll be moving home for the next few weeks, so this might be my last post for a while. On the bright side: I'll be getting some new gear when I get to my new place, so perhaps I'll get around to trying some of those clever bits. At present, this PC is pretty much nipping at the limits of its little NVidia Ti4400 graphics card!
Tuesday, February 27, 2007
Zap! Pow! Biff!
A few things have happened since last time:
- I now have the different firing modes in place. Each of Tad's (Tad, his name is Tad for now) weapons have 3 firing modes: tap for a quick shot, hold and release for a "shotgun" and hold for a while for a berserk blast. The fire gem has all 3 working now.
- Added support for a bigger variety of effects. Mean, mean friends were saying it just wasn't pretty enough.
- Built a cave environment.
- Made froggies.
The vid above shows the attack modes. I'll post another soon with the new pretties.
I think I've reached the limits of the built in content pipeline plugins and it's time to branch out. As soon as I hit another wall, I'm off to write my own importers and processors.
I've grown to like mesh animation. It's crude, but appealing to me. Normally you'd rough out an animation by defining key poses along the timeline, then iteratively pass over the whole thing again and again adding overlapping motions and follow through to get a natural looking motion. Animating on a budget generally means animating pose to pose, and leaving it at that, and rightly enough that suits the mesh animation look better. I simply model the poses I require (using skinning in Max, if it's a complex mesh like Tad), then string them along a timeline in Stutter, duplicating appropriate hold frames.
With my own content processors, I could pack all those mesh frames into the minimum amount of data necessary, and the overhead should be pretty reasonable. Especially as I'm going low poly anyway. Certainly the runtime processing cost is laughably small compared to a skeletal animation.
Live scripting language is absolutely the bomb. Almost all of the logic bar collision is written in Stutter now, and the joy of being able to write player control while actually in the game is intoxicating. It would be quite a bit more work to get a professionally robust version going, but I think I'm going to start recommending it anywhere I work. It's just so worth it. I just need to see if there's some easy way to hook up live asset reloading (in this XNA version) as well. As it is, adding/changing assets still requires me to drop out and rebuild in VS.
In case anyone is wondering why bother with the XNA and C# when I'm off traipsing through my own language... how on earth do you think I got it all up and running so quickly? I'm still well inside month one, and I have the whole kit and kaboodle chugging along. In fact, I had a model on screen, being manipulated by Stutter inside the first few days. This is a product of C# and .Net's excellent reflection abilities coupled with the accessible nature of the XNA libs in GSE. All I've done is written a layer of abstraction above these that lets me speak directly to game concepts.
GLH out.
PS Music for the vid is by Cornelius (god please please please someone make him write music for games), the track's name is "2010".
Friday, February 23, 2007
Baby lisp
So the rpg has come on a little bit. I really ought to come up with a name at some point. For now, it stays RPG Zero.
New since the last update:
- Tried to refine the look of the thing. I'm going primary colours, sharp contrasts, simple forms, abstract surfaces and everything easy to put together quickly. Also leaning a lot on vertex colouring for the low frequency shifts.
- Our protagonist can now be hit by badguys, and keeps track of his health.
- First blush at a HUD, and UI framework to back it up.
- A chest! What's an RPG without a treasure chest, eh?
- Refactored the player control to remove some annoying kinks, like sliding while idling.
- Wrote a *secret* story outline!

Seem oddly familiar? It's not really lisp, but it does share some characteristics with it. Chiefly: code is data. I can pass it around, chop and change it, store it and call it later. The scripting language is interpreted, which means it inherently has the ability to inject novel code into the currently running session. Godsend that, when working on a game. No compile waits, you're right there, in the game, where you can see what you're doing immediately.
It's called Stutter.
It's implemented as a runtime interpreter that is plugged into a reflection based dispatcher. I have a class that contains all the intrinsic functions. I then have a few intrinsics for dealing with .Net types directly, cnew (new a C# object), cset and cget (set/get properties or fields) and call (invoke a C# function). These are for... well cheating. My character entity for instance, is a C# based PhysicalObject, that gets initialised and bandied about by Stutter, but lives in the Game.Components update loop.
Why not real lisp? Well, I couldn't find a handy implementation, and I've still a lot to learn about building and implementing the support for an embedded language, so it seemed like the right time to learn. And the right time to experiment. I've taken the things I like about lisp, and screwed around with the formula to give me the things I've always wanted for games. Will it work? Will it be fast enough? Will it be expressive enough? Who knows? That's the whole point of trying.
I did mention this whole thing is one big bout of self indulgence, didn't I?
P.S. Today's vid is higher res than the last one, so you might want to click on over to the bigger Google Video player to see it. Today's music is Billy Bragg and Natalie Merchant doing Way Over Yonder in the Minor Key. Totally love that tune.
Tuesday, February 20, 2007
RPG Zero: Another Start
So Ultrahead, over at Do as I say, not as I do... in a comment conversation reminded me that I've always wanted to make an RPG. Abandoning all the other toys (I have a habit of doing that), I've decided to embark on the adventure.
When I started writing about game programming here last month, I really did want to practice a little altruism and share some stuff with the community. I'm afraid the vanity levels on this project however, make it wholly unsuitable to share as good practice. The sheer self indulgence in the code should warn people away. I really can't in good conscience recommend anyone learn anything from this... the scripting language is an own rolled, interpreted, prefix notated, reflection driven nightmare for pete's sake!
I would like to share though. So if anyone is interested in watching, I'll post the goings on in my RPG land.
I thank you for your patronage,
GLH.
Subscribe to:
Posts (Atom)