Planet
navihomeaboutscreenshotsdownloaddevelopmentforum

Changeset 3066

Show
Ignore:
Timestamp:
05/25/09 18:05:11 (4 years ago)
Author:
scheusso
Message:

trying to reduce network delays/lags

Location:
code/branches/netp3/src/network
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • code/branches/netp3/src/network/Client.cc

    r3045 r3066  
    158158        FunctionCallManager::sendCalls(); 
    159159      } 
    160       ENetEvent *event; 
     160    } 
     161     
     162    ENetEvent *event; 
    161163    // stop if the packet queue is empty 
    162       while(!(client_connection.queueEmpty())){ 
    163         event = client_connection.getEvent(); 
    164         COUT(5) << "tick packet size " << event->packet->dataLength << std::endl; 
    165         packet::Packet *packet = packet::Packet::createPacket(event->packet, event->peer); 
     164    while(!(client_connection.queueEmpty())){ 
     165      event = client_connection.getEvent(); 
     166      COUT(5) << "tick packet size " << event->packet->dataLength << std::endl; 
     167      packet::Packet *packet = packet::Packet::createPacket(event->packet, event->peer); 
    166168      // note: packet commits suicide here except for the GameState. That is then deleted by a GamestateHandler 
    167         bool b = packet->process(); 
    168         assert(b); 
    169       } 
    170       if(gamestate.processGamestates()) 
    171       { 
    172         if(!isSynched_) 
    173           isSynched_=true; 
    174       } 
    175       gamestate.cleanup(); 
     169      bool b = packet->process(); 
     170      assert(b); 
    176171    } 
     172    if(gamestate.processGamestates()) 
     173    { 
     174      if(!isSynched_) 
     175        isSynched_=true; 
     176    } 
     177    gamestate.cleanup(); 
    177178 
    178179    return; 
  • code/branches/netp3/src/network/Host.h

    r2990 r3066  
    3737 
    3838  const int CLIENTID_SERVER = 0; 
    39   const unsigned int NETWORK_FREQUENCY = 25; 
     39  const unsigned int NETWORK_FREQUENCY = 30; 
    4040  const float NETWORK_PERIOD = 1.0f/NETWORK_FREQUENCY; 
    4141 
  • code/branches/netp3/src/network/Server.cc

    r3045 r3066  
    155155  void Server::update(const Clock& time) { 
    156156    processQueue(); 
     157    gamestates_->processGamestates(); 
    157158    //this steers our network frequency 
    158159    timeSinceLastUpdate_+=time.getDeltaTime(); 
    159160    if(timeSinceLastUpdate_>=NETWORK_PERIOD){ 
    160161      timeSinceLastUpdate_ -= static_cast<unsigned int>( timeSinceLastUpdate_ / NETWORK_PERIOD ) * NETWORK_PERIOD; 
    161       gamestates_->processGamestates(); 
    162162      updateGamestate(); 
    163163      FunctionCallManager::sendCalls();