Coding - Camera Positions and Motion in the Game
In the preprocessing step of the battle the camera positions are chosen for the space battle to hopefully provide a more exciting and dynamic battle than if the user were to try and watch the action themselves by positioning the camera.
This is done as a post stage of the preprocessing step of the battle.
Once all frames of the battle (maximum is 8000) are completed the frames are then analysed by the game to generate a series of camera positions, motions and orientations that hopefully look good.
Originally the game used a static set of choices for the camera but as of an update back in October the camera is chosen from a random set of options that are generated - this means that the same battle may be shown from a variety of camera methods which means very few battles - even with the exact same parameters - will appear exactly the same.
However the method used to choose the camera angles is as follows.
Every 'n' frames of the battle the next 'm' frames of the battle (plus the preceding 'm') are analysed. A number of possible camera options are run through and then selected. First the system decides whether it wishes to watch a small ship or a big ship. It also examines whether any beams are firing (these are considered high priority for watching), whether any ships are taking lots of damage or are destroyed in the time period (these are given a high priority).
Once these calculations are performed the camera is placed at a number of different positions. After watching many viewings of different movie space battles I worked out that there are range of common shots. Some of these involve moving cameras, some of these involve static cameras, some of these involve wide shots (include as many ships as possible in the field of view), some of these involve close chase shots (include the 'target' ship and aim in a direction that includes the most amount of 'action' such as explosions and so on).
The general pseudo code for this process is as follows.
for frame = 1 to max frames step n (n = 300?)
{
pick a new camera focus for this section from the following options
{wide shot, chase fighter/bomber, chase capital/cruiser, and a few others}
analyse the play field to see which direction viewed will show the most action
decide on whether the camera is {static or dynamic}
if {dynamic camera}
{
pick a start and end position for the camera, move the camera through these positions and aim in the direction that gives the most action shots related to the type chosen (fighters,wide, capital etc)
}
}
No comments:
Post a Comment