I'm wanting to make my platformer multiplayer, and while I know how to do some of the more advanced things, it's the "simple things" such as a packet system that I don't really understand.

I understand how to make an authoritive server, how it works, etc, but I'm not so great at how to transfer the data back and forth between the server/client information on what it's for.

I know that I can do things like, send everything in a string data, using "[packetname]" as a tag, then decode it on the server-side, but there has got to be a better way to do things, so I guess I'll go ahead and ask.

I've been told to use DatagramServer with DatagramPackets, but I've read that they are extremely unreliable, is this true?

Would I be better off using IO, NIO, Netty, Mina, Etc?

I'm still learning and this is going to be my first multiplayer project (That I've wrriten the core of the server for) and I'm just not too sure how where to begin. I've worked on plenty of projects where the server was already completed and I was just adding things like server-sided collision/logic checking, but this is my first "From scratch" project.

I haven't had the chance to use it, but a quick google brought up an IO framework for 'fast, low-latency connection,' TCP, and great for games. Check it out: Netty IO. Keep in mind it is not made for games, but you can build on top of it.

Netty is good, and I was thinking about using it. I have used it on my Runescape Emulators before (Sadly, this is where I started), but I never actually wrote the structure, however I've done stress test comparisons between Netty/Mina/IO and Netty definately won.

If you are planning to setup a standalone server you might want to look into WebSockets as well. I have used Mina, Jetty, etc. before so there all fine in my opinion. The biggest problem isn't how you send the data but enabling people to connect to the server. If you have a standalone server (somewhere in the internet) it's generally not a problem to connect to the server (as long as you use port 80 - could be web sockets), but someone hosting a server at home is always asking for trouble (the player will need to enable port-forwarding/tunneling etc.). Also, for hosting at home, you might want to setup a match-making server. No one is going to play your game unless they have a server to connect to.

Quote

I know that I can do things like, send everything in a string data, using "[packetname]" as a tag, then decode it on the server-side, but there has got to be a better way to do things, so I guess I'll go ahead and ask.

I guess that's general idea: you send the packet type (could be an integer/byte too to reduce size of data you send) then process & return the data.

I suggest you abstract the client-server communication so you can switch out the underlying networking system (be it NIO, Netty, Jetty, Mina...) etc. easy. Something like a web socket type interface might work nicely given you are looking for packet-type communication (same interface for both client and server). Although NIO, Mina etc. are stream-based connections, you can easily implement them so the behave like a web socket as below.

It's going to be server based, and I already have port-forwarding etc set up for multiplayer testing, I understand that peple will want a "Server" to connect to and that's not a problem, I have a friend that runs one of the datacenters in houston.

EDIT: I'm not good good with "Abstracting" things, as I haven't really ventured into that part of programminh yet. EDIT2: Stream based is pref what I'm looking for anyway.

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