Limit node-frame iterations per second

This commit is contained in:
momo5502 2016-02-20 01:26:42 +01:00
parent 0ec1029a89
commit 816c9ce430
2 changed files with 6 additions and 0 deletions

View File

@ -226,6 +226,11 @@ namespace Components
void Node::FrameHandler() void Node::FrameHandler()
{ {
// Frame limit
static int lastFrame = 0;
if ((Game::Com_Milliseconds() - lastFrame) < (1000 / NODE_FRAME_LOCK)) return;
lastFrame = Game::Com_Milliseconds();
int registerCount = 0; int registerCount = 0;
int listQueryCount = 0; int listQueryCount = 0;

View File

@ -2,6 +2,7 @@
#define NODE_QUERY_TIMEOUT 1000 * 30 * 1 // Invalidate nodes after 30 seconds without query response #define NODE_QUERY_TIMEOUT 1000 * 30 * 1 // Invalidate nodes after 30 seconds without query response
#define NODE_INVALID_DELETE 1000 * 60 * 10 // Delete invalidated nodes after 10 minutes #define NODE_INVALID_DELETE 1000 * 60 * 10 // Delete invalidated nodes after 10 minutes
#define NODE_FRAME_QUERY_LIMIT 1 // Limit of nodes to be queried per frame #define NODE_FRAME_QUERY_LIMIT 1 // Limit of nodes to be queried per frame
#define NODE_FRAME_LOCK 80 // Limit of max frames per second
#define NODE_PACKET_LIMIT 111 // Send 111 nodes per synchronization packet #define NODE_PACKET_LIMIT 111 // Send 111 nodes per synchronization packet
#define NODE_STORE_INTERVAL 1000 * 60* 1 // Store nodes every minute #define NODE_STORE_INTERVAL 1000 * 60* 1 // Store nodes every minute
#define SESSION_TIMEOUT 1000 * 10 // 10 seconds session timeout #define SESSION_TIMEOUT 1000 * 10 // 10 seconds session timeout