Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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 http://gafferongames.com/networking-for-game-programmers/what-every-programmer-needs-to-know-about-game-networking/ 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
add comment

2 Answers

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
add comment

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
add comment

Your Answer

 
discard

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.