Jump to content
  • Advertisement
Sign in to follow this  
coden4fun

An online game using SDL_net HOW?

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

Hi, I've been researching on how to make my game even if I have to rewrite it an online game. No no no I'm not one of these programmers who think I can make an MMO this is just a Tank game that I would like to have as an online game with chat if possible with a possible of 8 players and no more. But I have many questions. - First could SDL_net be used to make my game go online from the Wiki I read yes. - How does it work, and will it cost me, and how much? - This wiki http://gpwiki.org/index.php/SDL:Tutorial:Using_SDL_net#Code_2 showed me how to write a UDP client, server class, but it didn't really show, nor explain how I can create the game objects needed for the game to begin like how do you program finding how many players are here, max players, have each person create a tank, and go into the arena? - Basically how do you start designing a game for a network it must be really different than a single player game. I would like this to be my project for the month, or a couple I would like to be really good in networking like I am with most of the library in SDL, and Allegro. I've never done any type of code that uses networks, so this will be a new challenge for me, but I like challenges. Please give me some resources, so I can spend much time reading, and coding and get an understanding of how to code a network game. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by coden4fun
- First could SDL_net be used to make my game go online from the Wiki I read yes.


Libraries like SDL_net don't make your game 'go online'. They make games capable of working across a network. To be 'online' usually implies that you run or control the game on a central server - to do that, you will need such a server, which is a bit more complicated. However, if you just want 2 or more people with the same program to be able to connect to each other and play, then yes, SDL_net will help you with that.

Quote:
- How does it work


It's not something that can easily be answered in a single forum post - networking is not exactly difficult but it's also not trivial either. Basically the separate computers send messages to each other on a regular basis to keep the game in sync across each machine. Typically you designate one of them as being the definitive one that makes the decisions and which broadcasts that data to the others.

Quote:
and will it cost me, and how much?


SDL_net is free (but observe the license). A central server, if you need one (which you probably do not) will be expensive. If you just let individual players host their own servers locally, that's also free.

Quote:
- This wiki http://gpwiki.org/index.php/SDL:Tutorial:Using_SDL_net#Code_2

showed me how to write a UDP client, server class, but it didn't really show, nor explain how I can create the game objects needed for the game to begin like how do you program finding how many players are here, max players, have each person create a tank, and go into the arena?

- Basically how do you start designing a game for a network it must be really different than a single player game.


Again, this is not a simple subject, and there is probably a book on it out there somewhere! You need to think about what information will be needed in order for one PC to communicate changes to the other one. Once you know what information needs to be sent, you can design classes or structs to hold that data, and you can decide when it needs to be sent and what to do when it arrives. It's possibly best if you start off with a simple 2 player game to begin with and completely ignore any sort of lobby idea until you've mastered simply keeping 2 computers in sync.

Quote:
Please give me some resources, so I can spend much time reading, and coding and get an understanding of how to code a network game.


You definitely need to read the Forum FAQ for the Multiplayer and Networking forum - SDL_net is just a library that gives you network access via SDL, rather than a complete solution for networking your game. You still have to do all that hard work yourself and the approach to that will come from the aforementioned forum.

Share this post


Link to post
Share on other sites
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!