The Camera. Arguably the most important part of any game, get the camera wrong and the game could be ruined. My camera system was heavily inspired by the Nintendo game, Super Smash Bros. I faced a few problems when I first set out to code the camera script, there is still a bug in there now! But lets ignore that.
The camera works along 2 separate axis. using the cameras local axis instead of the world axis, the camera pans across its X axis based on the average X coordinate of the players in the game. Very simple, nothing special. Just averaging some numbers.
The zoom however posed some very huge problems. Unities default 'isVisible()' function is terrible, there's no way around it, its just terrible. If a single pixel is visible EVEN from the objects shadow, so the object can be completely off the screen but if a single pixel of its shadow is being rendered, it is considered visible.
My response to tackle this problem was to attach what I call the camera tracker to each player, this is 4 small boxes with a completely transparent material attached and no shadow casts. Unity still renders these boxed and applies the material making the object invisible, but the object renderer is still enabled meaning its being drawn. If all 4 cubes are visible then the player is visible, if a single cube isn't then the player is considered not visible meaning the camera must either pan out, or the player has fell out of the playable area and is due to respawn.
The camera zooms in if it can see every player and there is a large enough gap between all players and the edges of the camera. However, there is a cap as to how far the camera can zoom in.
The camera is also responsible for the movement of the 'audience'. The audience follows the camera's x axis to travel perpendicular to it to give the feel of a game show. Whilst it seems primitive for the audience to just stick to the camera's x coordinate, we felt that this was more than enough to make the stage feel more alive without distracting too much from the game play.
Here's a game play video just in case you wanted it:
Here's a game play video just in case you wanted it: