Where do I start?
Well I started with assignment 3 last week, which consists of making a 3D game using DirectX. I became so overwhelmed (and still am) by the task that I basically did nothing for two weeks! Sure I read about programming patterns and networking and I did dibble in some network programming.
So that’s why I have no blog post from last week. I didn’t do anything worth blogging about. So a few days ago I finally started working on the assignment.
Well I started with assignment 3 last week, which consists of making a 3D game using DirectX. I became so overwhelmed (and still am) by the task that I basically did nothing for two weeks! Sure I read about programming patterns and networking and I did dibble in some network programming.
So that’s why I have no blog post from last week. I didn’t do anything worth blogging about. So a few days ago I finally started working on the assignment.
I have made some basic server network code
and a packet managing system and I have also merged my code with the code from
our teacher Tommi.
I started out with networking because that’s hard to add when the game is already done. So my basic plan is this layout:
I started out with networking because that’s hard to add when the game is already done. So my basic plan is this layout:
So the client or player does something.
That is made into a packet of data that is stored in a queue that the packet
handler / manager take care of.
Next step
is that this is sent down to the lower network level that actual take care of
the sending and receiving data using UDP. So the packet is sent to the server
and put into a queue by the packet handler on the server side and then the
server reads and handles the data and updates the game logic and creates a new
packet and sends it back to the client or to all clients depending on the logic
inside.
As you can see in the picture above the client has its on local game logic. This
is so the player can still collide and move around in the world without
feedback from the server. This so the player don’t have to wait for half a
second if a packet is lost along the way.
When the server has handled everything and
the packet is back to the client there will be a check if the client
position/ state is different from the server’s calculations. If it is then the
client will be corrected to the server data.
Each packet is made up of a packet header
and the actual data from the client or the server depending on where it’s
created. I haven’t created the client side of the network yet so the code is
not tested but this is how a header looks like:
The reason I made a header is so I can
keep track of who created the packet. What type of packet it is. When it was
created and how big it is and if it’s an outgoing or incoming packet. I don’t
know if all this is needed but it’s a start and I’m no experienced network
programmer.
Here is a link to my code:
https://bitbucket.org/georgios_chatzoglakis/assignments/src
https://bitbucket.org/georgios_chatzoglakis/assignments/src
If you can't read it then just ask me here and I will allow you access.
No comments:
Post a Comment