Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm currently developing a networked 2D MMO-style game in which several thin clients (ran in an applet) are able to connect to a server and well, do MMO-style "things"!

Some more background on the game: First of all, I'm using UDP to make this possible. There is a scrolling background whenever a user is moving up/down/left/right constantly, and each client has its own 2D "hero avatar model" ALWAYS centered in their screen.

My problem I've been facing these last three or so days is this: I guess I don't understand the math really behind the process of updating the X,Y positions for each client, for all of the clients, because right now whenever a new client is connected, the first client that was running actually moves the latter client whenever it is "WSAD-ing".

I guess I was hoping for some insight as to how I should approach this, with a scrolling background, and the individual client is always in the middle of the screen but updating with other clients moving around the world.

Help me here: As of now I have each of the clients successfully receiving the X and Y coordinates from the server of the positions of the other hero images. I simply don't understand the logic of painting those X and Y coordinate pairs to the client (I'm using drawImage for my paint canvas). I understand the images need to be updated based on their relation to the client, but I just can't see what math needs to be done to update the X and Y pairs to make it actually look like its supposed to.

Thanks for taking the time to read my post.

share|improve this question

closed as too localized by Tetrad Jan 7 '13 at 19:59

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

I actually just realized how to do this. Keeping an "offset" counter for my x movements and y movements. – mcw Jan 7 '13 at 19:58
If you solved the problem I'm going to go ahead and close this question. – Tetrad Jan 7 '13 at 19:59

Browse other questions tagged or ask your own question.