Skip to content

Commit

Permalink
Added BWR increment time window
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Aug 30, 2003
1 parent ceb0d40 commit 32b923d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions doomsday/Include/sv_frame.h
Expand Up @@ -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);

Expand Down
16 changes: 13 additions & 3 deletions doomsday/Src/sv_main.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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(); */
}

/*
Expand Down Expand Up @@ -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.
Expand All @@ -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;
}

/*
Expand Down

0 comments on commit 32b923d

Please sign in to comment.