by Wazat » Wed Jun 09, 2010 4:35 am
In Turok on the XBox360, PS3, and PC (currently $7.35 on ), the player can dual-wield weapons. This turns out to be a damned cool feature, and I'm thinking about how to do it properly in Quake. I'd also like to implement the rest of the weapon system.
In the single player, you always have the knife and bow (buttons 1 and 2 on the PC). In multiplayer the bow becomes just another weapon you can swap out. You have 2 other slots for weapons, and you can swap them out by holding their corresponding button while touching another weapon. On the PC these buttons are 3 and 4. You auto-grab weapons you touch if you have an empty slot; otherwise the game prompts you to pick (or ignore the weapon).
For example, you touch a shotgun and see the messages:
"Hold 3 to swap Handgun <-> Shotgun"
"Hold 4 to swap Plasma Rifle <-> Shotgun"
If you're holding a Shotgun in slot 3 and touch a shotgun, it will auto-fill the shotgun's ammo and you'll only be given the option to swap out #4 (dual-wielding shotguns is cool, btw). Each weapon also has an alternate fire.
Some weapons are too big to dual-wield, but about half can be. Dual-Wielding is damn cool, and single-wielding a weapon has advantages too (you can use offhand grenades and zoom in for better aiming, using the controls that would operate the second weapon). While dual-wielding, the left mouse button fires the left-hand weapon and the right mouse button fires the right. On the PC, hold shift to fire the weapon's alt fire (it's the triggers on the xbox360).
You cannot zoom or use grenades while dual-wielding, but it's really nice to be able to control each weapon separately. I can empty my machinegun clip, then be reloading it while blasting away with the shotgun.
Rolling the mouse wheel cycles weapons: knife, weapon1, weapon2, weapons 1&2, weapons 2&1. The last two are the 2 dual wielding combos if your weapons can be dual-wielded, and order can matter since that determines which mouse button controls which weapon.
Note that there are no health items in Turok 2. The player's peripheral vision reddens as he takes damage, and when he takes too much damage he dies. If he avoids taking damage for a moment he starts to heal. The less damaged he is, the faster he heals. So a bullet or 2 is quickly healed, but getting blasted to near death could take 5-10 seconds to heal up once healing starts.
One last thing. The coolest... COOLEST weapon in the game is the sticky bomb. Fire once to lob a ballistic glowing bomb that sticks to whatever it touches. Fire again to detonate it. Alt-fire launches several proximity mines. If that doesn't sound cool, you HAVE to try it out in battle. It's an incredibly versatile weapon, and it's SO MUCH FUN to use against dinos and enemy soldiers.
SO! How to implement this in Quake?
I would want to use .viewmodelforclient so I could have 2 weapon models. This is a feature supported by multiple engines so it should be a reasonable requirement.
Making the right button fire the right weapon is easy with impulses and a "+attack2" alias. Having alt-fire work with the shift (or other bindable key) is equally easy, so long as the impulses from attack2 and altfire don't conflict (they can if the player releases both weapons in the same frame, which could happen). Otherwise I'd need to find something else to operate alt fire. Maybe jump could be turned into an impulse so I could put +button2 to better use... Not a lot of engines support +button1.
Tossing off-hand grenades when the player hits shift+attack is cripplingly easy. Likewise, displaying the ammo for weapons 1 and 2 can be done with the shells & nails displays. Grenade count could be cells.
Zooming could be done with fov, but that's problematic (how to avoid getting stuck with a wonky fov if the player quits or crashes while zoomed? Or is that not a problem?).
Eliminating health items and doing the time-based healing is really easy too, though we'd want to do something with those heal item locations in the map.
Weapon swapping with limited slots is doable. My monster swarm mod does it moderately well, and in fact if I changed its system a little to be like this, then it would be a lot easier to use! I should also change it to be touch-based instead of aiming at the weapon to pick it up (with the closest weapon touched being "selected" for pickup).
The weapon change code would have to be greatly retrofitted to handle two weapons at once, but still not a massive task. That could be really fun.
Thoughts?
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.