newbie asking about non-dedicated server games

here are some very newbie questions so don’t be surprised to hear yourself think “omg, is he serious???” while reading…

I’m planning a tetris game that supports 10 players (maybe more if it’s feasible)

Games will affect each other by sending junk blocks to the other players screens when a player takes out double lines or better. Thus, more players, higher difficulty… it would need a fair bit of testing and tweaking to get the difficulty just right. Each player can see the other players playfield.

I dont think my simple tetris game would generate enough traffic to slow down even a 56k connection with 10 players… i’m not really sure. The only other networking i ever did was in a chess game and a chat program.

I’m thinking of a few properties:

  1. Permanent latency of 1000/2000ms, as the players do not interact directly, and to provide a buffer for network messages. the player’s own client will not show latency but remote ones will.

  2. TCP rather than UDP because of above, and it is important that all messages get through. If there needs to be a resync, I don’t want it happening too often.

  3. A means of passing on hosting responsibility to another client if the server drops out or quits… (though as yet I have only a couple of sketchy ideas and I can think of problems with most of them)

  4. games buffer 500ms worth of messages to send so that they send less frequent, but larger packets.

With #1, maybe the latency would be dynamically adjusted in-game, but would not be done very often. I’d probably put a minimum of 1000 ms. The reason for this is #4, and an extra 500ms buffer should provide a smooth game.

would it be useful or even beneficial to try to manage the network load rather than have just one host recieving all the input and sending all the output? i expect that it would be more trouble than it’s worth, but i want to ask anyway. (see picture:http://www.adam.com.au/kellyjones/picsused/network.gif)

How would I effectively do #3? I was thinking of in case the host drops, the clients all listen for connections (become potential hosts), and try to connect to the others in order of first come, first host… (try for 5 seconds, move on… to next… until all have been tried then give up) seems a bit messy. Suggestions?

Hi
If you have one single host recieving all of the packets and then resending them, if that host crashes the whole game is lost. One way to handle this, is 1 persons starts a ‘server’ session, and everyone joins that session, when the game begins each client gets sent the ip address and port of the other clients. Each client sends it’s information to every other client, that way any one client going down will only effect the client that quits/closes. There is more traffic created this way, but only sending, each client will still recieve the same amount of information, but will send to every client, but if you are talking about small amounts of data then this should not be a problem, you’ll have to do the maths to figure out if it’s too much traffic.

HTH

Endolf

Call me crazy, but this is just tetris right? I mean, how long is the average game going to last? 5 minutes? Maybe 30 minutes at best? Is all this concern over redundancy even necessary?

If it’s that much of a concern, why not just store information on a giver server on how reliable that server has been (i.e. number of games started divided by number of games completed). If a server is of any quality, and your code isn’t causing servers to crash, then server reliability averages should be up in the .800 range at least. Players can simply choose not to play on unreliable servers.

I would say, don’t go for the over-complicated model, unless you’re charging money to play the game, in which case it better be stable. If you’re simply looking for an exercise in network programming, then why build a tetris game on top of it? Just build the network model instead, perfect it, and then build a game based on that system. It’s going to be hard enough to get the networking right without having to distract yourself with a game design and all the extra problems that go along with it.

i have already built the basic network stuff, and built and more or less finished the game a fair while ago. it’s gotta be a game, cause i already did ‘JMChat’ and oh boy that was fun… hrm.

Actually, im not so much worried about drop-outs, more by people who have that ‘gotta win’ mentality like so many on battle.net who pull the plug on their modem if they are getting beaten.

i think endolfs way is a good one, rather than have the games try and recover from the mess afterward, just make them redundant. in fact, it’ll make it a lot easier to handle when people leave after losing too.

Well, if you’ve basically got the game running already, then awesome.