Results 1 to 4 of 4
- 08-21-2011, 05:59 PM #1
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 LoaieCurrently Developing a Game Called Loaie, You Can Download It From "The Loaie Website".
- 08-22-2011, 03:07 PM #2Member
- Join Date
- Jan 2011
- Rep Power
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.
- 08-22-2011, 06:26 PM #3
If you take a look on this video showing off my game you will see what I would need.
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.
AlexCurrently Developing a Game Called Loaie, You Can Download It From "The Loaie Website".
- 08-23-2011, 05:03 PM #4Member
- Join Date
- Jan 2011
- Rep Power
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.
- By überfuzz in forum AndroidReplies: 0Last Post: 07-18-2011, 11:00 AM
- By js4learn in forum Java GamingReplies: 1Last Post: 07-08-2011, 03:43 AM
- By Alerhau in forum New To JavaReplies: 3Last Post: 06-29-2011, 09:18 PM
- By robs in forum Java GamingReplies: 0Last Post: 04-18-2011, 09:33 AM
- By kevinnrobert in forum Java GamingReplies: 1Last Post: 04-02-2010, 01:22 PM