Camera Panning
To create the impression of a moving camera, all the gameobjects in the scene needed to be moved, unfortunately this caused problems for objects such as moving platforms, which had targets to which they move, rather than change all these values every time the camera was moved, I decided that it would be much better if moving the camera didn’t change the position of any objects, but rather changed the positions at which they’re rendered. A game object’s render position would be their position plus the camera position.
To automatically position the camera, the camera should ideally be centred amongst all players, the best way to do this is to find the average x and y points of the player positions and position the camera at this point.
The camera zooming was handled in a similar way, as players got further apart the camera would find the most furthest distance between any two players zoom appropriately. The camera zooming added a 'camera scale' parameter to the render scale, if the camera was zoomed out the objects had to be scaled and moves to accomodate this.