Our project is slowly but surely becoming a reality. We’ve managed to integrate a portion of the code which various teammates wrote. These last few weeks will require a big push, but I’m looking forward to seeing it all come together.
In following suit with my previous posts, I wanted to touch on yet another fun video game concept – this time…. Screen shake!
Screen shake is another concept that helps add weight to impact. These impacts might be anything from a giant troll’s footsteps to a character landing on the ground after a lengthy fall. The feeling that the screen is physically shaking greatly contributes to the believability and power of such impacts. So, how does it work?
Sometimes also referred to as “Camera Shake”, screen shake is a concept most often implemented by manipulating the game camera. In its simplest form, it involves translating the game camera rapidly through space away from (and eventually back to) its origin. If we imagine game time in frames, we can illustrate the concept with a few key frames:
Frame 0: Camera at origin (0, 0, 0)
Frame 2: Camera moves to random position (0, 1, 0)
Frame 4: Camera moves to another random position (1, 0, 0)
Frame 6: Camera moves to another random position (0.5, 0.5, 0)
Frame 8: Camera returns to origin (0, 0, 0)
This sudden movement over a short period of time gives the effect that the screen (or more accurately, camera) is physically shaking. Now of course we can add complexity to give some interesting results. For example, completely random movement might result in several frames with relatively close positions. So we might want to enforce a minimum distance on each jump in order to get a more aggressive, uniform shake.
Additionally, since we know the camera eventually needs to return back to its starting point, we might want to make the shake fade out over time instead of jumping back suddenly. So if we were to shrink the distance which the camera can travel over time, we’ll naturally get the effect of a fading shake. These sorts of techniques allow developers to add nuance to their version of screen shake.
And that’s all she wrote. Until the next post!
Leave a Reply