I'm making this bomberman-cloneish game and have the network part kind of up and running, well, the movement and joining/hosting stuff. Client and server is built into the game, so one player hosts the game and joins it, and the other 3 can join whenever they want.
Currently I'm sending a "snapshot" every 10th frame (60fps), which amounts to 10fps. I read somewhere that's what Quake used, so I went with that. Snapshot is very small and contains info on which way the player is pointing, his speed, if he's moving and his x,y coordinates.
The clients only transmit these snapshots if anything's changed, likewise the server only sends out the snapshots to the clients when it's needed. I've also made it so the player movement is smoothed out, so the remote players do not appear jerky on the clients end.
However! I'm thinking this approach may be a bit dated, I don't know. When a player makes a turn (it's viewed from above the playfield, bomberman style), it doesn't always look "neat" on remote clients. Obviously it's due to it only being 10fps packets, but there has to be some clever tricks to make it smoother.
I got the idea of sending snapshots only when something changes, and not every 10 seconds. So if a player moves and stops moving, he will appear to stop moving at the fastest possible moment on remote clients. This will likely take more of a toll on the server, and generate more traffic, but really, shouldn't it be okay with a 4 player game? (I mean, the client sends snapshot if he moves, stops moving, changes direction or anything, server receives it and slams it out to the other clients if it deems it necessary - obviously not always necessary if the client just stopped for 2 frames, but you get my point). Also things such as dropping bombs and other action-related things will also have a package sent from the client to the server, then to the other clients.
I haven't coded the idea yet, but I don't think it will be a problem really. Any thoughts on that?
In any case, I'd like to hear some advice and experiences from some of the old rats here :)
Ps. I know about the security issues as far as sending speed and whatnot, server is verifying that too.
Pps. I haven't gone into deltatiming/other stuff yet. I've worked with delta before, but I'm not exactly a rocketscientist when it comes to math, so the other "fancy" method is pretty unknown to me. Anyone got any ideas here?
Ppps. my snapshots packets are very small, like "101200010231" for one player, but they could be smaller using bytes. I just can't figure out how for instance to something like up to 2000 inside two bytes, I know local mybyte:byte is up to 255, but what's the general rule for using two? Do you just add them or what? I tried searching here for info on byte variables but couldn't really find anything at that simple a level heh.
Pppps. does it really matter that my packets are that small? I read somewhere that minimum packet sizes in for instance windows is like 200b or something..dunno if it's true, I fall asleep reading RFC's.
Currently I'm sending a "snapshot" every 10th frame (60fps), which amounts to 10fps. I read somewhere that's what Quake used, so I went with that. Snapshot is very small and contains info on which way the player is pointing, his speed, if he's moving and his x,y coordinates.
The clients only transmit these snapshots if anything's changed, likewise the server only sends out the snapshots to the clients when it's needed. I've also made it so the player movement is smoothed out, so the remote players do not appear jerky on the clients end.
However! I'm thinking this approach may be a bit dated, I don't know. When a player makes a turn (it's viewed from above the playfield, bomberman style), it doesn't always look "neat" on remote clients. Obviously it's due to it only being 10fps packets, but there has to be some clever tricks to make it smoother.
I got the idea of sending snapshots only when something changes, and not every 10 seconds. So if a player moves and stops moving, he will appear to stop moving at the fastest possible moment on remote clients. This will likely take more of a toll on the server, and generate more traffic, but really, shouldn't it be okay with a 4 player game? (I mean, the client sends snapshot if he moves, stops moving, changes direction or anything, server receives it and slams it out to the other clients if it deems it necessary - obviously not always necessary if the client just stopped for 2 frames, but you get my point). Also things such as dropping bombs and other action-related things will also have a package sent from the client to the server, then to the other clients.
I haven't coded the idea yet, but I don't think it will be a problem really. Any thoughts on that?
In any case, I'd like to hear some advice and experiences from some of the old rats here :)
Ps. I know about the security issues as far as sending speed and whatnot, server is verifying that too.
Pps. I haven't gone into deltatiming/other stuff yet. I've worked with delta before, but I'm not exactly a rocketscientist when it comes to math, so the other "fancy" method is pretty unknown to me. Anyone got any ideas here?
Ppps. my snapshots packets are very small, like "101200010231" for one player, but they could be smaller using bytes. I just can't figure out how for instance to something like up to 2000 inside two bytes, I know local mybyte:byte is up to 255, but what's the general rule for using two? Do you just add them or what? I tried searching here for info on byte variables but couldn't really find anything at that simple a level heh.
Pppps. does it really matter that my packets are that small? I read somewhere that minimum packet sizes in for instance windows is like 200b or something..dunno if it's true, I fall asleep reading RFC's.