I'm making a multiplayer 2D game where each player has an entity that they can move in any direction. This will be local only, so split screen.
Typically the player controlled entities will be in close proximity to each other. What I would like to do is have the screen get split only when players are far away - i.e. when it needs to.
See around mid way through this YouTube clip of Mari0 for an example of what I mean.
See this clip of Super Mario Bros X (sorry, it's a bit of a low FPS) for an example of horizontal & vertical splitting.
There starts off being a single viewport (or maybe 2 rendered to look like one). Then, as the players separate, either vertically or horizontally it splits the screen giving each player is own viewport.
How would I go about creating this effect? (managing the viewport merging/splitting etc)
How about extending it to work for up to 4 players? (is that even possible?)