Results 1 to 4 of 4
  1. #1
    Alerhau's Avatar
    Alerhau is offline Senior Member
    Join Date
    Jun 2011
    Location
    Sweden
    Posts
    158
    Rep Power
    4

    Default Server For Game In Java? Enable Multiplayer?

    Any good tutorial for this? I don't care if it's gonna take time, I just need this :D

    Alex, Developer of Loaie
    Currently Developing a Game Called Loaie, You Can Download It From "The Loaie Website".

  2. #2
    Skiller is offline Member
    Join Date
    Jan 2011
    Posts
    67
    Rep Power
    0

    Default

    What sort of multiplayer are you talking about? For instance there's a massive difference between the sort of solution you need for 16 player FPS games, web oriented turn based games and a 1000+ player MMOs. And there's usually massively different ways to do things based on what kind of network architecture you want to use (generally a choice between client/server and peer to peer).
    Currently developing Cave Dwellers, a Dwarf Fortress/Minecraft style game for Android.

  3. #3
    Alerhau's Avatar
    Alerhau is offline Senior Member
    Join Date
    Jun 2011
    Location
    Sweden
    Posts
    158
    Rep Power
    4

    Default

    If you take a look on this video showing off my game you will see what I would need.
    http://www.youtube.com/watch?v=w5xAkM3yGqk

    Basicly just having my friends running around like those small characters in the video.
    Don't need to be more than 10 - 20 slots per server.

    Alex
    Currently Developing a Game Called Loaie, You Can Download It From "The Loaie Website".

  4. #4
    Skiller is offline Member
    Join Date
    Jan 2011
    Posts
    67
    Rep Power
    0

    Default

    Oh you are already a fair way into development, that may make things a lot harder depending on how your code is designed, it can be really difficult to add multi-player to a game that wasn't originally designed for it.

    Anyway for something like that I'd probably go with a client/server architecture, there's a fair bit of dynamic stuff so it'll be much easier to handle it all on one machine and push out the results to clients. And given that it doesn't look like latency will have too big an impact on that sort of game you can probably build the server code into the client rather than needing to create a separate dedicated server which should make things easier.

    Multi-player/networking is a complicated subject, so it'd be too time consuming for me to go into the details of what you'd need to do to get it going but I found this link for you that looks like it should get you going with basic networking:
    Java Network Programming : Client Server Programming : Networking Concept & Error Handling

    As for how to apply it to your game, one method that is relatively easy to implement is to simply transmit the client's input to the server, then the server does whatever that input would do and also sends back the results to all clients. It's not the best way to do things but it is a LOT less work than any other methods I know and should at least provide the results you want. You can further improve the feel of the game by predicting the result of the server and acting on that prediction before you get the result, but then if when you get the result it is too different from the prediction you have to undo what you did based on the prediction and then redo things based on the result. The prediction helps the game feel less laggy but it can also introduce some small inconsistencies between the clients, however usually those inconsistencies go unnoticed.


    Hope that helps, you are a braver person than I to be tackling multi-player, I usually find the complexity of the code design to handle networking more work than I'm prepared to put in, so all the games I'm currently developing are single player only ;).
    Last edited by Skiller; 08-23-2011 at 05:07 PM.
    Currently developing Cave Dwellers, a Dwarf Fortress/Minecraft style game for Android.

Similar Threads

  1. Multiplayer (one on one) how is it done?
    By überfuzz in forum Android
    Replies: 0
    Last Post: 07-18-2011, 11:00 AM
  2. Multiplayer Bingo game
    By js4learn in forum Java Gaming
    Replies: 1
    Last Post: 07-08-2011, 03:43 AM
  3. Java Multiplayer (Online)
    By Alerhau in forum New To Java
    Replies: 3
    Last Post: 06-29-2011, 09:18 PM
  4. Multiplayer game - multiple instances
    By robs in forum Java Gaming
    Replies: 0
    Last Post: 04-18-2011, 09:33 AM
  5. Multiplayer Game(Sockets)
    By kevinnrobert in forum Java Gaming
    Replies: 1
    Last Post: 04-02-2010, 01:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •