Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am currently developing a game that includes a server and some clients. Currently, the server does its work based on user input then draws the image the clients should see and sends it. Unfortunately, the server's time is taken up almost exclusively by the drawing and encoding. Is there a better way for me to design this?

share|improve this question
3  
You need to provide a lot more detail in order to get useful answers. What is being drawn, what user inputs, what type of encoding, and why the server needs to do the work. –  Seth Battin Nov 1 '12 at 4:03
add comment

1 Answer

up vote 6 down vote accepted

OK, the obvious answers would be:

  1. Don't do drawing on the server. Just have the server tell the client what it needs to draw and let the client handle the actual drawing.

  2. Have the client keep track of the information it's previously received, so that the server only needs to send it a list of changes rather than sending everything again.

  3. Have the client predict (as far as possible) what will change based on the player's actions, so that the server only needs to send it any changes the client doesn't already know about (such as those caused by actions of other players).

Yeah, I know that's not very specific, but neither is your question. If there's something in particular that you'd like more detail about, you can comment or edit your question to tell us what it is.

share|improve this answer
    
#3 is not really doable, #2 only helps if I could implement #1. How could I make #1 work if there are 100s of different images that would be used in combining and the client has a very limited storage (a phone)? –  bear96 Nov 1 '12 at 2:47
1  
Why not use a sprite sheet & have the server decide which sprite to use? –  thedeadlybutter Nov 1 '12 at 3:59
1  
+1 for 'not very specific, but neither is your question'. He's right, @bear96, improve your question. –  Seth Battin Nov 1 '12 at 4:10
    
@bear96: 100s of images doesn't sound that bad, even for a phone, unless those images are huge. To minimize overhead, thedeadlybutter's suggestion of using a sprite sheet sounds like a good idea. –  Ilmari Karonen Nov 1 '12 at 14:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.