Java game networking question, please help

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

[1497 byte] By [MoO_coWa] at [2007-9-28 14:07:59]
# 1
Assume that the client is in the hands of the enemy... try to keep as much as possible on the server side.
tieflinga at 2007-7-12 10:28:52 > top of Java-index,Other Topics,Java Game Development...
# 2

Heh, yeah i seem to be working on this Fighter game in Java...i think im calling it "The God of all Games"... anyway, my idea for networking is that i will just have the program draw to the client's screen and accept keyboard input... everything else i will try to do from the server... i dont know if that helps at all...

IIIIIIlla at 2007-7-12 10:28:52 > top of Java-index,Other Topics,Java Game Development...
# 3

> 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,

If its any use, I have a working client/server tank game (coincidence!)

that uses all the features you mention. Its in 3D, but would all the algorythmes still apply. The full source code is available on request.

Stevo16385a at 2007-7-12 10:28:52 > top of Java-index,Other Topics,Java Game Development...
# 4
http://www.flipcode.com/networkthere is a nice article bout networking. it focusses c++ but that doesnt really matter since the basics (the first chapter) is just theory. u should really read it... there are a lot of hints bout how u can do such kind of stuff and what's important.
oNyxa at 2007-7-12 10:28:52 > top of Java-index,Other Topics,Java Game Development...
# 5
Hi:Why not use Tomcat or JBoss as a server.CheersDLWasler
dlwaslera at 2007-7-12 10:28:52 > top of Java-index,Other Topics,Java Game Development...
# 6

>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.

This is a pretty broad topic with lots of details,

and it sounds like you could use a broad mental model

to get you started. Here's one that has served me well:

1) Think of the game as running only on the server.

2) Think of a client as a dumb terminal that simply

relay a player's input to the server, and display

the game server's responses back to the player.

3) If you want the game to run without a separate

server, then keep this mental model but have the

server run on one of the computers that also has a

client on it (i.e. don't to combine the client and

server -- keep them logically separated even if

they're physically on the same computer).

If you have performance/latency problems, then later

you can move functionality down from the server to the

clients. However, don't do that yet. It's easy to do

that later if you need it, but it's very difficult to

go in the reverse direction if you discover that you

put too much stuff in the client. Believe me, I've

seen huge online game projects derailed because they

thought it'd be easy to hoist functionality out of the

client into the server.

About the network communications itself... I assume

you're familiar with the ISO/OSI network model and the

TCP/IP version of it. Use something similar for your

communications, i.e. the server and client should talk

to each other with a game-level protocol, and all the

networking details can be hidden in the lower

transport layer.

Another thing: your game protocol should be versioned.

You'll revise it several times during development, and

it's better if the code is self-aware about the versions

rather than you trying to keep it straight. You'll end up

with old clients connecting to the new server or vice

versa, and if you don't know the version of the incoming

data stream then it's hard to verify its validity, which

means your server is going to crash or won't be able to

give intelligent responses during your multiplayer tests.

You MUST validate that data, or your game will be too

fragile to play.

For the same reason, you'll need version info in any

data structures that are passed between the client and

server.

Hope this helped.

--t

park_toma at 2007-7-12 10:28:52 > top of Java-index,Other Topics,Java Game Development...
# 7

Thank you VERY much for the advice everyone. And if I could see some source code im sure I could learn it(and teach the class) about it alot faster because i learn from source code more than anything else. If I could get a link to your game Stevo or if you wanted to email( moooocow@earthlink.net ) I would apreciate it a whole lot. Thanks alot for the help again guys.

MoO_coWa at 2007-7-12 10:28:52 > top of Java-index,Other Topics,Java Game Development...
# 8
yes, Steveo I wold luv to look over your source code. I have written a 3d multiplayer game that is functional and would like to see how others have done theirs.you can reach me at: worldbuilder@comcast.net
MickeyBa at 2007-7-12 10:28:52 > top of Java-index,Other Topics,Java Game Development...