Update #9: procedural camera action
Do you notice something different from previous camera action? And how removed the camera can be from the ship´s orientation and position? Not too much until I mentioned it? That would be ideal. Did you get a more dynamic feeling from this gif?
Coming from filmmaking, which relies on predictive camera action most of the time, procedural camera action always looks a bit off.
[rant mode]The key is getting the camera guessing right where do you want it to be next, doing said guesses slow enough so you can cope with them without losing your orientation, and not too slow either or you´ll be frustrated by not being able to see something on screen, while also applying limitations for the sake of gameplay (e.g. you´d like to always see the whole field, but that wouldn´t be any fun).
Since it´s impossible for the camera to "guess" the exactly ideal view, the logic should also be simple enough to allow the player to predict where the camera will be next.
After spending another bunch of hours on new rotation methods (then discarded, again...) and different behaviours on camera positioning (new ones applied!), those are the new rules and the reasoning behind them:
Position:1.velocity based offset.-Given the velocity vector of the player, scale and clamp it.
When you drive a car, you naturally look further ahead when on a highway than on a normal street.
-Project the normalized velocity vector onto the "currently looking direction" vector.
When on that highway, if you look behind you, you´re still aware of what´s going in front of you, but not that further away (or with the same attention) as when you look in front of you.
-Smooth it temporally.
Your eyes move with your eye´s muscles, they take some time to get from point A to B, this mimicks it.
2.Offset along the "currently looking direction" vector.You´re always paying more attention to whatever´s in the center of your field of vision, in this case that would be what´s in the front of your ship.
Add 1, 2, and ship position together, and that´s it.
Field of view:-Add to the standard ship´s FOV a small amount scaled by the velocity difference since last timestep. This mimicks the feeling of being pulled backwards you get when accelerating on real life by literally pulling the camera backwards when accelerating.
Rotation:1.If the ship´s angular velocity is bigger than a threshold, apply ship´s rotation directly.Since high speed rotation in real life is disorientating, let it be!
2.Else, apply a carefully crafted function returning the magnitude of the rotation based on the angular velocity.
Since you don´t have your head aligned with the front wheel of your bike when it´s turning, you tend to keep look forward if you´re just adjusting your course, or, if on a curve, you look first to the side and then turn. Since I can´t predict you´ll turn, I try to compensate with a higher rate of rotation when you are actually turning. Getting that ramp aligned with the game´s mood meant a lot of iterations!
Losing the center lock on the player makes the camera less predictable by the player (which is a BAD thing), but affects gameplay in a nice way:
-now you can´t stay safely just-out-of view from someone else, since that distance is now changing all the time.
-the new "looking ahead" camera allows for a more aggressive gameplay, since you now know in advance what you´ll ram onto if you keep throttling,
- high speed chases between players happen more frequently.
[/rant mode off]Hmm... big wall of text happened!
If this was interesting for someone it´d be nice to know, mostly to prevent myself from further ones if it wasn´t
. Anyways, here´s a spoiler on what´s hopefully coming on the next update!
Thanks everyone!