From 51e14c9d7aab75fe60f68d4943759eef66eafe9a Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Fri, 5 Feb 2010 22:20:07 +0100 Subject: Fixed the low framerate problem by not waiting for network events The enet service loop was waiting up to 10ms for a new network packet to come in. There is no need for this, so just remove it. Raised the framerate from about 60 to over 200 fps for me. --- src/net/manaserv/network.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/net/manaserv/network.cpp') diff --git a/src/net/manaserv/network.cpp b/src/net/manaserv/network.cpp index 5bf411cb..ddadc007 100644 --- a/src/net/manaserv/network.cpp +++ b/src/net/manaserv/network.cpp @@ -142,8 +142,8 @@ void flush() { ENetEvent event; - // Wait up to 10 milliseconds for an event. - while (enet_host_service(client, &event, 10) > 0) + // Check if there are any new events + while (enet_host_service(client, &event, 0) > 0) { switch (event.type) { @@ -164,11 +164,7 @@ void flush() break; case ENET_EVENT_TYPE_NONE: - logger->log("No event during 10 milliseconds."); - break; - default: - logger->log("Unhandled enet event."); break; } } -- cgit v1.2.3-70-g09d2