Jump to content
  • Advertisement
Sign in to follow this  
ZeRaW

Small Quest.

This topic is 4831 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

well I am trying to make a network layer for an engine i am working on. I am following the Directplay model , of course it is not the same but a bit same concept with less fucntions. for now, I would like to know If i am doing something wrong. here is what i have done so far: a host can create a session and set parameters like if it is P2p or ClientServer and set Session Data and anme and other stuff. now programming what i have done is create a new thread and inside it i create a socket which will listen to all incoming connections, the data received from this socket is always type casted to a message struct in which i know what type the message is and stuff. of course the player specifies a message handler function pointer so when a message is received it will be handled internally then sent to the user (Same as DPlay i presume). and in the main thread the user can continue creating the game and don't worry about the network part except in the message handler. a user which wants to join will specify the port and ip or will just try to see which sessions are online (broadcasting a network message which reply is sent to client message handler). now once connected the user will also have a listen port to get info from the server. a message ais transmitted via a function called SendMessage which can take any type of data. of course once a player has joined a game it will be assigned an ID. all of this has been implemented (even some serialization of data) for example when you connect to a host you send your user info which contains a *void this can be whatever and set by a user to send specific info about a player to the host. I made it serialized , of course for now the serialization is not general but i am working on it. I would like an expert opinion if there might be a better way of handling this layer. Thank you.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!