Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7680 in orxonox.OLD for branches/network/src


Ignore:
Timestamp:
May 18, 2006, 2:10:11 PM (19 years ago)
Author:
patrick
Message:

network: network manager now runs with its own frequency

Location:
branches/network/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/lib/network/netdefs.h

    r7402 r7680  
    1818
    1919#define MAX_CONNECTIONS 1000
     20
     21#define NETWORK_FREQUENCY 33
    2022
    2123
  • branches/network/src/lib/network/network_manager.cc

    r7540 r7680  
    5252  this->defaultSyncStream = NULL;
    5353  this->sharedNetworkData = SharedNetworkData::getInstance();
     54  this->elapsedTime = 0.0f;
    5455
    5556  PRINTF(0)("NetworkManager created\n");
     
    123124/**
    124125 *  sync the network
     126 *  @param dtS: the seceonds elapsed since the last synchronize call
    125127 */
    126 void NetworkManager::synchronize()
     128void NetworkManager::synchronize( float dtS)
    127129{
     130  this->elapsedTime += dtS;
     131  if( likely(this->elapsedTime < 1.0f / NETWORK_FREQUENCY))
     132    return;
     133  this->elapsedTime = 0.0f;
     134
    128135  if (this->netStreamList != NULL || (this->netStreamList = ClassList::getList(CL_NETWORK_STREAM)) != NULL)
    129136  {
  • branches/network/src/lib/network/network_manager.h

    r7256 r7680  
    4545
    4646    void connectSynchronizeable(Synchronizeable& sync);
    47     void synchronize();
     47    void synchronize(float dtS);
    4848
    4949    void debug();
     
    6161
    6262    SharedNetworkData*               sharedNetworkData;       //!< reference to the shared data
     63    float                            elapsedTime;             //!< elapsed time since the last network update
    6364};
    6465
  • branches/network/src/story_entities/multi_player_world.cc

    r7287 r7680  
    8181void MultiPlayerWorld::synchronize()
    8282{
    83   NetworkManager::getInstance()->synchronize();
     83  NetworkManager::getInstance()->synchronize(this->dtS);
    8484}
    8585
Note: See TracChangeset for help on using the changeset viewer.