Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Python/Java options for learning networking?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 Basham   Members   -  Reputation: 108

Like
0Likes
Like

Posted 13 June 2014 - 08:33 PM

I'd really like to learn some basic networking stuff (because, yes, some day I'd like to make some sort of multiplayer game).  I know the go to standard is Beej's guide (which I've begun to read), but other than my computer architecture class last year I haven't really programmed in C at all.

 

I was wondering if there are any good alternative guides that utilize other languages, or if it would be best to just go with it and learn C (which I plan to learn eventually regardless).  (I only mentioned Python and Java because those are the languages with which I'm currently most comfortable)

 

Thanks in advance.



Sponsor:

#2 Satharis   Members   -  Reputation: 1701

Like
0Likes
Like

Posted 14 June 2014 - 01:25 AM

Yeah, don't make games in C.

If you're going to go that route at least learn C++, C is only really useful for specialty tasks these days like writing OS level code or embedded software(because C compilers are very easy to write.) Anything game related that isn't using a higher level language will be in C++.

Beej's guide is all about basic sockets, you don't HAVE to write with those in order to get networking in a game, there are usually quite a few libraries that abstract away the details for you(C++ has Raknet for example) Java probably has a built in library and a lot of third party ones, same with Python. In fact I probably wouldn't bother dealing with sockets unless you have a good reason to(need to write your own unusual behavior or your goal is to get in depth with network coding.)

#3 SeraphLance   Members   -  Reputation: 1687

Like
0Likes
Like

Posted 14 June 2014 - 02:08 AM

Yeah, don't make games in C.

If you're going to go that route at least learn C++, C is only really useful for specialty tasks these days like writing OS level code or embedded software(because C compilers are very easy to write.) Anything game related that isn't using a higher level language will be in C++.

Beej's guide is all about basic sockets, you don't HAVE to write with those in order to get networking in a game, there are usually quite a few libraries that abstract away the details for you(C++ has Raknet for example) Java probably has a built in library and a lot of third party ones, same with Python. In fact I probably wouldn't bother dealing with sockets unless you have a good reason to(need to write your own unusual behavior or your goal is to get in depth with network coding.)

 

Honestly, you can't go too much higher level than sockets and still have general-purpose network programming.  You can tear a little bit of the boilerplate out, but in the end it's just an IO stream.  Even specialized HTTP Clients aren't that far removed.

 

On the topic, python has a perfectly serviceable sockets module if you want to use it, and there are plenty of guides on the subject.  I'll echo the above sentiment that C isn't a language you want to break your back over using.



#4 Code Fox   Members   -  Reputation: 2118

Like
2Likes
Like

Posted 14 June 2014 - 03:01 AM

Java has really good built in libraries for programming sockets [LINK] - within a few lines of code you can have a basic client - server up and running. [LINK] [LINK] .

 With Python, I've personally never had any luck getting any kind of client / server running on my computer ( Windows 7, Python 2.7 ) [LINK]


Edited by Shippou, 14 June 2014 - 03:06 AM.

Intelligence Is Like Lego ...

Worthless Unless You Build

Something With it .

~ Unknown
 


#5 Glass_Knife   Moderators   -  Reputation: 6002

Like
3Likes
Like

Posted 14 June 2014 - 07:21 AM

Networking is hard.  There is plenty of documentation out there, but this is one of those things that you can only learn by doing.  

 

The quintessential networking program is a chat server.  While this may seem too easy to bother with, it is actually very complicated, and contains hidden inside many problems you will face creating a multiplayer game.  Chat servers are easy enough to understand, just pass string messages around, and only need a very simple GUI.

 

But try coding one up, and you will begin asking questions like: 

 

How does the client know where the server is?

What if I start the client before the server?

What if I try to connect two clients?

Why doesn't the server know the client is gone?

What if the server needs to restart when the clients are connected?

 

... and a host of other problems you really can't wrap your head around until you try it.  

 

And read this: http://www.gamedev.net/topic/655795-your-most-valuable-debugging-techniques-for-networked-games/

for when you have problems.


Edited by Glass_Knife, 14 June 2014 - 07:21 AM.

I think, therefore I am. I think? - "George Carlin"
My Website: Indie Game Programming

My Twitter: https://twitter.com/indieprogram

My Book: http://amzn.com/1305076532


#6 Basham   Members   -  Reputation: 108

Like
1Likes
Like

Posted 14 June 2014 - 12:08 PM

Thanks to everyone for the suggestions.

 

 

I'd be more than happy to try to get a chat program running; I'll give it a shot in Java.  

 



#7 minibutmany   Members   -  Reputation: 1790

Like
0Likes
Like

Posted 14 June 2014 - 01:56 PM

If you use Java, the Kryonet library makes networking a little easier.


Stay gold, Pony Boy.

#8 Herwin P   Members   -  Reputation: 658

Like
0Likes
Like

Posted 16 June 2014 - 06:45 AM

There's Twisted for Python. There's also some tutorials about asynchronous programming using Twisted. I got started with this one.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS