Jump to content
  • Advertisement
Sign in to follow this  
stein102

KryoNet help

This topic is 2272 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I just started working on a game in Java using Slick2d and I want to make the game multiplayer. I don't need to make anything massive, I just want to make a basic RPG to see how it works and I thought it would be cool if I could make it so that I could give a copy to my friend so he can see what I'm doing(he just started programming). I think it would be a pretty good learning experience as well for myself. I'm thinking of using KryoNet for it because I don't want to do it from scratch. Does anyone know how I should start with this? Any tutorials? Also, what will I need to change in my game as it is? Right now I haven't done a lot, just got a sprite moving around a tileBased map with basic collision with tiles and the outside of the map. Another thing, would I make a separate project for the client and one for the server? Also where would I add the client/server in my slick2d statebasedgame?

Sorry for the cluster of questions, I just kind of spewed ideas onto my keyboard.

Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
By "Project" I assume you mean in an IDE such as Eclipse.
There are two basic ways to do it.
One is to build everything as one application, which you start up in "server" or "client" mode, and when in "server" mode, it doesn't render, and when in "client" mode, it doesn't listen for new connections (for example.)
The other is to use THREE projects. One library project for "Common," which contains all the code that needs to be known by both client and server -- data structures, game rules, etc. Then one application project for "server" that uses the "common" library and adds only the server-application-specific bits, and another application for "client" that also uses the "common" library and adds only the client-application-specific bits.

Share this post


Link to post
Share on other sites
I'm really confused, I've never done anything with networking before and I'm confused on how this all works. Which way would you suggest?

Share this post


Link to post
Share on other sites
Easiest to get started, and easiest for players if you allow player-hosted servers, is to build a single executable, which can be started in "server" or "client" mode.

Share this post


Link to post
Share on other sites
Like, would I make the menu have 2 options, host and join? Then from there it sends you into a gamestate for either one, depending on which one you pick?

Share this post


Link to post
Share on other sites
There are two ways you can learn this:

1) Read other people's code that already does the same thing.
For example, the source for Quake (and Quake II, and Quake III, and now Doom III) is open source. It may not be easy to get into, but it's probably really rewarding once you do. Nothing worthwhile was ever easy :-)

2) Try it yourself, and measure/observe whether it works. When it doesn't, quantify the failure, and go back to doing it differently, compensating for that failure. Repeat.

In reality, you'll probably need to do both.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!