adding an image to a java code

Reply

Join Date: Aug 2006
Posts: 5
Reputation: rangaSL is an unknown quantity at this point 
Solved Threads: 0
rangaSL rangaSL is offline Offline
Newbie Poster

adding an image to a java code

 
0
  #1
Aug 31st, 2006
hi all,
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.
Last edited by WolfPack; Sep 2nd, 2006 at 3:37 am. Reason: Deleted the Email addresses
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,145
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: adding an image to a java code

 
0
  #2
Aug 31st, 2006
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).
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: adding an image to a java code

 
0
  #3
Sep 1st, 2006
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.
Last edited by MattEvans; Sep 1st, 2006 at 2:12 am.
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 5
Reputation: rangaSL is an unknown quantity at this point 
Solved Threads: 0
rangaSL rangaSL is offline Offline
Newbie Poster

Re: adding an image to a java code

 
0
  #4
Sep 1st, 2006
Originally Posted by jwenting View Post
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 759
Reputation: Phaelax is on a distinguished road 
Solved Threads: 38
Phaelax Phaelax is offline Offline
Master Poster

Re: adding an image to a java code

 
0
  #5
Sep 5th, 2006
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC