Codes4Fun / RBDOOM-3-BFG

Doom 3 BFG Edition with soft shadows, cleaned up source, Linux and 64 bit Support
GNU General Public License v3.0
182 stars 11 forks source link

Forced movement of player perspective #4

Closed kickymcassington closed 7 years ago

kickymcassington commented 7 years ago

This may be beyond what can be easily done for the mod but there are a few rules of VR that get broken by the doom3 vr mod.

The problems as i see them are the game moves your vision without you in control in a few different ways that make me more nauseous than games like Onward. First is the obvious, cutscenes are awful and pretty much need to be skipped as they both warp perspective and move your viewpoint (first time it happened i nearly fell over thinking i'd lost tracking). If the player could just be placed in the scene minus camera movements that might be a good solution.

2nd big issue i noticed was there is a screen shaking effect i've seen at least during one demonic invasion that really did a number on me. If any screenshake could be removed that would help a lot.

The last major problem is when you clip into a wall or object instead of the game fading to black until you clip out it moves your viewpoint away from the clipped object to nauseating effect. A solution is either to fade to black as mentioned until the clip is fixed by the player or to mini teleport the player back instantly rather than a slow push, this is far less nauseating and i've seen it work well in other games.

I think if those issues were fixed i'd be able to handle a lot more time in vr :)

Codes4Fun commented 7 years ago

If the player could just be placed in the scene minus camera movements that might be a good solution.

That is a pretty big change, not just in code but in otherways. The solution I was going to try is to make cinematics into a kind 3d movie, with a border. Right now cinematics are also completely broken because you can see they have missing data, character legs not animating or deformed, characters walking through rails and walls, etc, there isn't really a good solution for those problems and it would probably be better to just hide them behind a border. Basically it would make you feel like you are watching a 3d tv.

2nd big issue i noticed was there is a screen shaking effect i've seen at least during one demonic invasion that really did a number on me. If any screenshake could be removed that would help a lot.

Can you be more specific in how I can reproduce this? I've fixed a lot of aweful shaking effects in the past, and there is a console command vr_knockbackScale that if you set to 0 will get rid of all sliding knockbacks, but otherwise I am not sure what else could be shaking the camera without having a way of reproducing the issue.

The last major problem is when you clip into a wall or object instead of the game fading to black until you clip out it moves your viewpoint away from the clipped object to nauseating effect.

You are probably stating this the wrong way, but it doesn't actually move your viewport at all, it prevents your viewport from moving through walls, if you are leaning into a wall it looks like your feet have slid backwards without the sensation of your feet sliding or the force of the wall on your head.

But yeah, fading would be something I would look into, as well as allowing a player to get closer to walls/objects and being able to lean over tablets, etc. Those are important.

kickymcassington commented 7 years ago

1) Your solution is much better, i like the idea of a 3d movie, they look great in something like bigscreen. That also keeps the atmosphere and feel a lot closer to how they were intended to be viewed im sure.

2) I only noticed this shaking once before i quickly felt overwhelmed and quit out to rest and recover :) Maybe it was a holdover from the end of a cutscene still and i think it was when i had control but the flaming skulls were showing up. I'll play some more to let you know if this was more than just me overreacting. I also missed the vr_knockbackScale setting thank you for pointing that out i will make sure i've enabled that next time and report back.

3) Yeah i think i get what you're saying and you must be right. So if i understand correctly when i move my head into a wall instead of pushing pack as i push forward my view is stationary while my position in game is moved back to make up for my movement. This has the effect (At least on me) of feeling a disconnect between my movements and the in game perspective. From my point of view my head should be moving but the game keeps it stationary and i get more sick then i would if my view moved as i naturally expected. Does this make some more sense?

Codes4Fun commented 7 years ago

So if i understand correctly when i move my head into a wall instead of pushing pack as i push forward my view is stationary while my position in game is moved back to make up for my movement.

Right now, I don't predict where your body is at, so your view location is the location of your body, this means if you lean forward the game thinks you have moved forward. You can test this all out by looking in the mirrors in bathrooms and try leaning side ways into a bathroom stall, you will basically see your character stopped from moving, not pushed back.

Either way it does become out of sync with reality or more specifically reality has become out of sync with it. Technically you should be expecting to bump your head against the wall :), and anything else is sort of a work around for us being unable to do that and to prevent you from getting motion sickness.

311-code commented 7 years ago

Just tried your mod, pretty amazing stuff! I like how the entire movement scheme works and hope more titles do it like this! The only thing I would recommend is to lower the default movement speed to about half of what it is now by default. It's a bit too fast going from 0 to full speed. If it breaks the game later I say maybe add an option somewhere to add it back to default speed for the more hardcore users.

That's all I got really, besides maybe zooming cutscenes out to a big 2D screen only when there is camera panning movement in the cut scene. Overall I kind of like how they work now, just not in shots when camera pans.

ecaginicolau commented 7 years ago

Just a little note to let you know that I like how the #3 is handled actually. I beleive most of us do like it, there are not many complains.

sc0rch commented 7 years ago

Sorry for my English. The most hard parts of the game is where you need to crouch and move through the vents or other stuff. Game is moving your camera vision and it is very easy to loose orientation in space and even fall to the floor. And of course these camera movements are causing nausea very fast.

DiThi commented 7 years ago

I think the solution is to dislodge the position of the camera and the body. Allow the camera to move freely and only move the body to match the camera. When using the gamepad, one can move both the camera and body at the same time, and have the body move itself to the camera after the fact.

It would be easy to fade by just having a maximum horizontal distance between camera and body.

calibban commented 7 years ago

With your solution Dithi, you lose the roomscale aspect. the problem is the boundbox is too far from the mesh.

ecaginicolau commented 7 years ago

I didn't notice any difference when crouching. Did I miss something? Yes maybe decrease a little the collision box around the player if possible, other than that it's working perfectly.

DiThi commented 7 years ago

@calibban It wouldn't lose roomscale. By "body" I mean "body with physics including head physics". When you're not using artificial movement, the body would be following the camera as close as possible, and it would only fade out when the distance between both is too big.

ecaginicolau commented 7 years ago

non linear space is the futur of VR. It's the best way to avoid any clipping through walls & objects More and more games are including this behaviour, it's the most logical & practical solution.

In doom3 you have a bigger issue when clipping though wall : you can see very far away and things get very laggy.

DiThi commented 7 years ago

@ecaginicolau Can you explain or show examples of what you mean with "non linear space"?

ecaginicolau commented 7 years ago

The way collision is handled in doom3 VR is an example of non linear space, the roomscale space & the game space doesn't match 1:1 It can also work the otherway around, for example someone can walk "straight" in VR while turning slightly in in room space.

Nagorak commented 7 years ago

The view push back is way too aggressive. I'd recommend toning down the radius a lot. I'd even err on letting people clip inside objects a little bit, rather than pushing back aggressively like it is right now. As it currently stands, we can't get a very close look at any objects. On top of that, when trying to get past a tight space, sometimes it's tricky with the push back effect being so large.

zaneFlux commented 7 years ago

Attempting to look over a railing did me in motion sickness wise, however its still amazing; "I'M IN DOOM!" :D

Codes4Fun commented 7 years ago

In regards to camera shaking, someone else pointed out how I can reproduce it, and I have a fix for it that will probably go out sometime after thanks giving: https://github.com/Codes4Fun/RBDOOM-3-BFG/issues/25

In the future consider separating issues out so that it is easier for other users to see that an issue has already been submitted and won't create duplicate issues, and also make it easier for me to track issues separately.

kickymcassington commented 7 years ago

Great news about the incoming screenshake fix, and yeah for sure, next time i will separate issues to make them easier to track. Thanks again!

veryjos commented 7 years ago

Penumbra: VR has a hueristic to deal with leaning over ledges/tables that is pretty damn robust (as in people aren't even aware there's any strange trickery going on), especially considering you lean over stuff all the time in Penumbra. I'll detail it out so someone can implement it, yeah?

Basically, it works by decoupling the body from the head when the head enters an area the body can't go, but still interacts with the game world normally (doesn't teleport, can't go through walls, etc). It's good for retrofitting into games that weren't originally designed for VR for that reason.

Here's the gist of the hueristic in some psuedocode:

  1. If the player's camera position is too far from the character body (some arbitrary value), teleport the player's camera to the body.

  2. Move the player's camera position by the delta of the Vive's reported position, always. Set the vertical component absolutely, offset from the body's foot position.

  3. Move the body on the vertical axes towards the player's camera position using the game's normal physics stepping routine for the player. Cap the delta to some epsilon value to prevent odd interactions. Increase the step-up value the further away the player is from the body (this makes it so stepping up doesn't judder your camera vertically unless the player really intends to get on top of something).

  4. Smooth the camera's vertical offset over the last few frames.

Now, this works pretty well on it's own for leaning over stuff. To add trackpad movement to this, do as follows:

  1. Store the player's current position.

  2. Do a normal physics step for the player with the velocity set to the trackpad values.

  3. Get the resultant position, find the horizontal delta between the old position.

  4. Check if applying the horizontal delta to the camera's position reduces the horizontal distance between the camera and the body. If it does, apply the delta to the camera position. (This is for a weird edge case where a physics system could cause horizontal jitter, for instance if you're wedging yourself in a complex corner and jittering back and forth. The jitter would throw the camera off into space if you didn't do this).

  5. Any other movement applied anywhere else outside of the player's roomscale movement should just be applied with the same hueristic as in step 7.

This is the hueristic I use in Penumbra: VR and other retrofitted VR games.

Codes4Fun commented 7 years ago

Thanks for sharing that!

If the player's camera position is too far from the character body (some arbitrary value), teleport the player's camera to the body.

This is what Onward does, and also does it as a response if your head penetrates too long into 3D objects (sand bags, etc), but I don't like it as a final solution because if I am hiding in cover and I want to push up as close as I can behind something, I could accidentally be teleported out into the open (out of cover), and if I am near my chaperone boundaries I may not be able to go back into cover without bumping into things in real life.

I'd much rather allow you to push up against things, to maximize cover without getting teleported out of cover, and I think the way I can allow people to do that, is to implement a blink (temporarily fade the screen), to avoid the visual disorientation.

The messed up thing is right now, Doom has a very wide bound, elbow to elbow about 32 inches | 81 cm, this makes it hard to walk up and lean over railing and desks, even if I let you offset your head from the body. I tried artificially shrinking it but somethings were not liking it. There was an assertion failure with guns for example, so I need to look at why it was failing, I think it tries to prevent you from penetrating walls and shooting through walls so it does a test to make sure the projectile is coming from inside your bounds (which obviously don't penetrate physics). In other VR games I've been testing, guns have their own physics and you can't penetrated them through other objects.

So in more of a final solution I think i need to look at having separate physics for arms and the head, and for damage, but I may look at other more interim solutions, and what you have here is useful too know.

veryjos commented 7 years ago

You wouldn't get teleported out of cover with this solution, give Penumbra: VR a try and see how it feels when pressing up on things. It's really a pretty decent solution, doesn't matter how large the player's hitbox is or anything. You might be able to force a teleport intentionally if you tried, but in a normal playthrough everything works fine. If I didn't explain the hueristic, I really doubt you even would have noticed it! In Penumbra, this distance is set to about the player's radius * 4, so it'd be pretty difficult to trigger a teleport by standing behind cover.

I agree that redoing all the physics would be nice, but at the end of the day you're going to have to account for 23942839 edge cases because of game logic you didn't write, and it's just not worth it. Something hueristic-based is probably the best way to deliver value quickly and robustly.

Codes4Fun commented 7 years ago

I've implemented something in the latest release, I'm sure if it will exactly satisfy everything that everyone wants, but it allows you to move closer to walls, look over railing, desks, put your head between pipes.