Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (579)
games submitted by our members
Games in WIP (500)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Multiplayer Games  (Read 639 times)
0 Members and 1 Guest are viewing this topic.
Offline samcp12

Junior Member


Medals: 1



« Posted 2013-07-06 15:42:50 »

So I recently started learning about Sockets and network programming in Java as I hope to add it into a game but I'm unsure how I would implement it, I was thinking of having it so you would type in the IP of the player you wish to connect to and then you would appear in the players "world", is this even possible or are there easier/more efficient ways? I am also curious how I would send player data, would I just use Object streams?

Sorry If I'm not being clear and sound like a newbie but I'm kind of new to networking Tongue

P.S
I've read the oracle tutorials/documentation and understand the basics of sockets/server sockets.
Offline Longor1996
« Reply #1 - Posted 2013-07-06 21:54:23 »

So I recently started learning about Sockets and network programming in Java as I hope to add it into a game but I'm unsure how I would implement it, I was thinking of having it so you would type in the IP of the player you wish to connect to and then you would appear in the players "world", is this even possible or are there easier/more efficient ways? I am also curious how I would send player data, would I just use Object streams?

Sorry If I'm not being clear and sound like a newbie but I'm kind of new to networking Tongue

P.S
I've read the oracle tutorials/documentation and understand the basics of sockets/server sockets.

Depends an what you wan't to do.

If you just want to make a multiplayer game, use KryoNet (Its written like this I think).
If you want to learn how the networking works exactly: Don't use Object-Streams, as they are way too slow.

I for myself have my own networking library, but I think its better if you use a complete library like KryoNet,
since a complete library is more easy to use, cleaner, and mostly free of bugs.
(Don't get me wrong: Every library has its bugs, some are better, some are worse)

I hope I didn't confuse anyone with this post.
Any mistakes/fails/errors are due to 4 hours of work in the garden today.

- Longor1996

Sorry for my bad English! That's because i am from Germany.
Offline samcp12

Junior Member


Medals: 1



« Reply #2 - Posted 2013-07-07 07:12:50 »

I'd rather not use a libary, I prefer to know whats going on fully, unless I know exactly whats happening I just don't like using libarys.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Longor1996
« Reply #3 - Posted 2013-07-07 13:44:53 »

I'd rather not use a libary, I prefer to know whats going on fully, unless I know exactly whats happening I just don't like using libarys.

Then the next question is: Do you wan't to use TCP or UDP?
There are many reasons to take the one or the other.
This thread here is a good read if you have to decide between them.

Have a nice day!

- Longor1996

Sorry for my bad English! That's because i am from Germany.
Offline samcp12

Junior Member


Medals: 1



« Reply #4 - Posted 2013-07-07 20:13:50 »

Thanks! I'll have a read of that Cheesy
Offline sproingie
« Reply #5 - Posted 2013-07-08 01:25:06 »

I just don't like using libarys.

This is a ridiculous attitude to be taking as a programmer.  You're already using the Java standard library and it has hundreds of classes and features you didn't write, to say nothing of the big managed runtime it all sits on.  You can't make informed decisions about what libraries are appropriate and which you'd rather reimplement yourself if you don't get any experience in using them.

Now it's your code, so I don't really care in the end what you do, but communities also aren't usually inclined to help people who choose Not Invented Here as a guiding principle.  Just some unsolicited advice.
Offline h3ckboy
« Reply #6 - Posted 2013-07-09 10:25:48 »

If I'm understanding the OP correctly he's trying to learn some networking basics, not create an MMO. I agree with you entirely that reinventing the wheel is usually not the smartest approach, but sometimes when trying to learn, it is good to understand everything that is going on, and then hand it over to the library for ease.
Offline samcp12

Junior Member


Medals: 1



« Reply #7 - Posted 2013-07-12 22:05:23 »

Quote
This is a ridiculous attitude to be taking as a programmer.  You're already using the Java standard library and it has hundreds of classes and features you didn't write, to say nothing of the big managed runtime it all sits on.  You can't make informed decisions about what libraries are appropriate and which you'd rather reimplement yourself if you don't get any experience in using them.

I understand where you are coming from but I didn't say I would NEVER use library I simply said I disliked the use of them, to further my point I should of said that I disliked the use of them when I don't understand the basics (not every single line of code). I guess it is just my attitude but I feel I should know a little about what is going on under the hood and not just blindly downloading a library without a single clue of what's going on.  Why shouldn't I learn a little bit of C before using something like OpenGl? It's my choice as a programmer, and besides how is gaining more knowledge in a subject a negative thing?

Back to the original topic, I was simply asking for advice for how Sockets can be used in game development, the library I was suggested to use is no where near what I will be needing any time soon. Like another poster said I am not looking to make some fancy MMORPG I was simply looking for advice.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (37 views)
2014-04-15 18:08:23

BurntPizza (33 views)
2014-04-15 03:46:01

UprightPath (48 views)
2014-04-14 17:39:50

UprightPath (31 views)
2014-04-14 17:35:47

Porlus (48 views)
2014-04-14 15:48:38

tom_mai78101 (69 views)
2014-04-10 04:04:31

BurntPizza (129 views)
2014-04-08 23:06:04

tom_mai78101 (229 views)
2014-04-05 13:34:39

trollwarrior1 (193 views)
2014-04-04 12:06:45

CJLetsGame (200 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!