Jump to content
  • Advertisement
Sign in to follow this  
carlou86

BattleShip Game: Hybrid Implementation?

This topic is 3304 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 am working on my final year Project where I am implementing a BattleShip Game, with different rules then the ones usually found on the net ( a mix between salvo variation and my professor's ideas, where the computer gives hints). My code is in java, and i've ahad no problems so far in the implementation of the GUI and "A.I" Algorithms ( coz there aren't really any heuristics ). The problem is the following: I am trying to make it a game over the network. I have no experience whatsoever in networking ( i am taking on my final semester). I created a server , and clients connect to it ( works fine). However, if i load the server with more then two clients, the messages ( coordinates in this case) are broadcasted to the rest of the clients. So i tried to let the server manage which clients talk to each other ( in a P2P manner) and the code became a whole mess. Should i rather implement a hyprid ontology, i.e the clients connect to the server, then the server connects the clients in pairs of 2 in a Master/Slave manner, So the server won't have to handle all the I/O? Or do i stick to my previous approach? I am really lost, and have barely started working with sockets, multithreading, synchronization etc... ( in the hybrid case, i assume that i don't need synchronization right? coz i will only have 2 players talking to each other...) I also want the clients to be able to choose whom to play against. Any links, step by step approach, tutorials would be greatly appreciated. Thank you

Share this post


Link to post
Share on other sites
Advertisement
Have you considered using RMI?

Central server is model (Game), and runs the simulation.

Clients connect and register observers.

Then, on each client, bind keyboard and mouse events to execute actions on server, and handle listeners to update the local state (render).

Share this post


Link to post
Share on other sites
You can still pipe it all through the server. Having the server run the authoritative game based on user input is a good idea. You need to separate the clients per game. How about assigning players to a game channel, one channel per game, and use that to broadcast events for that particular game only to those parties who are interested (ie listening to this channel / playing this game instance).

Share this post


Link to post
Share on other sites
Quote:
Original post by carlou86
I am implementing a BattleShip Game
A word of warning.

This only applies if you plan on doing anything with it beyond the school project:

Hasbro owns rights to the game name "battleship". They also have several variants of the game. Hasbro is very protective of clones of their games, and tend to sue first and let the courts figure out if it actually violates any of their rights. Over the years I have seen quite a few takedowns and lawsuits over their products, with a few going through the courts and coming out against Hasbro. They will sue even if the product didn't actually violate their rights, just so they can completely protect them. They also have exclusive agreements with EA, so doing anything significant may incur EA's legal wrath as well. (As examples, consider facebook's Scrabulous, Ghettopoly, Clue Computing, many Monopoly clones, Risk clones, Stratego clones, etc.)


As long as you keep it within the school project, you should have no problem.

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!