Sunday, 25 April 2010

Guns, Guns, Guns, Guns, Guns, Guns, and err ... Guns

Did I mention guns at all? In case not ... then I've been working on guns and reloading systems for guns and animations for reloading of ... guns. Oh, and a cricketbat ... which isn't really a gun ... unless it shoots fireballs ... which it doesn't ...

After much thinking about the best way of doing things, and generally reading up on what others had posted previously, I drew up an ammunition_pool->weapon_magazine->reloading_system which I was vaguely happy with and bugtested the hell out of it.

Even though, some little issue did slip through for a few weeks, when the whole thing would fail on very high rate of fire weapons if the player pressed various buttons in a certain sequence ... the sort of sequence which would only happen in the panic of gameplay when something leaps out of shadows and tries to stick it's tentacles in you ... but that's what playtesting is there to catch.

I'd been trying to use an integrated automatic and manual reloading system from the top tier of the process, and had it check so that they wouldn't clash ... except under a certain combination of mouse presses it all failed, and I'd thought it was because of something else and had remedied that - except I'd only jiggled the failure around so that it was waiting to be triggered by an even more elaborate set of mouse button mashing. In the end dividing the top tier of the reloading into seperate manual/automatic check functions before reintegrating them into the main control function sorted out this little issue.

How many hands does it take to reload a gun? Four ... just not showing all at once.

And with a working reloading system, I knocked up some reloading animations. Nothing fancy, just whip the mag/clip out and slap another one in. I'd previously decided against my initial plan of using the full 3rd person model in first person due to the aiming issues that I had faced when going past 56 degrees. I'd modded the code so that the EyeOffset settings didn't stick to the screen and so the weapon jigs around in first person as the player model animates.

Slap in some "bonus" hands solely for first person, attached to the weapon and animating with it, and reload animations came along. Whilst I made my first person "bonus" hands animations, I might need to rejig them a touch in places to deal with the explanation of floating point precision in NearClip that Ben Garney expained - in a nice idiot proof explanation ... which always helps - or rejig my first-person rendering into a seperate pass ...



All audio custom done with a bit of help in Audacity - more open source goodness.

I also did a fair bit of "field testing" my 12 finalized(ish) weapons, tweaking them for balance so that everything has a strength and a weakness based on accuracy, rate of fire, damage, recoil, ammunition capacity and range. Weapons are generally split into short and long range types (and melee incase of ... well, melee weapons ...). Short range was fairly easy to balance and keep each weapon with it's own unique identity, but the longer range stuff required considerable more thought, not just for the player but also for how the Ai would use it.

Still a few weapons to do, I've previously installed a HL2 type double keybind so the player can carry 20 weapons and the kitchen sink, though I'm thinking of keeping carryable ammunition levels fairly lowish, 4 mags for each weapon. I've got 12 done and so need another 8, though currently they're not priorities. I've got them planned out and need a couple of explosive weapons, a super-sniper rifle, a rechargeable lazzor (balancing the plus of not needing ammo with the con of a charge up time) and a couple of BFGs (I'm thinking of something like a hand-held version of the "Hornet" swarm missile system from FreeSpace -> cos that was cool!) - then I just need 2 things which are bigger than a BFG ...

Whilst trying to keep my weapon textures simple ... I'm back to umming-and-ahhing on whether I need to add just a bit of edging detail/wear ... as they are quite blank ...

I knocked up another alien humanoid model - something that could use humanoid animations so that they could use humanoid firearms - which took a bit of time as I wasn't entirely certain of my creature design and ended up modeling it "organically" in Blender until I came up with something which wasn't entirely hateful. Still umming-and-ahhing on a texture and colour scheme for that, thinking of using a conplementary scheme and probably something fairly bright. I had an idea about a frill or something sporting an eye motif like butterflies do to try and make themselves look scary ...



Also fixed an issue of mesh penetration with knee related animations on my player/Ai models - can't believe I hadn't noticed that before. And made another material for lower LODs which doesn't cast shadows - uses the exact same texture, so no extra texture memory, but doesn't cost anything in dynamic shadowing at distance - didn't really see the point in a human sized lowpoly shape using up resources to cast a tiny shadow that may be hundreds of metres away from the camera and almost unnoticeable to the player. Then I promptly went and did the same thing for the lower LODs of all small objects.

And after all of my previous performance testing, I am now quite convinced that I can put worrying about drawcalls to bed.

Also redid my lightmaps with the new PureLight version after some mesh tweaking to make the materials more productive for performance ...
... and did a bit of custom script render/hide areas on my initial level to compliment the zoning...
... and made a start on my custom player death-camera-respawn/quite UI sequence ...
... and gave a singleplayer load/save system the first thoughts ...
... and did various tweakings ... in general ...
... and went to a real ale festival ... and think I might go to some more ...

Tuesday, 6 April 2010

Fluppin' Drawcalls and Forget How to Use Blender and PureLight

And an end to said fluppin' testing of Drawcalls. I was going to use fluffin' but after a quick check on the interwebz, it turns out "fluffer" has a rude conotation --- I mean, who would of thought it? So flup it is.

No pics. Just the facts, ma'am.

I had a quick test --- read that as far too much time --- ripping the whole drawcall/performance thing to bits and seeing what I could get it down to.

In previously mutterings on the whole performance thang I'd made it clear "why" I'd done things in a certain way previously, older tech, older hardware, a paranoia of >512px.

First off I amalgamated a few of 512 and few 256 non-tiling textures into larger 1024s. And drawcalls fell, fps went up by a bit.

I'd also extended the fixation with 512 to my lightmaps, splitting up meshes into ever smaller pieces to get the texture size down, so next up was to stitch all those meshes back together into larger ones to reduce instancing.

This meant realising that I'd forgot how to use pureLight ... and after a fair bit of jiggery-pokery, remembered that I had to delete the object in PL before replacing it if I'd changed materials or UVs (or it'd import with mixed by UVs), and if the mesh-object in Blender wasn't at 0 0 0 then the object/node it's parented to bloody had better be - even though that thing isn't getting exported - such as price to pay for using Open Source apps for these sorts of things. Oh, and collada doesn't do curvy and thus ase is needed. And ase needs materials and UVs, and collada sorts it's materials from it's UVs so time saver there ... as long as you don't want soft edges...

*note to self: write this stuff down on more than post-it notes sometime*

And finally, I took a look at what renders and what occludes. Previously I'd used zoning to split my corridor-crawler of a level into 3 main areas, and kept to the same principle with scripting, just dropping the zoning (though they might come back, at the moment there's a bit of an issue with portals at certain acute angles and things suddenly not rendering that should).

And so the up shot was this.

(GTS250 - Advanced Lighting @ 1024px without shadows / with shadows)
old drawcall average = 783 / 1076
new drawcall average = 410 /602

And the biggy - busy scene @ 1080p with everything maxed out
old drawcalls / minfps = 2295 / 57
new drawcalls / minfps = 869 / 80

So, as a total average of all my recordings, drawcalls were reduced by a third, and fps increased by a fifth. Which was nice...

In other news I saw ... well, heard some music I liked, and had to approach the guy on spec for commercial licensing (same chap I used on my lightmap video under CC). He appeared reasonable, so we'll see how that goes once this Easter break thing is out of the way.

Also, I redid my weapons with first person hands and reloading animations, and dug out an old (deactivated - don't call teh Fedz!) lever-action rifle for the metal scraping audio. At which point I discovered nearClip and the fact that it defaults to 10cm, which causes all kindsa hassle with camera penetration on aim-down-sight animations. If only I'd realized that before. I set it to 1cm and things are better. Still need to do a couple more bangsticks for my proposed demo, and so video of all of this later.

End of rambling stream of conciousness...