I'm a software engineer who works on game development part time. I teach game development (on gamedev.stackexchange.com and lynda.com). I'm always working on something, and I'll post updates here. Let me know if there's a game development topic you want to know more about, I probably know the answer, or at least where to get one.

Tuesday, January 10, 2012

Unit improvements, inside and out


I’ve been working on stuff that’s hard to see. Because it’s on the inside. Goblins (and all the other creatures in the world of AoG) now have a system for defining their insides. This means that location based damage can have specific detrimental effects. For example, slicing into the upper arm of a Goblin has the chance of nerve damage, therefore disabling the use of that arm and hand. Or if a goblin cuts off that vibrating appendage from the right side of a gavartick, it dies (that’s where it’s heart is) (note: the gavartick is not a real creature yet, but I guess I’ll have to make it one now, who wants to draw a gavartick concept?).

The system also allows for dynamic dismemberment. Battles can result in arms, legs and hands being strewn over the battle field. The internals system is tied to the animation system and task system to restrict or disallow certain actions based on the limbs remaining. But the Goblins are clever gadgeteers, I’m sure they’ll be able to make some pretty nifty replacements ;)

Finally this system is useful for some material gathering purposes. Knowing what the internals of a creature are allow you to gather specific materials from it. Materials gathering is not currently in place, but here are some examples:

  • Bones can be used in place of wooden sticks for construction. 
  • Eye balls can be used in movement sensing gadgets. 
  • Brains can be re-purposed to process gadget logic. 

Most of this new system is not visible yet, so I don’t really have anything to show off. But I’m working on that.

And out

I rewrote the model importer to use the DirectX model format (Thanks Mr. Shaw!). This allows me to know which parts of a mesh belong to which bones and (along with a special naming scheme for the bones in Blender) I can use that information to define limbs for dynamic dismemberment. Additionally the .x format gives me all my skeletal animations. I’m in the learning stage of animation. It’s fairly complex with lots of different methodologies. I imagine I’ll implement a LOD system for the animations based on the units on screen and their distance from the camera. Perhaps with some limited total number of bones being animated at any given time, I’ll have to test to find out what that’ll be. However, I’m holding off on animations for now, so I can improve some other aspects of units and think/learn more about it (plus I’d have to be all artsy and create animations to test it out).

The new importer and subsequent drawing code is working pretty well. I posted on twitter a few days ago my success with drawing a good number of goblins with little performance loss.

There are 100 goblins in that image with a medium to large size world and I’m getting great performance. The way I managed that was pretty neat. All the goblins are drawn from the same VBO. Each unit has it’s own transform matrix for rotation and translation. The transform matrices are put on the graphics card in an array and get updated when unit positions change. Then when drawing each one of these units, I send its transform index to the video card, then the video card uses the matrix at that index to rotate and translate the vertices associated with that unit. Pretty neat.

I’m currently improving the way units find paths and move around the world. I’m integrating physics into their movements and more realistic paths. For physics, I’ve started with the Bullet physics libraries (unless someone has a better alternative?). It’ll be fairly simple physics stuff to start with. Just stuff like falling down if the block below them is removed. For path finding I found a nice article from Gamasutra for creating better path finding. The current system uses A*, with a few modifications and cubic splines to smooth the paths. The new system will take into account unit width and height, so I can have units larger than a cube (the current system is based on the assumption that all units are no wider or taller than a cube).

I’m still really enjoying my game development. I’m starting to focus more on getting some core features put in so I can start alpha testing sometime this year (I’m just one developer here, I have to set easy goals). Thanks for reading!