Geneva Lost Weekly Reflection – Week 6, 2016

Artifact: Camera

In our game we wanted the camera to be more than just a static viewport. For us, the camera is an important element to convey information to the player.

Firstly, we wanted the camera to gravitate towards the reticle, giving more vision towards the direction you’re looking at. This in itself is simple enough to implement. A simple mathematical formula for the camera position would be

b × f

where a is the position of the player, b is the position of the reticle in relation to the middle of the screen and f is the focus multiplier.

However, we wanted to compensate the viewing distance lost in the y-direction of the screen due to a non 1:1 aspect ratio. To compensate we used the absolute dot product of a heading vector pointing straight up and the heading vector of the reticle relative to the middle of the screen and multiplied that with the difference of the width and height of the screen, which gave us the following formula:

× (f × (1 + |c · (0, 1)| × (width / height – 1)))

where a is the position of the player, b is the position of the reticle in relation to the middle of the screen, c is the unit vector of b and f is the focus multiplier.

cameraRef

Ref. A & B – The camera offset from the player.

However, this solution is problematic. When aiming towards the corners the offset is greater than when aiming directly up or down, defeating the purpose of the mechanic.

One solution would be to limit the mouse position to be position within a set radius from the player. This is a solution we’re still considering viable and may be what we eventually decide on.

Another solution, however, which is currently implemented in the game uses the mathematical formula

x’ = ax + bx × f × height / width

y’ = ay + by × f × width / height

where is the position of the player, b is the position of the reticle relative to the center of the screen and f is the focus multiplier.

AimMockup

However, this solution makes the aim not go over the center of the screen. It also makes the mathematical formula to rotate the player towards the aim somewhat more complex. Neither of these are big issues or are hard to solve, so this is the solution we’re settling on for now.

There are a few other features planned for future iterations of the camera.

We want the bullet spread to correlate to the camera offset, meaning that the further away from you you aim, the more spread your attacks will have.

We’ve planned for simple things to help with the immersion of the game, such as camera shake and similar features.

I want to mention one planned feature in particular. We’re all in agreement that we want a minimalistic HUD and that as much information as possible should be conveyed through the game itself. Therefore instead of having a health meter we decided that the camera, together with other mechanics, should convey the current level of health.

What we’ve decided that the lower health you have the more zoomed in the camera should be. Colors also get slowly desaturated. Other mechanics outside of the camera that will help this effect include time slowing down and audio changing.

 

2 thoughts on “Geneva Lost Weekly Reflection – Week 6, 2016

  1. Hi.
    The topic on cameras in games is really interesting and I found your post to be a good read so well done.
    I found that the camera was hard to work with and could not simply find an elegant solution for the movement of it but you seem to know what you are talking about and obviously have coded for a long time.
    What you described here was really informational and gave a clear view into how you had a problem and how you went about to fix it.
    It was also fun to see what other plans you have in store for the camera and also the game. I really liked the idea of not having a health bar and instead use the colours and camera zoom to indicate the amount of health the player has left.
    That was a neat idea.
    And also camera shake is a great idea but should be used with caution but that’s my opinion.
    I really don’t know what else to say because of my lack of programming knowledge but a great post, helped me get a good grip on what your team wants to do with the camera and I’m looking forward to read more.

    Like

Leave a comment