Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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  
  What would you suggest for an online game?  (Read 4127 times)
0 Members and 1 Guest are viewing this topic.
Offline CTucker1327
« Posted 2013-12-15 03:35:32 »

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.

Offline wessles
« Reply #1 - Posted 2013-12-15 04:02:57 »

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.
Offline CTucker1327
« Reply #2 - Posted 2013-12-15 04:53:43 »

I wasn't expecting it to be made for games, just something to build on with plenty of tutorials.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline CTucker1327
« Reply #3 - Posted 2013-12-15 05:07:11 »

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.
Offline noblemaster

« JGO Spiffy Duke »

Medals: 35
Projects: 11

Age of Conquest makes your day!

« Reply #4 - Posted 2013-12-15 05:34:04 »

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.

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.
public interface WebSocket {

  /** The WebSocket session/connection. */
  public static interface Session {

     * Sends a text message.
     * @param data  The message.
     * @throws Exception If something goes wrong.

    public void sendMessage(String data) throws Exception;
     * Closes a connection.

    public void close();

  // -------------------------------------------------------------------------------------------------------------------
   * Called when a new websocket connection is accepted.
   * @param session  The session.

  public void onOpen(Session session);
   * Called with a complete text message when all fragments have been received.
   * @param data The message.

  public void onMessage(String data);
   * If there was an error.
   * @param e  The error encountered.

  public void onError(Exception e);
   * Called when an established websocket connection closes.

  public void onClose();  

Offline CTucker1327
« Reply #5 - Posted 2013-12-15 05:36:59 »

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.
Pages: [1]
  ignore  |  Print  

EgonOlsen (77 views)
2018-06-10 19:43:48

EgonOlsen (57 views)
2018-06-10 19:43:44

EgonOlsen (77 views)
2018-06-10 19:43:20

DesertCoockie (259 views)
2018-05-13 18:23:11

nelsongames (157 views)
2018-04-24 18:15:36

nelsongames (156 views)
2018-04-24 18:14:32

ivj94 (897 views)
2018-03-24 14:47:39

ivj94 (161 views)
2018-03-24 14:46:31

ivj94 (810 views)
2018-03-24 14:43:53

Solater (174 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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‑
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!