hi all,:sad:
hope there are a lot of JAVA DEVELOPERS who can help me on this.

We have to develop a checkers game.Should develop in both .Net n JAVA. Two players sitting in two machines with two platforms.
One has to play in Java platform n other has to play from .Net platform.I hav to develop the java side.
I have already develop the checkers board.But my problem is to get a cherker pieces to the game board.Can someone send me the coding on how to do that.
Pianting the piece using the paint() method is not going to work.Because when we pass the objects through the web service no way to trace the image.

Hope somebody can help me.

My mail address are <emails are against forum rules>

please help me.

thank you.

Recommended Answers

All 4 Replies

Pianting the piece using the paint() method is not going to work.Because when we pass the objects through the web service no way to trace the image.

And that's where you go wrong.
1) you could actually send the image data (but don't).
2) you should not send the image data, instead only sending moves (and maybe board positions) and take the image from the local machine you're running on (from a jarfile, cached when first needed, is a good way).

You need a way to connect the games in real time; painting the image is really the last of your concerns!

As jwenting said, you only need to pass player moves across the network; either as a stream of events or a sequence of moves that the client side program(s) can interpret into the present position of each piece.

You can use a port listening/telnet type system to connect the two games, or have them connect to a data resource on the internet and use it like a pipe.

The methods you use will influence the way users start a game, and the overall latency; I'd suggest using an online/text database that represents the actions of a single game rather than connecting clients directly (it doesn't require IP trading) and storing/sending the whole sequence of moves rather than a stream of moves (it's quite important that all data sent between users arrives at the other end in a game like checkers).

The actual means of sending the data over the Internet is maybe too flexible, you could connect to an FTP server to read/write the file, connect to a port on your server and send it a message to write/return the contents of the file, write a CGI script that the applications can execute... hmm, can't think of another raw method.

Java maybe (probably) has an interface that simplifies this kind of thing. Look in the java.net package or google something like... "java client transaction", "java server transaction", "java port transaction", "java client communication", or even "send data between two java applications on two different machines"

EDIT: infact, the search "java network communication" gives much better results!

Hope that helps, I really doubt anyone will post code, its too specific a request.

And that's where you go wrong.
1) you could actually send the image data (but don't).
2) you should not send the image data, instead only sending moves (and maybe board positions) and take the image from the local machine you're running on (from a jarfile, cached when first needed, is a good way).

thank you very much for your help. i'll try dat way

You can connect the two clients by using Socket and ServerSocket classes. Your ServerSocket would listen for incoming events. Basically, the only thing each client has to listen for a "playerMoved" event. Update the opponent's position on your side. Each client should handle the logic of the game. So if player A moves a checker which jumps over a player B's checker, the only data you send from A to B is that the piece had moved. Player B's program should see that his checker was jumped and should run the appropriate action. No need for A to tell B that there was a jump.

The only data that really needs to be sent is anything that isn't predictable, such as player controls or random events.

And as Jwenting said, don't share image data.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.