Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (511)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (577)
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  
  Slick2D + Kryonet guidance  (Read 1153 times)
0 Members and 1 Guest are viewing this topic.
Offline Rekkyn

Junior Newbie


Exp: 1 year



« Posted 2014-04-18 06:19:10 »

I'm trying to create a multiplayer game using Slick2D and Kryonet and need a few tips to get started. I've already done a bit of networking in Kryonet to test it out, so I know how it all works, but it would be helpful to have some sense for the architecture of the whole thing. What would be the best way to set up a client and server game system?

Some more specific questions that I have:
  • Should I be running Slick from the client, server, or both?
  • Should I be sending the whole game state or just things like entity data, positions, etc?
  • How often should I be sending the information to the client?
  • How and how often would input be sent from the client to the server?
  • What code should I have on both the client and the server?

Note that I want to keep the server and client together, so that it is possible to host a server and play on it from the same program.

Any help is appreciated!
Offline matheus23

JGO Kernel


Medals: 109
Projects: 3


You think about my Avatar right now!


« Reply #1 - Posted 2014-04-18 09:51:24 »

I like that your questions are really concise! Smiley (Adding that to the "Good Examples" Wiki Page Grin )

  • Should I be running Slick from the client, server, or both?
    It's a good idea to have Game Logic and Rendering seperated strong enough, so that you can run your Game without rendering anything. That'd allow your Server to run as a terminal / console program or in the background of a already running Slick game Wink
  • Should I be sending the whole game state or just things like entity data, positions, etc?
    You might want to start with sending the whole game state. Later you might try out something like only sending the changes. You can experiment with either only sending what the User Clicks and Types (Mouse & Keyboard Input), with the server responding with the current game state (No client-side prediction, "Server like a terminal", how John Carmack called it). You can always try out everything else later.
  • How often should I be sending the information to the client?
    It really depends. What I'd suggest is sending it about ~20 Times a second (I think that's just as frequent as in Minecraft) and interpolate between the gamestates so that you can render at 60 Times a second Smiley
  • How and how often would input be sent from the client to the server?
    I'd have the same update rates from client -> server like from server -> client.
  • What code should I have on both the client and the server?
    Ideally, the game logic code should be exactly the same Smiley Note, that many programs don't do that. The Minecraft server, for example, does only route the recieved game updates from one client to the other clients, while also checking that they don't fly in the air for too long (Do you know the "You got kicked from the server because of flying" dialoge? Wink ). It also checks the speed at which the client's player travel, afaik.

Hope this helps you Smiley

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline Rekkyn

Junior Newbie


Exp: 1 year



« Reply #2 - Posted 2014-04-19 20:56:41 »

 Thanks for the help, I appreciate it.

I'm running into a problem with serialization though. I'm using the jbox2D library for physics, and it isn't working well with Kryo. There seems to be two classes that contain instances of each other, causing Kryo to get stuck in an infinite loop of serialization. Is there any way around this, or should I find a way to avoid sending jbox2D data?
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.

Longarmx (52 views)
2014-10-17 03:59:02

Norakomi (42 views)
2014-10-16 15:22:06

Norakomi (32 views)
2014-10-16 15:20:20

lcass (37 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (66 views)
2014-10-14 00:35:47

TehJavaDev (58 views)
2014-10-14 00:32:37

BurntPizza (73 views)
2014-10-11 23:24:42

BurntPizza (45 views)
2014-10-11 23:10:45

BurntPizza (85 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!