Server / Client Help sending info for a Online Game
Author |
Message |
Snuffy
|
Posted: Tue Oct 27, 2009 8:02 pm Post subject: Server / Client Help sending info for a Online Game |
|
|
Well, i thought id start here. You guys have always been good to me ;D
Uni project time: We decided to make a 4 player online battleship game. (Dont ask me why... please dont) Doesnt matter what lanuage we use, as long as it works like it should, and we document it properly. If you can edit, its okay to do it in a browser.
Whats the easiest way to go at this?
Have a server, 4 clients, and send data ie. G4 and get it to display on all the clients? Any help would be greatly appreciated.
So
Everyone sees
Player 1 ( Lockon)
Q1 W2 E3 R4
Player 2 (69erathome)
A1 D3 F3 G4
Player 3 (Snuff3r)
Z1 C3 V3 B4
Player 4 (mistercat)
Q6 W6 R6 R7
ect. And everyone would see all the same things.
thanks in advance |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
DemonWasp
|
Posted: Wed Oct 28, 2009 8:35 am Post subject: RE:Server / Client Help sending info for a Online Game |
|
|
The easiest way to do multiplayer is to have a single server and multiple clients. It is acceptable to have a single application run one or both (this is common in games - when you "host" a game, it starts up a server; when you "join" a game, it starts up the client.
Because latency is a non-issue, but you require reliability, I recommend TCP connections, rather than UDP connectionless networking. This should be simple in pretty well any language.
First, consider all the information you need to communicate across the connections you form. You will, at the very least, need some way for: Clients to tell the server how their ships are positioned, their player-alias and where their next shot is fired; Servers to tell the clients who else is playing (their aliases), where shots have been fired, whose turn it is, who is still in the game, etc. Put some thought into this step and it will make your job easier later. Decide on how you're going to implement the network format (a simple example is to have the first character of any message indicate message type, which lets you read from there on; in some cases you may want the next field to be an integer describing the length of the message).
What you will probably also want to do is design your program so that the network code is encapsulated. This means that your program would tell the network layer or network connection to send a given message, and that layer would handle sending that message. This simplifies changing and editing the network format because you don't have to change everything in the program.
Any programming language should be able to provide sufficient facilities for this, with the notable exception of Turing, which can't seem to network anything without failing. Choose something you're familiar with. |
|
|
|
|
![](images/spacer.gif) |
SNIPERDUDE
![](http://compsci.ca/v3/uploads/user_avatars/16932914504cbd0ad6ceaf1.jpg)
|
Posted: Wed Oct 28, 2009 10:46 am Post subject: RE:Server / Client Help sending info for a Online Game |
|
|
If you don't really know any programming languages, Python or Visual Basic are easy to pick up on. But in the end, if you already are familiar with something use it. |
|
|
|
|
![](images/spacer.gif) |
|
|