User Tools

Site Tools


The Camera system in Colossal Kaiju Combat is essentially identical to the system used in Godzilla: Unleashed, which was designed to flow smoothly for 1 - 4 players. Much of the camera system is defined by a series of text values in a camera_settings.txt file, which is tuned by designers. Tuning these values needs to happen before significant detail work is done in the environments.

2-Player Parameters

Cameras have an xyz position, and an xyz target (or look-at-point). If there are only two monsters on the screen, we calculate a point exactly half-way between their centers in the XY plane - this gives the X and Y target coordinates for the camera. The Z target coordinate is an adjustable parameter in the camera_settings text file.

Calculating the position of the camera is slightly more complex. The camera is always on the YZ plane orthogonal to the line defined between the monsters, and containing the midpoint between them. To find the camera's Z coordinate We define a minimum and maximum range for the monsters, and a minimum and maximum height for the camera. When the monsters are at the minimum range (or below) the camera remains at the minimum height. Once the monsters exceed the minimum distance, and move toward the maximum monster separation, the camera moves smoothly between its defined minimum and maximum height.

To find the camera's XY coordinate (which we can think of as simply Y, if we think of the line between the monsters as the X-axis) we simply slide along at our given Z until we can see both monsters plus some amount of “overhang” on either side of the monsters. The overhang is defined in the camera_settings file.

3&4-Player Parameters

With more monsters, our calculation to find the camera XY target is more complex - but once that is done all other parameters should function similarly.

We consider each monster to be a 2D circle (with radius equal to the “camera overhang” parameter) and then find the smallest bounding circle which includes all monsters. The center of that circle is the camera XY target, and the radius of that circle is the “monster distance” parameter.

The other significant change is that, rather than allowing the camera to rotate (by creating a YZ plane relative to monster positions) we simply always place the camera due south of the camera target. This keeps screen-relative information consistent for all players. The optimal viewing direction should probably be defined per-environment, for aesthetic reasons.

Monster Tether

Inside the camera parameters we defined a “maximum range” for monsters on-screen. To ensure that this parameter is respected (and thus the camera won't need to freak out when it is exceeded) we put all monsters on an invisible “tether” which prevents them from moving further away from the camera XY target than the value defined as their “maximum range”. This is done with a simple “if X > value then X = value” statement, which is evaluated every frame.

The Tether is defined in terms of Camera XY target - so the camera systems needs to be functional before the tether can be properly implemented.

non-combat_systems/camera_and_tether_system.txt · Last modified: 2014/06/04 23:00 (external edit)