Friday 11 April 2014

Working on Camera

Hello, I'm John, one of the programmers in this project, where I was asked to do the camera work for the prototype. The prototype that the programmers have made so far is a simple, closed room with simple boxes and circles, also known as programmer art.

When it comes to the prototype, I have created two camera modes so far: 

Multi-target camera mode

In this mode, one needs to track all of the interesting objects in the level, which includes Bo, the sheep, the wolves, and others that we may see fit. Of course, while in this camera mode, all of these objects must be within the camera's field of view, especially Bo. It is really bad camera work if you cannot see who you control, right? So we set a maximum threshold for our characters' positions relative to the camera before we zoom in or out.

However, zooming opens another cam of worms to deal with, such as:
  •  objects being so far apart that the player is too small in size to view, or 
  • the objects are too near between each other that the overall actual puzzle room cannot be seen, so the player cannot really see what's going on with the puzzle room once they do things such as pulling levers, stepping on buttons, etc. 
In order to solve this, we did three things. First, we just created a minimum and maximum orthographic size variable for our camera. This prevents the camera from zooming in or out too much. The minimum orthographic size of the camera is set such that a majority of the current level is within the camera's field of view. Meanwhile, the maximum orthographic size is set to a value where the entire room can be seen, and consumes most of the camera's field of view. When setting these values, it is important to note that these values should not be too far apart so that the zooming events do not make the player dizzy when the player's position satisfies the criteria for zooming in and zooming out.

Second, we added weights for every interesting object in the game to establish focus to those that are more important.For example, the player must have higher weight than sheep and wolves. These wights are important when calculated the weighted average of all the positions that will determine the camera's position while in this camera mode.

Finally, we created an empty GameObject that is located at the centre of the room, with its weight set higher than the rest of the objects in the level. This allows the player to see most of the puzzle room, while still having focus towards the interesting objects (Bo, sheep, wolves, etc.) 


Reveal camera mode

As of this stage of the development, we have agreed that we will introduce another camera mode whenever an object appears in the game for the first time. For example, in out prototype, I assumed that the new object being introduced at the current level we are working on is a button.

When the player touches the ground for the first time in the level, we immediately switch to this new camera mode to "reveal" the new item. So, the camera "lerps" (basically interpolates) from the current position of the camera on the way to the location of the new interesting object to be revealed. Then we stop the camera movement once it has reached its intended position to "reveal" the new item. Then, we switch back to the multi-target camera mode to resume gameplay.

Currently, the camera's position "jumps back" from the newly-revealed item in the level to the weighted centre of all of the tracked objects in the level. However, I'm also considering to "lerp" the camera back to its original position (i.e. its position prior to the switch to the "reveal" camera mode.)

I am also considering other ways to put the "reveal" camera to use. For example, when a switch has been triggered, the camera will "lerp" towards the object affected by the triggered switch, and goes back to the player a few seconds once it has finished the consequent action. However, repeatedly triggering the switch on and off may get the player feeling dizzy due to having too much camera movement. So, if I introduce this action, I will do it on the initial interaction. Therefore, the subsequent interactions with the switch will not trigger this camera mode to avoid player dizziness and confusion.

No comments:

Post a Comment