Guest Posted September 27, 2003 Share Posted September 27, 2003 I have some sugestions to improve the net code. First, the net code being sent by a player could be a simple struct like this: struct sentnetcode { byte movetype; // 0=standing still 1=normal run 2=sprint 3=in car unsigned short int dirx,diry,dirz; //the direction vector on wich you're goin' byte health; //health level byte armor; //armor level byte weapon; //weapon in hand bool shooting; // false=not shooting true=shooting byte car; //if (movetype==3) car=the car you are in } Now this is roughly 12 bytes! And it has all you need to send. Each user sends this code updated with what his doing at the moment of sending for 24 times/second to the server. He receives from the server a struct like this for each player( ex: 4 players, 4 structs per package (48 bytes received and 12 sent)*24=1152 Bps received and 288 Bps sent). Until he receives the next struct the game assumes the other players continue moving in that direction and doing the same stuff and updates their position each frame acordingly to the player. I think it isn't hard to implement and it will spare a LOT of bandwidth this way and the multi player experience will aproach the single player one more in respect to realism and actual players moving(not just teleporting from place to place like you do it now)... Hope you take it into consideration. Tell me what you guys think! Link to comment
skit3000 Posted September 27, 2003 Share Posted September 27, 2003 You also have to send the angle (how high) a person is shooting... Link to comment
Robpol86 Posted September 27, 2003 Share Posted September 27, 2003 i didnt read those big paragraphs, so if u didnt mention, your missing 1 very important thing in the world of online 3d gaming.. the X, Y, and Z axis. and rotation X and rotation Y and rotation Z dont forget anti-traner techniques Link to comment
MasterEvilAce Posted September 27, 2003 Share Posted September 27, 2003 umm how about NOT sending data unless the data changes IE: i'm running forward, so update my coords the client detects i was shot, my health goes down... send server my updated health i get in a car, send to server that i did this i'm moving forward, send my velocity, angle of car, position repeatedly (unless i've stopped) Link to comment
Cray Posted September 27, 2003 Share Posted September 27, 2003 We do only send what has changed, and to fully understand the size of the packets you need to see what data we are also dealing with on our end, which is not something I can show. There is a lot more data that needs to be synced then just what you have pasted here. If it were only that easy, then we would be set for life Link to comment
skit3000 Posted September 28, 2003 Share Posted September 28, 2003 Can you give us an example? Link to comment
Xucas Posted September 28, 2003 Share Posted September 28, 2003 well we needed a current speed field too(for when in car)... a current skin (although this one could only be sent when u changed it ...), and as Robpol86 said current (xyz) position ... well im not seing what more do we need ? anybody ? Link to comment
Aba|)|)on Posted September 30, 2003 Share Posted September 30, 2003 youre forgetting that there is 360 degrees and only 255 combos of a byte Link to comment
MasterEvilAce Posted September 30, 2003 Share Posted September 30, 2003 good call, but you could probably do 0 = looking NORTH on the map -90 = left 90 = right 180 = behind or something Link to comment
ldrancer Posted October 11, 2003 Share Posted October 11, 2003 i got a question about this netcode. does 24 packets a second mean, 24 frames per second allowable? what happens between one packet and the next that makes the game go dead; like the cars stopping and stuff. can you guys make some sort of thing inbetwen to let everything in the game still keep going? like pedestrian like, when they haul out of a car, it keeps giong in the ocean like when u shoot them. Link to comment
Guest Posted October 12, 2003 Share Posted October 12, 2003 no, the ammount of packets sent per second just "defines" how "smooth" the motion looks depending on how the server works (sending only to signal change, sending to update status ect) Link to comment
Recommended Posts