From 32b923d7bbbf596d4dd5b2a5604a7fead0685ece Mon Sep 17 00:00:00 2001 From: skyjake Date: Sat, 30 Aug 2003 15:11:14 +0000 Subject: [PATCH] Added BWR increment time window --- doomsday/Include/sv_frame.h | 2 ++ doomsday/Src/sv_main.c | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/doomsday/Include/sv_frame.h b/doomsday/Include/sv_frame.h index 272121a1ee..d552390d54 100644 --- a/doomsday/Include/sv_frame.h +++ b/doomsday/Include/sv_frame.h @@ -4,6 +4,8 @@ #ifndef __DOOMSDAY_SERVER_FRAME_H__ #define __DOOMSDAY_SERVER_FRAME_H__ +extern int bwrAdjustTime; + void Sv_TransmitFrame(void); int Sv_GetMaxFrameSize(int playerNumber); diff --git a/doomsday/Src/sv_main.c b/doomsday/Src/sv_main.c index b5307e2e92..a4e111f871 100644 --- a/doomsday/Src/sv_main.c +++ b/doomsday/Src/sv_main.c @@ -652,6 +652,7 @@ void Sv_StartNetGame() memset(clients[i].name, 0, sizeof(clients[i].name)); players[i].flags &= ~DDPF_CAMERA; clients[i].bandwidthRating = BWR_DEFAULT; + clients[i].bwrAdjustTime = 0; memset(clients[i].ackTimes, 0, sizeof(clients[i].ackTimes)); } gametic = 0; @@ -707,8 +708,13 @@ void Sv_Ticker(void) { if(!players[i].ingame || !players[i].mo) continue; players[i].lastangle = players[i].mo->angle; + + if(clients[i].bwrAdjustTime > 0) + { + // BWR adjust time tics away. + clients[i].bwrAdjustTime--; + } } - /* Sv_PoolTicker(); */ } /* @@ -764,9 +770,13 @@ boolean Sv_CheckBandwidth(int playerNumber) } // If the send queue is practically empty, we can use more bandwidth. - if(qSize < limit/20) + // (Providing we have BWR adjust time.) + if(qSize < limit/20 && client->bwrAdjustTime > 0) { client->bandwidthRating++; + + // Increase BWR only once during the adjust time. + client->bwrAdjustTime = 0; } // Do not go past the boundaries, though. @@ -780,7 +790,7 @@ boolean Sv_CheckBandwidth(int playerNumber) } // New messages will not be sent if there's too much already. - return qSize <= 5*limit; + return qSize <= 10*limit; } /*