General Game Questions

Started by
0 comments, last by Demitri 24 years, 2 months ago
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
-Tim Elliot (Demitri)
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.

This topic is closed to new replies.

Advertisement