Game networking?

Ok, so im not to java and new to these boards and have a question about a game im working on. My game im working on is basically an overhead view of tanks, right now its pretty basic and I just have some blocks that shoot some projectiles but its set up to accept alot more. I know its going to be networked so i figure it will probly be best to do it now while its a smaller program. Im working out of Deitel and Deitels 5th edition of Java: how to program. Its a really good book and im using the TicTacToe multi threaded server that has 2 client applets connect to it source code. I experimented with basic server client stuff and have gotten stuff connected over the internet or anything but ive read all i can find and when i went to impliment my game as a server that has two applets connect and i found that I had no idea at all how to implement this. How I have it now I have a Tank1(player1) and Tank2(player2) classes that extend from a main Tank class, I also have a projectile class and put it all together in the main. I have no idea what the Server side should be doing and keeping track of, and I have no idea what the client should be doing and there relationship together. Can anyone help me out with setting up a server/client for this game, I know I haven’t given alot of usefully information and its being long winded but ANY help would be VERY apreciated. Thanks alot! And if it would help at all I can get my source code up, or the applet of what I have. Thanks again

Well I have a go on answering your questions.

The game logic should always be controlled by the server (that makes cheating alot harder for the clients). So in your case the server should hold the positions of the players tanks, direction they are heading, projectiles they have shoot and so fourth.

The client shouldn’t hold anything, it should only draw the tanks and projectiles in the positions that the server tells the client to do.

When a player moves the client should send the new position of the player to the server. The server validates the new position, to prevent cheating (for example jumping across the battlefield). The server then send the new position to the clients so they can update there game field. The same method applies for projectiles.

Thats the basic concept. Any more questions?

Thanks a ton, thats exactly what I was looking for, im sure I will have more questions as I try and impliment it today but thanks alot for the help.

if you need answer for more questions feel free to contact me by icq, mail etc (see my profil). I am of course reading this forums often so posting more questions here I properbly answer to :slight_smile:

Ok, The last part that im “missing” in understanding this all is how do I determine how the different threads interact with eachother, like what needs to be in its own thread and what doesnt and how they fit together in reading in the data and exicuting it, and also im a little confused on when you take in data how do you deal with say, having the possability of it being a mouse click, or a a key press, or a string, or whatever the user is doing without actually knowing what it is? Should I have say the client send a string and then have the server take in that string and depending on what it is do the required task? Thanks alot guys for any help