• Advertisement

Archived

This topic is now archived and is closed to further replies.

General Game Questions

This topic is 6563 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am writing a multiplayer MUD. I''m learning Win32, Winsock and Directx as I go along, so my question may be answered simlpy, but here goes anyways.. How am I going to setup my game so that everything runs smoothly? I mean, take the client end for example, it''s going to have to send out information via winsock, directx will have to draw various stuff and do it''s thing, and windows will be handling messages.. Can this all happen without the game really bogging down? I mean.. what if it should be drawing something while it''s sending/recieving data, or maybe the users decides to click the mouse 50 times/second and the window is just recieving mouse-related messages? How would I set all this up so one thing doesn''t interfere too much with another? Thanks for any help in my confusing situation.. Sincerely, Tim Elliott

Share this post


Link to post
Share on other sites
Advertisement

The client should have a standard loop just like
any other game.

while( !end_of_game )
{
handle_user_input
send_network_output
handle_network_input
draw_next_frame
}

Or something like that. In a client-server model,
the handling of network input can replace (or work
along with) the point in your loop where all of
your game objects "think". If you receive a network
message while you are just starting to draw a frame,
don''t do anything with until you finish drawing the
frame and get back around to network input part of
your loop. And since you''re using DirectX, you should
use DirectInput''s buffered mode to handle mouse and
keyboard (and joystick if you need) for much more
efficient handling than windows messages.

Share this post


Link to post
Share on other sites

  • Advertisement