DOOM-3-BFG-VR
DOOM-3-BFG-VR copied to clipboard
Dual Wielding
I've almost gotten dual wielding working. Well, it's working, but it has some bugs and some features that aren't fully implemented yet.
I had to change the way some things were implemented. Weapon and other hand-specific stuff were moved from the idPlayer class into a new idPlayerHand class, which you now have two of, so the hands can function almost completely independently and equally. And I had to make the controls more context sensitive so, for example, the left trigger can be mapped to jump, but whenever you are holding a gun in that hand it will automatically control that gun's trigger instead. Kind of like how the grip buttons work now.
Hopefully, I can get this feature ready for the next version. And hopefully, it doesn't clash too much with whatever @KozGit is working on.
Let me know if there's anything specific you guys want in terms of dual-wielding.
Cool!
I had created hand structs to track world interactions ( grabbing, holding moveable items, melee state etc ) that should probably be integrated into your hand class as they are pretty much serving the same function. The class implementation should be cleaner.
This is something that's been on my want-to-get-to list for a while. There are only two options I was going to implement for dual wielding:
-
A cvar/menu option to disable it. Should this be disabled by default as it will change the gameplay so much? And just make it really easy for the player to opt in?
-
An optional damage penalty if dual wielding ( e.g damage is reduced by x% if dual wielding ). I think a damage penalty would let people have fun while dual wielding without letting the player be too/completely overpowered.
Does your implementation allow the player to use two of the same weapons?
I need to just deal with the fact that the hand interactions are never going to be as perfect as I want and get my changes committed.
What still needs to be implemented? I cant wait to take a look at this.
Reducing the damage just does not make sense. There's other ways to nerf dual wielding, such as lowering the weapon accuracy and increasing recoil, making reload longer, reducing movement speed and costing stamina over time.
~Currently the implementation does allow the player to use two of the same weapons, but that's more a bug than anything else. I'm thinking I should make a second inventory bitmask for which weapons you have that tracks whether you have a duplicate of each weapon and then only allows you to use two of the same weapon if you are actually carrying two of the same weapon.~ fixed: It now tracks whether or not you have picked up a duplicate of each weapon and only lets you use it if you have.
~~There should be a cvar to disable it. But I think it should have more options, like an option for only dual-wielding pistols, and an option for dual wielding pistol + main weapon, and an option for full dual-wielding.~~
I think it should default to enabled, just because it feels weird when you have two hands and you're using weapons one-handed, and you can see all these extra weapons lying around, and Doomguy is known to be ambidextrous, and there's no in-universe reason why you can't do it. But I'm not too fussy, we can disable it by default if it makes it too easy.
Dual wielding is an advantage, but I don't think it's a huge advantage. You still only have one brain, and it's harder to keep track of two weapons and two targets. And it throws off your rhythm when one gun needs reloading, etc. I haven't really tested it in combat though. Mythbusters did some tests of it IRL. https://www.youtube.com/watch?v=z7aao6JKJQ4 https://www.youtube.com/watch?v=6HhY2xQr0zw
We're already messing with the difficulty in other ways, like the headshot multiplier, shotgun accuracy, slowing down time and teleporting, etc. I'm not sure we're targeting the same audience as the original Doom game, or even if we are, I'm not sure they want the same experience in VR. I was even thinking about whether we need additional easier difficulty levels (like "Can I play, Daddy?") for people who just want to explore Mars in VR with a little bit of combat or who want to demo it to family members who normally wouldn't play Doom on PC.
I also think the penalty should be to accuracy rather than damage, since that makes more sense in-universe, but I understand why it would make boss-fights, etc. too easy.
~The main things that need to be implemented are getting the hand poses~ and perhaps weapon-offsets? to work properly, ~not letting you hold the flashlight and a gun in the same hand at the same time, getting the laser sight to work on the other gun~, getting reloading working properly per gun, ~not letting you use two guns if you don't have two guns, getting the HUD to show info about both guns, and allowing dual stat-watches and/or only showing the stats for the gun in the hand next to the watch.~
And I half-redid the holster slots but never switched over to the new holster-slot system, so there's a bunch of unused messy holster-slot code in there. I guess I should just push it anyway so you can take a look.
Yeah, I think the additional dual wielding options are a good idea. The boss battles were the primary reason I was thinking about the damage penalty - they could get too easy in a hurry. Reduced accuracy is certainly another option as well, ( and would be fairly easy to implement ) but it seems just as contrived as reducing the damage seeing as the weapons have laser sights. Increased recoil would be tougher to implement as it's implemented via the weapon firing animations. Edit: Although now that I think about it, the machine gun rise when firing is done programmatically, so something similar could be implemented for the different weapons.
If you don't want to just push you could always start a branch while we work on it, up to you.
I'll have to update the player model if we want two stat watches, not too big of a deal. (Do we want one on each wrist like the existing one, or just one big one? ) I can handle the hand/player animation parts as well if you like, also the laser sight and crosshairs.
Once the per weapon ammo states are sorted out, ( could be a little interesting with individual clips with two of the same weapon ) I should be able to update the main hud as well.
And someone still needs to come up with a better name for the stat watch. Weapon Monitoring Device? Clip Master 2000? Personal Ammo Display? Ammo Inventory Monitor? Wearable Armament Display? PipBoy?
Yeah, those all suck :)
I pushed it already (to my branch) and made it a pull request #284. And I fixed the laser sight and crosshairs already. ~I'm working on the HUD now (but I'm only going to fix basic things like the weapon pills showing both weapons).~ I just fixed the HUD, ~but it still only has room for one gun's ammo~. The per-weapon ammo states seem to be working fine. Each weapon has it's own clip. It's only the reload button that is tricky because by default it's the grip and I'm overloading the grip button heavily already. ~And of course, I have nowhere to show the ammo state specific to each weapon, so I'm showing the state for whichever weapon the game considers the "best".~
You invented the stat watch, you get to name it. :)
Strategic Tracker And Tactical Weapon Ammunition Transponder Combat Hud
Really rolls off the tongue doesn't it :)
I'm probably going to have to modify the player script in order to support this, which means existing save games will be nerfed. Dealing with save games and script changes is maddening. If I have to do this I'm also going to fix the chaingun script so it's based on time instead of framerate - it fires way to fast currently.
I was thinking of adding some additional features to the statwatch - two new screens you could toggle thru by touching the display on the watch. One new screen would show the system time with the health bars, and the other new screen would implement this radar script: http://mwoody.com/plasmaradar10.php
Thoughts?
~~Dual stat-watches aren't all that important. So don't feel like you need to nerf everything if you don't want to.~~
Those features sound good, but skimming the description it sounds like using scripts to do the radar was more of a hack rather than an optimal way of doing it, maybe we should add something to the engine to make it easier for scripts to do a radar?
~~Part of me wants to add PaddleWar! from Commander Keen's watch to the StatWatch. But that's silly feature creep when we could be working on useful things.~~
I really don't like nerfing existing saves, so I didn't change the scripts or save-game format when working on dual-wielding, but there are some issues with the scripts that I tried to hack around or need to hack around. The scripts assume there is only one weapon for the player and that weapons have exclusive access to the player object.
Here are some incomplete notes I took where weapon scripts access the player object, or vice versa.
owner.getPreviousWeapon() called by item_pda::Lower(),
which is called automatically by item_pda:Idle(),
to find out which weapon to switch back to (using owner.selectWeapon) as the PDA is put away
owner.selectWeapon( previous ) called by item_pda::Lower()
which is called automatically by item_pda:Idle(),
to switch back to the previous weapon when putting the PDA away
owner.openPDA() called by item_pda::Idle() to init the PDA
owner.inPDA() called by item_pda::Idle() to find out when to call item_pda::Lower()
weapon_fists::GetFireAnim() alternates returning "punch_left" and "punch_right"
owner.getViewAngles() called by weapon_handgrenade::ExplodeInHand() and weapon_bfg::OverCharge()
so the explosion can come from in front of you
$player1.getWeaponEntity() is called by weapon_bloodstone_passive::Raise() and Idle()
to set the petrification and the three activation levels on the shader parms on the weapon with weapon.setShaderParm( , )
$player1.weaponAvailable("weapon_bloodstone_active1") called by weapon_bloodstone_passive::Idle() and Fire()
$player1.getPreviousWeapon() called by weapon_bloodstone_passive::Fire()
to switch back to previous weapon with $player1.selectWeapon( previous )
after activating the ability
$player1.getPreviousWeapon() called by weapon_bloodstone_active1::Raise() and weapon_bloodstone_active2::Raise() and weapon_bloodstone_active3::Raise()
to check if we're changing from bloodstone passive to active1 and play the correct anim
$player1.getIdealWeapon() called by weapon_bloodstone_active1::Idle() and weapon_bloodstone_active2::Idle() and weapon_bloodstone_active3::Idle()
while WEAPON_LOWERWEAPON is true
to see if we're changing to bloodstone active 2
$player1.setLinearVelocity($player1.getLinearVelocity()+recoil);
used by double barrel shotgun
player::init() calls SetFlashHandPose and SetWeaponHandPose()
player::LowerWeapon() calls animState with "TorsoLowerWeapon"
player::RaiseWeapon() calls animState with "TorsoLowerWeapon"
also calls weapon = getWeaponEntity()
I shouldn't need to modify the player script to add a second statwatch, but I may need to modify it in order to support hand poses while dual wielding if I can't hack support in.
I'll try to look at this tonight.
So I merged your changes to look a this. It's a complete trip wielding two pistols :)!
I need to think about how to fix the hand poses without modifying the player script. In the meantime I'll start adding the second stat watch ( without any of the new screens ) - which should be pretty straightforward. I'll also look at fixing the PDA toggle - currently gets stuck in a loop when activated
Once we have the dual wielding sorted out, I'll start merging in some of the other changes I've made.
Ok, I pushed the initial implementation for dual statwatches. Currently, they are both always visible, but they are skinned independently, so we can add logic to hide one or both if we want.
I didn't have much time to test this, take a look and tell me what you think.
This commit just added the second watch, I didn't have a chance to look at anything else yet.
~~I probably simply did something stupid. I don't think it's your fault that the poses are wrong. For example, it often thinks you are holding a gun and a flashlight at the same time. I posted my code before it was really finished, but once it was working just well enough to try out.~~
BTW, new things you can do with this merged:
- Unbind the triggers from attack and bind them to something else. They will still fire the weapon if you are holding a weapon in that hand, but otherwise will do the bound action.
- Unbind the touchpad from the flashlight button and bin it to something else, it will still turn the flashlight on and off if you are holding one in that hand.
- Reach up to your helmet-mounted or armor-mounted flashlight and pull the trigger or click with your thumb to turn it on or off.
- Optionally change the grip mode
vr_gripMode
to Toggle With Drop (not recommended) to make the grip button drop whatever you are holding (when not over a holster) instead of the bound action (eg. reloading, crouching). Dropped weapons magically come back at the end of the level or when saving the game (in theory). The default and recommended grip mode is Context Sensitive Toggle.
There are other planned grip modes that aren't implemented yet, but are mentioned in the code.
- Context Sensitive Toggle (default): grip button only toggles what you are holding when over a holster or something you can grab or somewhere it makes sense to put something. The rest of the time it does the bound action. I plan that in this mode you should be able to put down (drop) whatever weapon you are holding when you press the trigger while your hand is just above a solid horizontal surface. When you are holding a physics object or item, this mode should let go/throw when you press the grip button. Press to pick up anything, press to let go of anything, but only when it makes sense.
- Context Sensitive Toggle No Surface: same as above, but you can't put weapons down on surfaces
- Toggle for weapons/items but hold for physics objects: You probably don't want to hold grip down the whole time you are holding a weapon. BUT... you may want to hold grip down to hold a physics object. So for PHYSICS OBJECTS, this mode forces you to hold down the grip button to continue holding it. Start holding grip to pick up a physics object, let go of grip to let go of a physics object. But for weapons and items (I want to be able to optionally, via a separate option, pick up items eg. health pack, pda, video disc, or key in my hand and put them in my body to use them), grip would act as a toggle like it does now.
- Toggle for weapons but hold for items/physics objects: Same as above except items work like physics objects.
- Toggle With Drop: It's no longer context sensitive. Pressing grip always either picks up, lets go, or swaps what you are holding, and never does the bound action. This allows you to drop weapons wherever and whenever you want.
- Dead and Buried: Like Oculus' shooter, you have to hold the grip button to keep holding your weapon, but if you let go of grip (outside a holster) your gun magically returns to the holster you drew it from (rather than being dropped). I haven't implemented this mode yet because I need to work out how to handle the temporary state where a holster contains two guns because you let go of a gun in a holster and haven't pressed grip again yet to pick up the old weapon that was in the holster before and your hand hasn't left the holster yet.
- Hold to hold: You have to constantly hold the grip button to keep holding your weapon, or anything else. Start holding grip to pick up anything, let go of grip to let go of anything. Letting go of a weapon will drop it rather than magically returning it to your holster. I haven't implemented this yet for the same reason as above.
- Hold to hold, squeeze for action: The same as above, except when you have an analog grip trigger or force sensor you can trigger the action bound to that trigger by squeezing harder.
I haven't added a grip mode based on picking things up with the trigger button instead of the grip button yet. But thinking about it now, I should add ones like this:
- Pick Up With Trigger: pull the trigger (not grip) to pick up anything when over something you can pick up. If over somewhere you can put something down, pull the trigger to put it down. If holding a weapon, pull the trigger to fire. If holding a physics object, pull the trigger to let go/throw. If holding a flashlight or nothing, pull the trigger for the bound action.
- Pick up with Trigger, no surface: Same as above, except you can't put down weapons on a table, etc.
- Press Trigger for weapons/items, hold Trigger for physics: Like the equivalent mode with the grip button, except for the trigger.
- Press Trigger for weapons, hold Trigger for items/physics: Like the equivalent mode with the grip button, except for the trigger.
- Hold Trigger to hold, squeeze to fire: like with the grip button, but holding (or maybe just touching is enough to keep holding after initially pressing?) the trigger a little will hold something, pressing it fully will fire the weapon, and completely letting go will drop it.
I think that covers every possible way a user might want to control picking up and letting go of things, and should keep everyone happy. The guys from Tested commented that they liked all the flexible options in our mod better than they liked Doom VFR. So I feel like we should continue having options like this to account for all preferences. It might be better to make the default grip mode be hold-for-physics, but we'll have to test that out when it's implemented and see what feels better.
Note that dropping weapons isn't very useful, except when you need a free hand for something so you put the gun down on a nearby table, do whatever you want with your hand, and then pick up the weapon again, like you might in real life. Or you put your weapons down and pick them up in different hands. Or, perhaps some people might really dislike a weapon, and not want it in the weapon rotation? But I felt like it should be possible for realism. I don't want them to permanently lose the weapon if they drop a weapon and forget to go back and pick it up, or they drop it by accident, so any weapons that you have found come back at the end of the level even if you drop them.
I also added an option vr_mustEmptyHands
which forces you to manually empty your hand before you can do anything else with your hand. This is just for people who like more physicality and realism in their hand interactions and less like a computer game. It's partly implemented.
And I added vr_contextSensitive
which you can disable to completely disable all context-sensitive controls and have every button only do whatever is bound to it. Disabling it prevents you from being able to grab anything, so it's not recommended.
vr_weaponCycleMode
, vr_pickUpMode
, vr_doubleClickGrip
, vr_reloadMode
, and vr_voiceMicLocation
are currently just unimplemented ideas.
vr_pickUpMode
is my idea for how to deal with items, based on how much realism and physicality vs. how much gaminess you want in picking up items and collecting/activating them. Currently, you have to walk over them like a computer game, but I also want options for walk/touch, touch, press the grip button on it, hold it in your hand and put it on your body, hold it in your hand and put it wherever it would logically go (in your weapon, in your PDA, in your backpack, etc.), or hold it in your hand and press trigger.
vr_voiceMicLocation
is my idea for push-to-talk without (optionally) using a (scarce and precious) button, and with more realism. Instead, you hold something up to your mouth (or perhaps touch your ear) for voice commands to be recognized. Using proximity to the mouth could also help with deciding which hand a weapon voice command would affect. Maybe also have an option for your hand needing to be in a holster for the weapon voice command to work (ie, reach behind your back and say "BFG 9000" to specifically draw that weapon)
~~vr_dualWield
isn't implemented yet, so you can't disable dual wielding yet. Sorry.~~
Man, I'm looking at the player script, and I'm not quite sure how I want to handle this. The script is only written to track one fire animation start/stop, and to always play one of the flashlight poses on the hand not firing the weapon. ( Flashlight poses are empty hand, flash on or flash off )
I can either:
-
Modify the script, and potentially(probably) nerf save games
-
I might be able to leave the variables for the script alone, but comment out the calls to set the animation poses for the weapons/flashlight. Could then set the poses directly from code, but this would be pretty freaking hacky.
I'll look at this some more, but I'm going to be out of town for a few days, and won't be able to work on this until I return.
I've been working on fixing the infinite PDA loop, and fixing loading saved games (I forgot to initialize the other weapon). But I'll be away from the computer today. I'm going to be a bit hacky in the Event_SelectWeapon function because it's only called when you're using the PDA or the Artifact and only to switch back to the previous weapon (although the PDA can modify the "previous weapon" if you use a controller to choose equip). I think I will have to rename your right hand stat watch assets back to their original names or saved games won't be happy.
This save game system makes me angry :)
The more I think about it, the more I think it may be time to make a clean break from old save games - there is going to be so much hacked junk trying to work around it. I'll mull it over some more.
(Edit mull not pull )
Too many people have progress saved that they don't want to lose, imho. I don't think we can just give up completely on loading old saved games. BTW, I made the mistake of trying to load one of my 32 bit saves on 64 bit. It doesn’t like that. Lol. Maybe we should think about saving in a new format that will be easier in future even if we still load the old format though. 🤔
OK, I fixed the hand poses, although the non-weapon hand is still holding the weapon at the wrong place/angle compared to the hand. But the poses are fine. And I fixed a bunch of other bugs, and I added some menus.
Nice!! I'm at a conference until wed afternoon, can look at this then if you don't get to it first. I don't think fixing it should be too hard. Once that's resolved I'll start bringing over the other hand interaction changes and whatever else I haven't committed yet. Can't wait to try this out when I get back! I'm trying to remember what else I haven't committed - I know there are a few improved models, some work to the FOV reduction comfort mode, added motion blurring during turning, some additional cutscene options, basic melee attacking. I haven't tested actual multiplayer combat but I fixed it far enough that you can wander around a MP level and shoot the walls. Can't remember what else, will have to check when I get home.
Wait... you got multiplayer working? I assumed that was completely broken. Well done.
One thing I've mostly done but haven't committed is unlockable bonus characters. It allows you to play the main Doom 3 campaign as the character from RoE, with a grabber, artifact, and double-barrel shotgun. Or you can play RoE as the Doom Marine from the main campaign, with a chainsaw and a soul cube. And the same with Lost Mission. Or you can play as Campbell, with a BFG 9000, or Sergeant Kelly with a double-barrel shotgun.
Don't get too excited about multiplayer, I'm not sure how broken it is. I was curious what the state of it was, so tried to start a local game which crashed immediately. I fixed the crashes,. which let me start a local game, but weapon aiming and laser sight were broken, so I fixed those also. So I could wander around a level alone and shoot the walls. I have no idea how or if the networking is working yet, haven't had a chance to test.
Have ya'll played with Sairento's weapon management? I like how each area of the body is a zone to switch to a weapon instead of swapping a holstered weapon. They add grab zones on hips, upper back, lower back, and chest. Grenades on chest! -And you don't have to put away a weapon first. Put your favorite 5 on the body, grab a weapon, then scroll up or down to get to other weapons nearby in scroll order. Also in Sairento reloading has a flick up or flick down motion which would save a button. Just a thought. Ya'll are making awesome progress lately!
I would like to implement something like this when the rest of these changes are merged.
I've started merging my changes - there is some tweaking involved as Carl and I had both added a bunch of hand control related changes in slightly different ways. I'm making progress though!
I was planning on adding more holsters in different positions, such as the chest. One isn't enough. And you're right that we need reloading gestures.