Gamasutra: The Art & Business of Making Gamesspacer
View All     RSS
September 19, 2017
arrowPress Releases






If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 

How the camera works in Sol

by Javier Degirolmo on 05/21/15 02:10:00 pm

1 comments Share on Twitter    RSS

The following blog post, unless otherwise noted, was written by a member of Gamasutra’s community.
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.

 

After reading the recent article on cameras in sidescrolling games I thought I may as well share how the camera works in Sol. I'm going to use some terms from that article so consider reading it first if you haven't already.

First of all, some remarks:

  • Screen coordinates are given relative to the center of the screen (not the top left corner) because of the way resolution handling works for different aspect ratios. Horizontal coordinates increment to the right, vertical coordinates increment downwards.
  • The "player origin" is 16 pixels above the ground vertically (the character is 40 pixels high, for context).

The camera works differently depending on whether zooming is enabled or not, so I'm going to describe both modes separately.

Normal mode

The game simply uses a normal camera window in this mode. The margins are -8 to 8 horizontally, and -32 to -16 vertically.

When the camera shakes (i.e. a quake effect), a vertical offset is added to its current position. This offset is calculated the moment rendering happens and is not stored, i.e. the shaking isn't accounted for the camera window.

Zoomed mode

When zooming is enabled the camera behaves completely different to account for the smaller viewport.

For starters there isn't a camera window at all, it just aims for the player position directly. Then it applies a horizontal offset, to give some extra room to see forwards. This offset changes depending on the direction the player is facing, when the player turns around the offset is shifted until it reaches its new intended position. Pressing up or down also applies a vertical offset in a similar way, allowing the player to look more vertically.

The third boss (the helicopter one) is problematic, since the helicopter would end up completely off-screen using this behavior. What happens then is that during the fight against that boss another vertical offset is applied, which puts the camera right in the middle point between the helicopter's height and the previously computed camera position. This gives enough room to see the helicopter.

Finally, shaking is disabled unconditionally when zooming is enabled, since the effect is too strong and would severely get in the way.


Related Jobs

Sanzaru Games Inc.
Sanzaru Games Inc. — Foster City, California, United States
[09.18.17]

Environment Artist
Skydance Interactive
Skydance Interactive — Marina Del Rey, California, United States
[09.15.17]

Narrative Designer
Infinity Ward / Activision
Infinity Ward / Activision — woodland hills, California, United States
[09.14.17]

Senior Visual Effects Artist
Pixelberry Studios
Pixelberry Studios — Mountain View, California, United States
[09.13.17]

Senior Game Writer





Loading Comments

loader image