Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing a very basic turn based strategy game which allows a player to select units and attack enemy units on their turn. The game is written in Java using the slick2d library and I plan to use kyronet for the networking api.

I want the game to be networked, but I do not know how I should go about it. My current idea is to connect two users together, and the first one to join the game becomes the game host, while the other becomes the client.

However after reading it seems my game would be suited to a peer to peer lockstep model. Would that make programming the networking side much easier?

Any suggestions on how I should structure my networking would be greatly appreciated

share|improve this question

If it's just a basic turn based strategy game you could utilize Java's Remote Method Invocation (RMI) API. It basically lets you call methods on remote machines without having to worry about the networking part. For example, your client could call "makeTurn(player)" on the server while the server calls "madeTurn(player, whatKindOfTurn)" on the client. I hope you get the idea. There are tons of resources about RMI.

You could also go the Kryonet / Socket way, as you will probably learn more about networking if you go that route, but it will also significantly slow down your development process.

Hope that helped.

share|improve this answer

Unless you are strictly limiting your networking to a pair of computers you own and control, peer-to-peer is difficult to get to work - there are too many routers, firewalls, and antivirus tools out there, interfering with add-hoc networks.

The usual solution is to use a public server, and communicate with it using HTTP requests. The server would typically store game state and do most of the work of validating network communications from untrusted sources (that's the only kind of source there is)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.