My personal game project(a birds-eye view space shooter with a huge map that you explore in each mission) does just this. Basically you want to keep everything based on world values. So basically worldX and worldY are not screenX or screenY(for example sake). When drawing for each player you would simply draw the screen based on the screen size and the offset of the player's location on the actual screen.Originally Posted by enker
[pascal]ScreenX := PlayerScreenPosX + (BallX - Player[1].X);
ScreenY := PlayerScreenPosY + (BallY - Player[1].Y);
drawpixel(ScreenX, ScreenY, BallColor);[/pascal]
as an example of how you calculate the offsets. PlayerScreenPosX and PlayerScreenPosY are the location of 'your' player from the top-left of the screen. BallX and BallY are the object that your player sees and contains the world co-ordinate values. Player[1].X and Player[1].Y is you and contains world values aswell. Everything must be draw like this. The rest is just calculating everything off of world values. if you have different areas(can be ongoing while other players are in other different areas themselves) you can base each location value off of that area's 'world' offset, just obviously keep track of what area each player or object is in. A table of active areas might help out aswell. Great place to store map data if it exsits too.
Bookmarks