Hey everyone, im looking for some help as im starting to network the crap out of my single player 2d shooter into the world of multiplayer games. What im using and what's already done:
C++, DirectX9's sprite interface for rendering, Visual studio 2010 express as an IDE, and Enet library for networking purposes. Here is a gameplay video which im providing for relevance purposes only.
[media]http:
My questions are:
Assuming they work completely asynchronously, how would a normal game cycle look on server and client. Let's think clientside for a moment:
- commence:
- get into the real-time network event loop
- receive ( or not ) an accept-message from server to move the player one pixel by the X axis.
- update ( or not ) local player position client-side
- render
- check for player input. In case of a "W" button pressed send a packet to the server informing it that we want to move one pixel by some axis.
- repeat
Any corrections/additions or a complete overhaul possibly to that list would be appreciated.
Now let's look at the server side. We don't need rendering here so the server life cycle would look like:
- commence
- get into the real time network event loop
- receive messages asking for permission to move players
- prepare new updated game state
- broadcast the game state to everyone
- repeat
Is this how it should work?
How many packets such game (vide: the yt movie above) should send per second and what should each packet contain? a complete structure describing the game state?
What kind of server should i buy to host my game server. Estimated minimum processor tickrate, memory capacity?
And most importantly how do i organize the bloody mess caused by the constant, asynchronous flow of packets, packet losses and bandwidth rate?