Game Development Community

dev|Pro Game Development Curriculum

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

by Steve Acaster · 04/24/2010 (3:32 pm) · 19 comments

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, 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 ...

farm5.static.flickr.com/4010/4549319386_c1c5c8ef5c_o.jpg

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 ...
... 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 ...

#1
04/24/2010 (10:07 pm)
At first, I thought those were targets on its back! You know... to make it better to aim at him.
#2
04/25/2010 (4:29 am)
Nice stuff. I also suggest not only add some aging to texture but create high poly versions of your weapons with more little details and little corner chamfers, etc. And bake those to you low poly stuff. Or do just corner chamfers on high poly stuff and little details could be added to normal map by means of photoshop Nvidia normal map filter or Crazy Bump.
Because now some polygons on your weapons looks weird due to smoothing. I know it takes a lot of time to do what I am suggesting but it will make your weapons look more current gen. %)

Anyway. Good work on balancing all that stuff.
#3
04/25/2010 (5:10 am)
@Val
Actually I've been trying to "freehand" everything, including normal maps (though to be honest those weapons don't have any normal maps at all which is probably why it all looks a bit funny with just a specmap not quite working right) - but yeah ... might go back and redo all that ...
#4
04/25/2010 (6:01 am)
Looks good Steve. How did you go about doing the arms/hands, did you create them from scratch or hack them off your character, attaching them to a bone structure next to your weapon and animate them?
#5
04/25/2010 (6:25 am)
Wow cool~

nice FPS mode
#6
04/25/2010 (8:42 am)
@S2P
To save time I hacked 'em off my character and attached them to a new armature that was part of the gun on highest LOD, then jiggled the verts a bit so that they animated a bit better (there's still some bad deformation but most of it isn't visible), and then gave them a new texture with a few basic drawn creases in it 'cos it was looking really crap using the 3rd person bitmap.
#7
04/25/2010 (8:56 am)
@Steve, wouldn't have noticed too much deformation, only from where the light shows it. Are you making the weapons scale in code or on export?
#8
04/25/2010 (11:00 am)
Everything is done to a set scale in Blender.
#9
04/25/2010 (12:10 pm)
I wish I had your skills in Blender Steve. Very cool guns!

No bunny-shoe chick. Bawwww..
#10
04/25/2010 (12:23 pm)
@Konrad, she's holding the guns!

My Blender skills aren't really up to much ... I just did a few tutorials to learn ... and then spent 2 years tweaking all my models ...
#11
04/26/2010 (12:38 am)
nicely done, you gonna finish that bug?
it looks like you've got a few verts not blending the animations in that left arm at the elbow.
#12
04/26/2010 (3:02 pm)
@Steve, I really like the video. Are you planning to release a tutorial or something? I would like to have this in my game.
#13
04/26/2010 (4:07 pm)
Tutorial? On the reload/weapon animations? They're just animations (of the weapon itself -- hands are attached to the weapon-model's highest LOD) that get triggered with the weapon's inbuilt/stock FSM using the stateSequence.

//So some weapons have a fire animation (the flash is an animation, a little jolt animation so it moves against the camera)

stateName[#] = "Fire";
stateSequence[#]= "Fire";

//and then a reload animation - cue animation of hand pulling out magazine 
//and putting a new one (the same one really) into the gun

stateName[#] = "Reload";
stateSequence[#]= "Reload";

All of that stuff is available stock, there are a few resources for getting clips/ammo-pools working (all script no code - good for binary users too).

Of course the "extra hands" show up in 3rd person at the moment, so it'd look bad in multiplayer. I think the solution might be to split which models and animations show on client-and-server ... but I'm not really up on multiplayer coding ...
#14
04/26/2010 (9:19 pm)
And even that was resolved, there would be issues with different characters or different skins.

I have not yet seen a Torque mod that has found a resolution.
The camera shaking is also probably something you wouldn't use much, since it might look like arms are coming out of your ears.
#15
04/27/2010 (1:26 pm)
Been a while since I followed your blogs, or anyone else's, but nice work Steve! Great to see your continual progress - love the weapon handling you've got going on.

Now to set back down and relearn what I've forgotten about Blender.
#16
04/27/2010 (2:13 pm)
It had not escaped my notice that Silent Mike had been especially silent for some time.

*waves*
#17
04/29/2010 (10:11 am)
i like how you did that.
#18
05/02/2010 (4:26 am)
I haven't tried it yet but, cant you make an animation for the weapon reload and weapon reload and play them simultaneously?
one for the character and one for the weapon?

that way the characters arms are actually the highest LOD, only seen in 1st PoV, as render in 1st set to true, which eliminates the extra arms

you could even make the clip part of the characters animation (as you don't see it when its in the gun)

just a guess, but that's what i was gonna try once i got the Blender exporter all figured out.
#19
05/02/2010 (1:42 pm)
Yes you could ... you'd have to synch it all carefully, and not use eyeoffset - you could even make the weapons themselves part of the character with hide/show meshes and a "meshless" weapon for mounting -- but as I said (paragraph 5) - if you can come up with a way to get an animation or similar solution to non-eyeoffset aim-down-sight to synchronize at higher radius angles post it - 'cos I couldn't.