I want to know how I would incorporate a split screen function in a small RPG my brother wants to make. (He's 4 years younger than me and he wants to know how to program.) Can you please help? Some pseudo code or an example would be nice. Thanks in advance.
For your drawing functions, make it so that you have to specify a target surface. After that, have 2 SDL_Surface objects, 1 for each side of the screen. Use your Draw function twice and specify the separate surfaces. Draw each surface on its respective side of the screen.
You need to separate two client areas to draw on as surfaces.
In such a case you want exactly half of the width of the window per client area.
This is seen in a large portion of multiplayer games, like Mario Kart, Need For Speed, etc.
Once you've set up two distinct client areas of the screen, draw to them as if they were on their own full window, just within half the portion of the screen.
The splicing of the screen in to two client areas is the least complicated part to solve in a game development, or any game in general, since simple math and division of the screen's surface in to two or more portions is simple in nature compared to a game and all of its assets.
The players won't move out of bounds in their clipped sections because each side of the clipped regions will behave as if they were on their own screen. That is what you should focus on implementing, treating two clipped client areas of a window as if they were distinct screens.
That isn't what I mean. I get the clipping part. I'm going to have a map bigger than the screen boundries. I'm wondering if you pass where the other player is, will you be able to see their graphic. Example:
Lets say the map is 1000 by 1000 pixels. What if player1 is at 500 by 500, and player two is at 600 by 500. Would player2 be able to see Player one at his/her location through his/her's screen? Same thing with player1.
I don't know its your game you tell us... What I mean by that is that has nothing to do with the clipping that has to do with the game development in general. If you want to program it so both players can see the other players characters on their own screen you can, and involves 2 (or how many players) view ports and camera's.
Here is something that might interest you and give you some ideas. Though it involves XNA http://msdn.microsoft.com/en-us/library/bb313965(v=xnagamestudio.10).aspx
You would be drawing the exact same scene, just from different positions, so if both players were in roughly the same place they would see all the same stuff, including each other's player models (and their own in a third-person game).