Where can i learn sld_net or just networking for video games

Have you looked here Game Programming Wiki - GPWiki everything you need is there really there. If you don’t understand that then you should look into BSD Sockets for linux/mac and Winsock if you are on a windows machine, and just increase your knowledge about sockets. I haven’t used SDL_net but I have done BSD Sockets and Winsock there actually pretty similar mostly the initialization is different, and even after looking at SDL_net its pretty similar. Another thing is that these example are between 1 client and 1 server so if you wanted to do a game that multiple clients connect, then you would have to use some multithreading to accomplish this, and also program a server separately and give it the smarts to control your game. But start with the 1 client connecting to the server will be easiest for now until you fully understand sockets. Then you also need to think about how you want to send the data, typically in an online game you will want to
use a UDP connection since it does no error checking and won’t lag out the game. TCP connections would be for something like chat programs where you don’t want to lose any information and does error checking so if you lose a packet it will know and send it again.

yuvadius wrote:> no not a mmo.i just want at first to make a very simple game online.

for example i might be making pacman online,i dont know what yet.
so i just want to learn some networking and i didn’t find any good source for it.

You really need to read beej’s guide to network
programminghttp://beej.us/guide/bgnet/ -
this does not teach you how to use SDL_Net, but it does teach you a lot
about network theory and what SDL_Net does in the background. Now, go
tread that, then read the rest of this post.

There are two basic models for network programs for games, the
authoritative server, and the authoritative client.

Authoritative Server:

  • client sends input data (similar data to keystrokes), waits for server
    for processing
  • server responds with state information (position/angle of other
    players, messages, general server states)

Authoritative Client:

  • client does processing locally, sends state to server
  • server response with messages and general server states, may pass
    client data to other clients as input data

Authoritative client is faster for the client, but makes it easy for a
client to exploit a server and cheat. Authoritative server is slower, but
more secure. Typically, bigger games use an authoritative server with
client side prediction. That means that while the player is waiting for
state information from the server, it does it’s own local processing, then
if the server says differently, the client corrects itself.

But really, read beej’s guide. It’s not as boring as it might sound, it’s
actually one of the most enjoyable programming-based article/tutorial I’ve
ever read to date.

I don’t recommend SDL_net for games. There’s a lot of work you have to do
to make a programming interface that is ready for a game. SDL_net is great
for socket-level programming, but other libraries can get you to networked
multiplayer much easier. I still think reading Beej’s guide is worth it,
of course. :slight_smile:

Jonny D

Yeah, I’m also going to agree with Jon on this one. One I’ve used in the
past is enet http://enet.bespin.org/, which is pretty awesome. But
again, go over beej’s guide before you get into any library.On Fri, Aug 31, 2012 at 10:41 PM, Jonathan Dearborn wrote:

I don’t recommend SDL_net for games. There’s a lot of work you have to do
to make a programming interface that is ready for a game. SDL_net is great
for socket-level programming, but other libraries can get you to networked
multiplayer much easier. I still think reading Beej’s guide is worth it,
of course. :slight_smile:

Jonny D


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org