Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9396 in orxonox.OLD for branches/proxy/src


Ignore:
Timestamp:
Jul 23, 2006, 10:07:23 PM (18 years ago)
Author:
patrick
Message:

committing my weekends work: 2100 lines :D

  • proxy server now accepts and synchronizes clients like a master server
  • network manager got different network setup interface
  • network stream got different constructure scheme
  • permissions checking and algorithm extended and changed
  • starting ability to connect to multiple network nodes at the same time
  • some very much smaller changes here and there
Location:
branches/proxy/src
Files:
3 added
3 deleted
36 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/defs/class_id.h

    r9347 r9396  
    127127  CL_NETWORK_MANAGER            =    0x00000050,
    128128  CL_SHARED_NETWORK_DATA        =    0x00000051,
    129   CL_PROXY_SETTINGS             =    0x00000052,
     129  CL_NETWORK_SETTINGS           =    0x00000052,
    130130  CL_ATMOSPHERIC_ENGINE         =    0x00000061,
    131131
  • branches/proxy/src/defs/globals.h

    r7661 r9396  
    4747
    4848#define   CONFIG_NAME_FULLSCREEN           "Fullscreen-mode"
     49#define   CONFIG_NAME_NO_RENDER            "Norender-mode"
    4950#define   CONFIG_NAME_RESOLUTION           "Resolution"
    5051#define   CONFIG_NAME_WIREFRAME            "WireFrame-mode"
  • branches/proxy/src/lib/graphics/graphics_engine.cc

    r9351 r9396  
    6666  this->bDisplayFPS = false;
    6767  this->bAntialiasing = false;
     68  this->bDedicated = false;
    6869  this->minFPS = 9999;
    6970  this->maxFPS = 0;
     
    163164  MultiType textures = Preferences::getInstance()->getString(CONFIG_SECTION_VIDEO_ADVANCED, CONFIG_NAME_TEXTURES, "1");
    164165  Texture::setTextureEnableState(textures.getBool());
     166
     167  // check it is a dedicated network node: so no drawings are made
     168  MultiType dedicated = Preferences::getInstance()->getString(CONFIG_SECTION_VIDEO, CONFIG_NAME_NO_RENDER, "0");
     169  this->bDedicated = dedicated.getBool();
    165170
    166171  // searching for a usefull resolution
     
    603608}
    604609
     610/**
     611 * this draws the graphics engines graphics effecs
     612 */
    605613void GraphicsEngine::draw() const
    606614{
    607   //  LightManager::getInstance()->draw();
    608 
    609   if (this->graphicsEffects != NULL)
     615  if( this->graphicsEffects != NULL)
    610616  {
    611617    //draw the graphics effects
  • branches/proxy/src/lib/graphics/graphics_engine.h

    r9351 r9396  
    4646    void toggleFullscreen();
    4747    static void setBackgroundColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha = 1.0);
     48    inline bool isDedicated() { return this->bDedicated; }
    4849
    4950    inline void setAntialiasing(bool flag) { this->bAntialiasing = flag; }
     
    114115    bool                       particlesEnabled;   //!< If particles should be enabled.
    115116    bool                       bAntialiasing;      //!< true if antialiasing enabled
     117    bool                       bDedicated;         //!< true if this server is a dedicated server and should not render the scene
    116118
    117119    int                        particlesValue;     //!< How many particles
  • branches/proxy/src/lib/gui/qt/gui_video.cc

    r8362 r9396  
    5050      layout->addWidget(fullscreen, 0, 0);
    5151
     52      QtGuiCheckBox* dedicated = new QtGuiCheckBox(CONFIG_NAME_NO_RENDER, this, false);
     53      //fullscreen->setName();
     54      layout->addWidget(dedicated, 1, 0);
     55
    5256      QtGuiCheckBox* wireframe = new QtGuiCheckBox(CONFIG_NAME_WIREFRAME, this, false);
    53       layout->addWidget(wireframe, 1, 0);
     57      layout->addWidget(wireframe, 2, 0);
    5458
    5559      {
    5660        QComboBox* resolution = new QtGuiComboBox(CONFIG_NAME_RESOLUTION, this, "640x480");
    5761        resolution->setEditable(true);
    58         layout->addWidget(resolution, 2, 0);
     62        layout->addWidget(resolution, 3, 0);
    5963        std::vector<QString> resolutions;
    6064        this->getResolutions(resolutions);
  • branches/proxy/src/lib/network/Makefile.am

    r9393 r9396  
    2626                      udp_broadcast.cc \
    2727                      \
    28                       proxy/proxy_settings.cc \
     28                      proxy/network_settings.cc \
    2929                      \
    30                       monitor/connection_monitor.cc \
     30                                  monitor/connection_monitor.cc \
    3131                      monitor/network_monitor.cc \
    3232                      monitor/network_node.cc \
     
    7575                udp_broadcast.h \
    7676                \
    77                 proxy/proxy_settings.cc \
     77                proxy/network_settings.cc \
    7878                \
    7979                monitor/connection_monitor.h \
  • branches/proxy/src/lib/network/converter.cc

    r9357 r9396  
    1010
    1111### File Specific:
    12    main-programmer: Benjamin Wuest
    13    co-programmer: ...
     12   main-programmer: Benjamin Wuest (bwuest@ee.ethz.ch)
     13   co-programmer: Christoph Renner (rennerc@ee.ethz.ch)
    1414*/
    1515
     
    3838{
    3939  /* set the class id for the base object */
    40   //this->setClassID(CL_ENTITY_MANAGER, "EntityManager");
    4140}
    4241
  • branches/proxy/src/lib/network/handshake.cc

    r9367 r9396  
    3131  /* set the class id for the base object */
    3232  this->setClassID(CL_HANDSHAKE, "Handshake");
     33
    3334
    3435  // register all variable handlers
  • branches/proxy/src/lib/network/handshake.h

    r9367 r9396  
    8080    inline bool redirect() { return this->redirectProxy;}
    8181    /** @param flag: indicating if the client should be redirected */
    82     inline void setRedirect(bool flag) { this->redirectProxy = (int)flag; }
     82    inline void setRedirect(bool flag) { if( SharedNetworkData::getInstance()->isClient()) return; this->redirectProxy = (int)flag; }
    8383
    8484    /** @param address: the address of the proxy server 1 if any */
    85     inline void setProxy1Address(IP address) { if( !SharedNetworkData::getInstance()->isMasterServer()) return; this->proxy1 = address; }
     85    inline void setProxy1Address(IP address) { if( SharedNetworkData::getInstance()->isClient()) return; this->proxy1 = address; }
    8686    /** @returns the address of the proxy server 1 if any */
    8787    inline IP getProxy1Address() { return this->proxy1; }
    8888    /** @param address: the address of the proxy server 2 if any */
    89     inline void setProxy2Address(IP address) { this->proxy2 = address; }
     89    inline void setProxy2Address(IP address) { if( SharedNetworkData::getInstance()->isClient()) return; this->proxy2 = address; }
    9090    /** @returns the address of the proxy server 2 if any */
    9191    inline IP getProxy2Address() { return this->proxy2; }
  • branches/proxy/src/lib/network/monitor/network_monitor.cc

    r9373 r9396  
    1919#include "debug.h"
    2020
    21 #include "proxy/proxy_settings.h"
     21#include "proxy/network_settings.h"
    2222#include "shared_network_data.h"
    2323
     
    5757  {
    5858    // assuming that the config files are already read we get the proxy servers
    59     std::vector<IPaddress*>* proxyList = ProxySettings::getInstance()->getProxyList();
     59    std::vector<IPaddress*>* proxyList = NetworkSettings::getInstance()->getProxyList();
    6060    std::vector<IPaddress*>::iterator it = proxyList->begin();
    6161    // create a peer info class and a network node class for each new proxy and add them to the passive list
  • branches/proxy/src/lib/network/monitor/network_monitor.h

    r9347 r9396  
    5555    inline void removeMasterServer(NetworkNode* node, PeerInfo* pInfo) { node->removeMasterServer(pInfo); }
    5656
     57    PeerInfo* getFirstChoiceProxy();
     58    PeerInfo* getSecondChoiceProxy();
     59
     60    /** @returns the active proxy server list of the localnode */
     61    inline std::list<PeerInfo*> getActiveProxyServer() { return this->localNode->getActiveProxyServer(); }
     62
    5763    /* slots admin and info interface */
    5864    /** @returns the total number of players in this game (including all proxy servers etc)*/
     
    6369    /** @param node node to be checked for slots @returns true if there are still free network slots available at this node */
    6470    inline bool gotFreeSlots(NetworkNode* node) { return (node->getPlayerNumber() < SharedNetworkData::getInstance()->getMaxPlayer())?true:false; }
    65     PeerInfo* getFirstChoiceProxy();
    66     PeerInfo* getSecondChoiceProxy();
     71
    6772    /** @returns true if the next client should be reconnected to some other proxy server with more connections */
    6873    inline bool isReconnectNextClient() { return (this->localNode->getPlayerNumber() >= SharedNetworkData::getInstance()->getMaxPlayer())?true:false; }
  • branches/proxy/src/lib/network/monitor/network_node.h

    r9347 r9396  
    3737    PeerInfo* getMasterServer(int index);
    3838
     39    /** @returns the master server list */
     40    inline std::list<PeerInfo*> getMasterServer() { return this->masterServerList; }
     41    /** @returns the active proxy server list */
     42    inline std::list<PeerInfo*> getActiveProxyServer() { return this->activeProxyServerList; }
     43    /** @returns the passive proxy server list */
     44    inline std::list<PeerInfo*> getPassiveProxyServer() { return this->passiveProxyServerList; }
     45    /** @returns the client list */
     46    inline std::list<PeerInfo*> getClient() { return this->clientList; }
     47
     48
    3949    /** @returns the number of players */
    4050    inline int getPlayerNumber() { return this->playerNumber; }
  • branches/proxy/src/lib/network/network_game_manager.cc

    r9371 r9396  
    9191bool NetworkGameManager::signalNewPlayer( int userId )
    9292{
    93   assert( SharedNetworkData::getInstance()->isMasterServer() );
     93  assert( SharedNetworkData::getInstance()->isMasterServer() ||  SharedNetworkData::getInstance()->isProxyServer());
    9494  assert( State::getGameRules() );
    9595  assert( State::getGameRules()->isA( CL_NETWORK_GAME_RULES ) );
     
    168168bool NetworkGameManager::delSynchronizeableHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId )
    169169{
    170   if ( SharedNetworkData::getInstance()->isMasterServer() )
     170  if ( SharedNetworkData::getInstance()->isMasterServer() ||  SharedNetworkData::getInstance()->isProxyServer())
    171171  {
    172172    PRINTF(2)("Recieved DeleteSynchronizeable message from client %d!\n", userId);
     
    229229bool NetworkGameManager::preferedTeamHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId )
    230230{
    231   assert( SharedNetworkData::getInstance()->isMasterServer() );
     231  assert( SharedNetworkData::getInstance()->isMasterServer() ||  SharedNetworkData::getInstance()->isProxyServer());
    232232
    233233  int teamId = 0;
     
    261261void NetworkGameManager::prefereTeam( int teamId )
    262262{
    263   if ( SharedNetworkData::getInstance()->isMasterServer() )
     263  if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
    264264    setPreferedTeam( SharedNetworkData::getInstance()->getHostID(), teamId );
    265265  else
     
    305305{
    306306  PRINTF(0)("NetworkGameManager::chatMessageHandler %d %d\n", userId, SharedNetworkData::getInstance()->getHostID() );
    307   if ( SharedNetworkData::getInstance()->isMasterServer() && userId !=  SharedNetworkData::getInstance()->getHostID() )
     307  if ( (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer()) && userId !=  SharedNetworkData::getInstance()->getHostID() )
    308308  {
    309309    MessageManager::getInstance()->sendMessage( messageId, data, dataLength, RT_ALL_NOT_ME, 0, MP_HIGHBANDWIDTH );
     
    347347  assert( Converter::stringToByteArray(message, buf+2*INTSIZE, message.length()+INTSIZE) == message.length()+INTSIZE );
    348348
    349   if ( SharedNetworkData::getInstance()->isMasterServer() )
     349  if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
    350350    MessageManager::getInstance()->sendMessage( MSGID_CHATMESSAGE, buf, message.length()+3*INTSIZE, RT_ALL_ME, 0, MP_HIGHBANDWIDTH );
    351351  else
  • branches/proxy/src/lib/network/network_manager.cc

    r9357 r9396  
    1010
    1111   ### File Specific:
    12    main-programmer: Patrick Boenzli
    13    co-programmer: ...
     12   main-programmer: Patrick Boenzli (patrick@orxonox.ethz.ch)
     13   co-programmer: Christoph Renner (rennerc@ee.ethz.ch)
    1414*/
    1515
     
    9898
    9999
     100
     101/**
     102 *  creates a new NetworkStream of server type
     103 * @param port: number of the TCP port
     104 */
     105int NetworkManager::createMasterServer(unsigned int port)
     106{
     107  // init the proxy settings data do this before everything else is done here
     108  NetworkSettings::getInstance()->loadData();
     109
     110  // create the network stream
     111  this->networkStream = new NetworkStream(NET_MASTER_SERVER);
     112  this->networkStream->createServer( port);
     113
     114  // start the network game manager
     115  this->networkStream->createNetworkGameManager();
     116
     117  PRINTF(0)("Created Network Master Server\n");
     118  SDL_Delay(20);
     119  return 1;
     120}
     121
     122/**
     123 *  creates a new network stream of proxy server type
     124 * @param port: number of the TCP port
     125 */
     126int NetworkManager::createProxyServer(unsigned int port)
     127{
     128  // init the proxy settings data do this before everything else is done here
     129  NetworkSettings::getInstance()->loadData();
     130
     131  // create the network stream
     132  this->networkStream = new NetworkStream(NET_PROXY_SERVER_ACTIVE);
     133  this->networkStream->createServer( port);
     134  // and connect to the master server for synchronization
     135//   this->networkStream->connectToMasterServer(NetworkSettings::getInstance()->getMasterAddr());
     136  // and to the other proxy servers
     137
     138
     139
     140  // start the network game manager
     141  this->networkStream->createNetworkGameManager();
     142
     143
     144  PRINTF(0)("Created Network Proxy Server\n");
     145  SDL_Delay(20);
     146  return 1;
     147}
     148
     149
    100150/**
    101151 *  creates a connection from one object to a host
    102152 * @param hostName: the name of the destination host
    103153 */
    104 int NetworkManager::establishConnection(const std::string & name, unsigned int port)
    105 {
    106   this->networkStream = new NetworkStream( name, port );
    107   SharedNetworkData::getInstance()->setDefaultSyncStream(this->networkStream);
     154int NetworkManager::createClient(const std::string & name, unsigned int port)
     155{
     156  // create the network stream
     157  this->networkStream = new NetworkStream(NET_CLIENT);
     158  // connect to the master server, if a redirection should occure, this is handled in the NetworkStream itself
     159  this->networkStream->connectToMasterServer( name, port);
     160
     161  // and start the handshake
    108162  this->networkStream->startHandshake();
     163
     164  PRINTF(0)("Created Network Client");
    109165  return 1;
    110166}
     
    112168
    113169/**
    114  *  creates a new NetworkStream of server type
    115  * @param port: number of the TCP port
    116  */
    117 int NetworkManager::createServer(unsigned int port)
    118 {
    119   SharedNetworkData::getInstance()->setHostID(0);
    120   SharedNetworkData::getInstance()->setNodeType(NET_MASTER_SERVER);
    121   this->networkStream = new NetworkStream(port);
    122   SharedNetworkData::getInstance()->setDefaultSyncStream(this->networkStream);
    123   this->networkStream->createNetworkGameManager();
    124   PRINTF(0)("CREATE SERVER\n");
    125   SDL_Delay(20);
    126   return 1;
    127 }
    128 
    129 
     170 * connects a synchronizeable to the network stream
     171 * @param sync: synchronizeable to connect
     172 */
    130173void NetworkManager::connectSynchronizeable(Synchronizeable& sync)
    131174{
     
    144187  if( likely(this->elapsedTime < 1.0f / NETWORK_FREQUENCY))
    145188    return;
     189
    146190  this->elapsedTime = 0.0f;
    147191
    148   if ( networkStream )
     192  if ( this->networkStream )
    149193    networkStream->processData();
    150194
  • branches/proxy/src/lib/network/network_manager.h

    r9347 r9396  
    3636    void shutdown();
    3737
    38     int establishConnection( const std::string & name, unsigned int port);
    39     int createServer(unsigned int port);
    40 
    41     /** Returns the hostID @return The hostID of the object */
    42     inline int getHostID() { return SharedNetworkData::getInstance()->getHostID(); }
    43     inline bool isMasterServer() { return SharedNetworkData::getInstance()->isMasterServer(); }
    44     inline bool isProxyServer() { return SharedNetworkData::getInstance()->isProxyServer(); }
    45     inline bool isClient() { return SharedNetworkData::getInstance()->isClient(); }
    46 
     38    int createClient( const std::string & name, unsigned int port);
     39    int createMasterServer( unsigned int port);
     40    int createProxyServer( unsigned int port);
    4741
    4842    void connectSynchronizeable(Synchronizeable& sync);
     
    5852  private:
    5953    static NetworkManager*           singletonRef;            //!< Pointer to the only instance of this Class
    60     NetworkStream*                   networkStream;       //!< pointer to network stream
     54    NetworkStream*                   networkStream;           //!< pointer to network stream
    6155
    6256    float                            elapsedTime;             //!< elapsed time since the last network update
  • branches/proxy/src/lib/network/network_stream.cc

    r9386 r9396  
    7070
    7171
    72 /**
    73  * start as a client, connect to a server
    74  *  @param host: host name (address)
    75  *  @param port: port number
    76  */
    77 NetworkStream::NetworkStream( std::string host, int port )
     72NetworkStream::NetworkStream( int nodeType)
    7873{
    7974  this->init();
    80   // init the peers[0] the server to ceonnect to
    81   this->peers[0].socket = new UdpSocket( host, port );
    82   this->peers[0].userId = 0;
    83   this->peers[0].nodeType = NET_MASTER_SERVER;
    84   this->peers[0].connectionMonitor = new ConnectionMonitor( 0 );
    85   this->peers[0].ip = this->peers[0].socket->getRemoteAddress();
    86   // and set also the localhost
    87   this->pInfo->nodeType = NET_CLIENT;
     75
     76  this->pInfo->nodeType = nodeType;
     77
     78  switch( nodeType)
     79  {
     80    case NET_MASTER_SERVER:
     81      // init the shared network data
     82      SharedNetworkData::getInstance()->setHostID(0);
     83      SharedNetworkData::getInstance()->setNodeType(NET_MASTER_SERVER);
     84      break;
     85
     86    case NET_PROXY_SERVER_ACTIVE:
     87      // init the shared network data
     88      SharedNetworkData::getInstance()->setHostID(0);
     89      SharedNetworkData::getInstance()->setNodeType(NET_PROXY_SERVER_ACTIVE);
     90      break;
     91    case NET_PROXY_SERVER_PASSIVE:
     92            // init the shared network data
     93      SharedNetworkData::getInstance()->setHostID(0);
     94      SharedNetworkData::getInstance()->setNodeType(NET_PROXY_SERVER_PASSIVE);
     95      break;
     96    case NET_CLIENT:
     97      SharedNetworkData::getInstance()->setNodeType(NET_CLIENT);
     98      break;
     99  }
     100
     101  SharedNetworkData::getInstance()->setDefaultSyncStream(this);
     102
    88103  // get the local ip address
    89104  IPaddress ip;
    90   SDLNet_ResolveHost( &ip, NULL, port );
     105  SDLNet_ResolveHost( &ip, NULL, 0);
    91106  this->pInfo->ip = ip;
    92107}
    93108
    94 
    95 /**
    96  * start as a server
    97  *  @param port: at this port
    98  */
    99 NetworkStream::NetworkStream( int port )
    100 {
    101   this->init();
    102   this->serverSocket = new UdpServerSocket(port);
    103   this->pInfo->nodeType = NET_MASTER_SERVER;
    104   // get the local ip address
    105   IPaddress ip;
    106   SDLNet_ResolveHost( &ip, NULL, port );
    107   this->pInfo->ip = ip;
    108 }
    109109
    110110
     
    182182
    183183/**
     184 * establish a connection to a remote master server
     185 * @param host: host name
     186 * @param port: the port number
     187 */
     188void NetworkStream::connectToMasterServer(std::string host, int port)
     189{
     190  int node = this->peers.size();
     191  this->peers[node].socket = new UdpSocket( host, port );
     192  this->peers[node].userId = 0;
     193
     194  this->peers[node].nodeType = NET_MASTER_SERVER;
     195  this->peers[node].connectionMonitor = new ConnectionMonitor( 0 );
     196  this->peers[node].ip = this->peers[node].socket->getRemoteAddress();
     197}
     198
     199
     200/**
     201 * establish a connection to a remote proxy server
     202 * @param host: host name
     203 * @param port: the port number
     204 */
     205void NetworkStream::connectToProxyServer(std::string host, int port)
     206{
     207  int node = this->peers.size();
     208  this->peers[node].socket = new UdpSocket( host, port );
     209  this->peers[node].userId = 0;
     210
     211  this->peers[node].nodeType = NET_PROXY_SERVER_ACTIVE;
     212  this->peers[node].connectionMonitor = new ConnectionMonitor( 0 );
     213  this->peers[node].ip = this->peers[node].socket->getRemoteAddress();
     214}
     215
     216
     217/**
     218 * create a server
     219 * @param port: interface port for all clients
     220 */
     221void NetworkStream::createServer(int port)
     222{
     223  this->serverSocket = new UdpServerSocket(port);
     224}
     225
     226
     227/**
    184228 * creates a new instance of the network game manager
    185229 */
     
    187231{
    188232  this->networkGameManager = NetworkGameManager::getInstance();
    189   // setUniqueID( maxCon+2 ) because we need one id for every handshake
    190   // and one for handshake to reject client maxCon+1
     233
    191234  this->networkGameManager->setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() );
    192235  MessageManager::getInstance()->setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() );
     
    260303  }
    261304
    262   if ( this->pInfo->nodeType == NET_MASTER_SERVER )
     305  if ( this->pInfo->isMasterServer())
    263306  {
    264307    // execute everytthing the master server shoudl do
     
    268311    this->updateConnectionList();
    269312  }
    270   else if( this->pInfo->nodeType == NET_PROXY_SERVER_ACTIVE)
     313  else if( this->pInfo->isProxyServer())
    271314  {
    272315    // execute everything the proxy server should do
     316    if ( serverSocket )
     317      serverSocket->update();
     318
     319    this->updateConnectionList();
    273320  }
    274321  else
     
    442489void NetworkStream::debug()
    443490{
    444   if( this->isMasterServer())
    445     PRINT(0)(" Host ist Server with ID: %i\n", this->pInfo->userId);
    446   else
     491  if( SharedNetworkData::getInstance()->isMasterServer()) {
     492    PRINT(0)(" Host ist Master Server with ID: %i\n", this->pInfo->userId);
     493  }
     494  else if( SharedNetworkData::getInstance()->isProxyServer()) {
     495    PRINT(0)(" Host ist Proxy Server with ID: %i\n", this->pInfo->userId);
     496  }
     497  else {
    447498    PRINT(0)(" Host ist Client with ID: %i\n", this->pInfo->userId);
     499  }
    448500
    449501  PRINT(0)(" Got %i connected Synchronizeables, showing active Syncs:\n", this->synchronizeables.size());
     
    493545          {
    494546
    495             if ( this->pInfo->nodeType == NET_CLIENT )
     547            if ( this->pInfo->isClient() )
    496548            {
    497 
    498549              SharedNetworkData::getInstance()->setHostID( it->second.handshake->getHostId() );
    499550              this->pInfo->userId = SharedNetworkData::getInstance()->getHostID();
     
    528579            if ( it->second.handshake->canDel() )
    529580            {
    530               if ( this->pInfo->nodeType == NET_MASTER_SERVER )
     581
     582              if ( this->pInfo->isMasterServer() )
     583              {
     584                it->second.nodeType = it->second.handshake->getRemoteNodeType();
     585                it->second.ip = it->second.socket->getRemoteAddress();
     586
     587                this->networkMonitor->addNode(&it->second);
     588
     589                this->handleNewClient( it->second.userId );
     590
     591                if ( PlayerStats::getStats( it->second.userId ) && it->second.handshake->getPreferedNickName() != "" )
     592                {
     593                  PlayerStats::getStats( it->second.userId )->setNickName( it->second.handshake->getPreferedNickName() );
     594                }
     595              }
     596              else if ( this->pInfo->isProxyServer() )
    531597              {
    532598                it->second.nodeType = it->second.handshake->getRemoteNodeType();
     
    639705        continue;
    640706
    641       // if we are a server and this is not our handshake
    642       if ( isMasterServer() && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId )
     707      // if we are a server (both master and proxy servers) and this is not our handshake
     708      if ( ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer() ) && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId )
    643709        continue;
    644710
     
    654720
    655721      // server fakes uniqueid == 0 for handshake
    656       if ( this->isMasterServer() && sync.getUniqueID() < SharedNetworkData::getInstance()->getMaxPlayer() - 1 )
     722      if ( ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer() ) && sync.getUniqueID() < SharedNetworkData::getInstance()->getMaxPlayer() - 1 )
    657723        n = Converter::intToByteArray( 0, buf + offset, UDP_PACKET_SIZE - offset );
    658724      else
     
    703769    // now compress the data with the zip library
    704770    int compLength = 0;
    705     if ( this->isMasterServer() )
     771    if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
    706772      compLength = Zip::getInstance()->zip( buf, offset, compBuf, UDP_PACKET_SIZE, dictServer );
    707773    else
     
    783849      }
    784850
    785       while ( offset + 2*INTSIZE < length )
     851      while ( offset + 2 * INTSIZE < length )
    786852      {
    787853        assert( offset > 0 );
     
    797863        Synchronizeable * sync = NULL;
    798864
     865        // look for the synchronizeable in question
    799866        for ( SynchronizeableList::iterator it = synchronizeables.begin(); it != synchronizeables.end(); it++ )
    800867        {
     
    807874        }
    808875
     876        // this synchronizeable does not yet exist! create it
    809877        if ( sync == NULL )
    810878        {
    811879          PRINTF(0)("could not find sync with id %d. try to create it\n", uniqueId);
     880
     881          // if it is an old synchronizeable already removed, ignore it
    812882          if ( oldSynchronizeables.find( uniqueId ) != oldSynchronizeables.end() )
    813883          {
     
    816886          }
    817887
    818           if ( !peers[peer->second.userId].isMasterServer() )
     888          // if the node we got this unknown sync from is a client we ignore it (since it has no rights to create a new sync)
     889          if ( peers[peer->second.userId].isClient() )
    819890          {
    820891            offset += syncDataLength;
     
    833904          assert( leafClassId != 0 );
    834905
     906
    835907          BaseObject * b = NULL;
    836908          /* These are some small exeptions in creation: Not all objects can/should be created via Factory */
     
    838910          if( leafClassId == CL_NULL_PARENT || leafClassId == CL_SYNCHRONIZEABLE || leafClassId == CL_NETWORK_GAME_MANAGER )
    839911          {
    840             PRINTF(1)("Can not create Class with ID %x!\n", (int)leafClassId);
     912            PRINTF(1)("Don't create Object with ID %x, ignored!\n", (int)leafClassId);
    841913            offset += syncDataLength;
    842914            continue;
     
    913985  // do all game relevant stuff here
    914986  networkGameManager->signalNewPlayer( userId );
    915 
    916   // register the new client at the network monitor
    917 //   this->networkMonitor->addClient();
    918987}
    919988
  • branches/proxy/src/lib/network/network_stream.h

    r9347 r9396  
    3636  public:
    3737    NetworkStream();
    38     NetworkStream( std::string host, int port);
    39     NetworkStream( int port );
     38    NetworkStream(int nodeType);
     39    virtual ~NetworkStream();
    4040
    41     virtual ~NetworkStream();
    4241    void init();
     42
     43    void connectToMasterServer(std::string host, int port);
     44    void connectToProxyServer(std::string host, int port);
     45    void createServer(int port);
    4346
    4447    void createNetworkGameManager();
     
    4952    void disconnectSynchronizeable(Synchronizeable& sync);
    5053
    51     /* functions for the localhost settings */
    52     inline bool isMasterServer() const { return (this->pInfo->nodeType == NET_MASTER_SERVER)? true:false; }
    53     inline bool isProxyServer() const { return (this->pInfo->nodeType == NET_PROXY_SERVER_ACTIVE)? true:false; }
    54     inline bool isClient() const { return (this->pInfo->nodeType == NET_CLIENT)? true:false; }
    55 //     inline bool isActive() const { return this->bActive; }
    5654    inline int getMaxConnections(){ return SharedNetworkData::getInstance()->getMaxPlayer(); }
    5755
  • branches/proxy/src/lib/network/peer_info.h

    r9347 r9396  
    2424    inline bool isMasterServer() { return this->nodeType == NET_MASTER_SERVER; }
    2525    inline bool isProxyServer() { return this->nodeType == NET_PROXY_SERVER_ACTIVE; }
     26    inline bool isProxyServerPassive() { return this->nodeType == NET_PROXY_SERVER_PASSIVE; }
    2627    inline bool isClient() { return this->nodeType == NET_CLIENT; }
    2728
     
    3031
    3132  public:
    32     int                 userId;
    33     int                 nodeType;
    34     IP                  ip;
     33    int                 userId;                  //!< id of this network node
     34    int                 nodeType;                //!< type of this network node
     35    IP                  ip;                      //!> the ip address of this network node
    3536
    36     NetworkSocket *     socket;
    37     Handshake *         handshake;
    38     ConnectionMonitor * connectionMonitor;
     37    NetworkSocket *     socket;                  //!< socket connecting to this node
     38    Handshake *         handshake;               //!< the handshake object, active on connection setup
     39    ConnectionMonitor * connectionMonitor;       //!< ConnectionMonitor monitoring the current network traffic
    3940
    40     int                 lastAckedState;
    41     int                 lastRecvedState;
     41    int                 lastAckedState;          //!< last acked state synchronized state
     42    int                 lastRecvedState;         //!< last received state
    4243};
    4344
  • branches/proxy/src/lib/network/player_stats.cc

    r9386 r9396  
    191191void PlayerStats::setNickName( std::string nick )
    192192{
    193   if ( SharedNetworkData::getInstance()->isMasterServer() )
     193  if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer() )
    194194  {
    195195    this->nickName = nick;
  • branches/proxy/src/lib/network/shared_network_data.cc

    r9388 r9396  
    3434  this->setClassID(CL_SHARED_NETWORK_DATA, "SharedNetworkData");
    3535
     36  this->nodeType = NET_CLIENT;
    3637  this->hostID = -1;
    3738  this->defaultSyncStream = NULL;
    3839
    39 //   if( State::isOnline())
    40   this->newUniqueID = ProxySettings::getInstance()->getMaxPlayer() + 2;
    41 //   else
    42 //  this->newUniqueID = NET_MAX_CONNECTIONS + 2;
    43   this->nodeType = NET_CLIENT;
     40  // setUniqueID( maxCon+2 ) because we need one id for every handshake
     41  // and one for handshake to reject client maxCon+1
     42  this->newUniqueID = NetworkSettings::getInstance()->getMaxPlayer() + 2;
    4443}
    4544
  • branches/proxy/src/lib/network/shared_network_data.h

    r9388 r9396  
    99#include "base_object.h"
    1010#include "netdefs.h"
    11 #include "proxy/proxy_settings.h"
     11#include "proxy/network_settings.h"
    1212
    1313//!< maximal connectinons for the server
     
    4040
    4141    /** @returns the maximum number of players for this server */
    42     inline int getMaxPlayer() { return ProxySettings::getInstance()->getMaxPlayer(); }
     42    inline int getMaxPlayer() { return NetworkSettings::getInstance()->getMaxPlayer(); }
    4343
    4444    /** @returns the hostID of the node */
  • branches/proxy/src/lib/network/synchronizeable.cc

    r9386 r9396  
    1111
    1212### File Specific:
    13    main-programmer: Silvan Nellen
    14    co-programmer: Benjamin Wuest
     13   main-programmer: Christoph Renner (rennerc@ee.ethz.ch)
     14   co-programmer: Patrick Boenzli (patrick@orxonox.ethz.ch)
    1515*/
    1616
     
    7272    this->networkStream->disconnectSynchronizeable(*this);
    7373
    74     if ( SharedNetworkData::getInstance()->isMasterServer() && this->beSynchronized() && this->getUniqueID() > 0 && !this->isA( CL_MESSAGE_MANAGER ) )
     74    if ( (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer() )
     75           && this->beSynchronized() && this->getUniqueID() > 0 && !this->isA( CL_MESSAGE_MANAGER ) )
    7576      NetworkGameManager::getInstance()->removeSynchronizeable( this->getUniqueID() );
    7677  }
     
    112113
    113114
     115/**
     116 * creates a diff image from two states
     117 * @param userId: the userid of the user where the image will be sent to
     118 * @param data: the binary data array to write to
     119 * @param maxLength: maximal length of the data written (length of available space in the array)
     120 * @param stateId: the state id that this diff will represent
     121 * @param priorityTH: the priority threshold: all syncs below this threshold won't be synchronized
     122 *
     123 * @todo check for permissions
     124 */
    114125int Synchronizeable::getStateDiff( int userId, byte* data, int maxLength, int stateId, int fromStateId, int priorityTH )
    115126{
     
    189200  int n;
    190201
    191   bool hasPermission;
     202  bool hasPermission = false;
    192203  bool sizeChanged = false;
    193204
     
    195206  for ( SyncVarList::iterator it = syncVarList.begin(); it != syncVarList.end(); it++ )
    196207  {
    197     hasPermission = (
    198         SharedNetworkData::getInstance()->isMasterServer() && (*it)->checkPermission( PERMISSION_MASTER_SERVER ) ||
    199         this->owner == SharedNetworkData::getInstance()->getHostID() && (*it)->checkPermission( PERMISSION_OWNER ) ||
    200         SharedNetworkData::getInstance()->isMasterServer() && this->owner != userId && (*it)->checkPermission( PERMISSION_OWNER ) ||
    201             (*it)->checkPermission( PERMISSION_ALL )
    202                     );
     208    // DATA PERMISSIONS
     209    // check if this synchronizeable has the permissions to write the data
     210
     211    // first check MASTER_SERVER permissions
     212    if( SharedNetworkData::getInstance()->isMasterServer() && (*it)->checkPermission( PERMISSION_MASTER_SERVER ))
     213      hasPermission = true;
     214    // now check PROXY_SERVER permissions
     215    else if( SharedNetworkData::getInstance()->isProxyServer() && (*it)->checkPermission( PERMISSION_MASTER_SERVER ))
     216      hasPermission = true;
     217    // now check OWNER permissions
     218    else if( this->owner == SharedNetworkData::getInstance()->getHostID() && (*it)->checkPermission( PERMISSION_OWNER ))
     219      hasPermission = true;
     220    // now check ALL permissions
     221    else if( (*it)->checkPermission( PERMISSION_ALL ))
     222      hasPermission = true;
     223    // SPECIAL: get write permissions if i am master server and i am able to overwrite the client stuff
     224    else if( SharedNetworkData::getInstance()->isMasterServer() && this->owner != userId && (*it)->checkPermission( PERMISSION_OWNER ))
     225      hasPermission = true;
     226    // SPECIAL: get write permissions if i am proxy server and i am able to overwrite the client stuff
     227    else if( SharedNetworkData::getInstance()->isProxyServer()  && this->owner != userId && (*it)->checkPermission( PERMISSION_OWNER ))
     228      hasPermission = true;
     229    else
     230      hasPermission = false;
     231
    203232
    204233    if ( sizeIter == stateFrom->sizeList.end() || *sizeIter != (*it)->getSize() )
     
    209238      n = (*it)->writeToBuf( stateTo->data+i, stateTo->dataLength - i );
    210239      //NETPRINTF(0)("getvar %s %d\n", (*it)->getName().c_str(), n);
    211       PRINTF(0)("getvar %s %d\n", (*it)->getName().c_str(), n);
     240      //PRINTF(0)("getvar %s %d\n", (*it)->getName().c_str(), n);
    212241      stateTo->sizeList.push_back( n );
    213242      // this is only for very hardcore debug sessions
     
    257286 * @param fromStateId id of the base state id
    258287 * @return number bytes read
     288 *
    259289 * @todo check for permissions
    260290 */
     
    275305  StateHistoryEntry * stateFrom = NULL;
    276306
     307  // search the state from wich the diff is made of
    277308  StateHistory::iterator it = recvStates[userId].begin();
    278309  while ( it != recvStates[userId].end() && (*it)->stateId != fromStateId )
    279310    it++;
    280311
    281 
    282 //  if ( getLeafClassID() == CL_SPACE_SHIP )
    283 //  {
    284 //    PRINTF(0)("setStateDiff:SpaceShip from: %d stateId: %d\n", (it == recvStates[userId].end())?-1:fromStateId, stateId);
    285 //  }
    286 
     312  // if this is the first state to receive
    287313  if ( it == recvStates[userId].end() )
    288314  {
     
    300326    stateFrom = (*it);
    301327
    302   //apply diff
     328
     329  // apply diff
    303330  for ( int i = 0; i<length; i++ )
    304331  {
     
    307334    else
    308335      stateTo->data[i] = data[i];
    309 
    310336  }
    311337
     
    316342  int n = 0;
    317343  std::list<int> changes;
    318 
     344  bool hasPermission = false;
     345
     346  // extract the new state for every client
    319347  for ( SyncVarList::iterator it = syncVarList.begin(); it != syncVarList.end(); it++ )
    320348  {
    321     if (
    322         (*it)->checkPermission( PERMISSION_MASTER_SERVER ) && networkStream->isUserMasterServer( userId ) ||
    323         (*it)->checkPermission( PERMISSION_OWNER ) && this->owner == userId ||
    324         networkStream->isUserMasterServer( userId ) && this->owner != SharedNetworkData::getInstance()->getHostID() && (*it)->checkPermission( PERMISSION_OWNER ) ||
    325         (*it)->checkPermission( PERMISSION_ALL )
    326        )
     349    // DATA PERMISSIONS
     350    // check if this synchronizeable has the permissions to write the data
     351
     352    // first check MASTER_SERVER permissions
     353    if(  this->networkStream->isUserMasterServer( userId ) && (*it)->checkPermission( PERMISSION_MASTER_SERVER ))
     354      hasPermission = true;
     355    // now check PROXY_SERVER permissions
     356    else if( this->networkStream->isUserProxyServer( userId )  && (*it)->checkPermission( PERMISSION_MASTER_SERVER ))
     357      hasPermission = true;
     358    // now check OWNER permissions
     359    else if( this->owner == SharedNetworkData::getInstance()->getHostID() && (*it)->checkPermission( PERMISSION_OWNER ))
     360      hasPermission = true;
     361    // now check ALL permissions
     362    else if( (*it)->checkPermission( PERMISSION_ALL ))
     363      hasPermission = true;
     364    // SPECIAL: get write permissions if i am master server and i am able to overwrite the client stuff
     365    else if( this->networkStream->isUserMasterServer( userId ) && this->owner != userId && (*it)->checkPermission( PERMISSION_OWNER ))
     366      hasPermission = true;
     367    // SPECIAL: get write permissions if i am proxy server and i am able to overwrite the client stuff
     368    else if( this->networkStream->isUserProxyServer( userId )  && this->owner != userId && (*it)->checkPermission( PERMISSION_OWNER ))
     369      hasPermission = true;
     370    else
     371      hasPermission = false;
     372
     373    // if it has the permission to write do it
     374    if( hasPermission)
    327375    {
    328376      n = (*it)->readFromBuf( stateTo->data + i, stateTo->dataLength - i );
    329377      i += n;
    330378      //NETPRINTF(0)("%s::setvar %s %d\n", getClassCName(), (*it)->getName().c_str(), n);
    331       PRINTF(0)("%s::setvar %s %d\n", getClassCName(), (*it)->getName().c_str(), n);
     379      //PRINTF(0)("%s::setvar %s %d\n", getClassCName(), (*it)->getName().c_str(), n);
    332380      //(*it)->debug();
    333381      if ( (*it)->getHasChanged() )
  • branches/proxy/src/lib/network/synchronizeable.h

    r9386 r9396  
    2222#include <list>
    2323
    24 //State constants: They have to be of the form 2^n
    25 #define STATE_SERVER 1
    2624
    2725struct StateHistoryEntry
     
    4745    Synchronizeable();
    4846    virtual ~Synchronizeable();
    49 
    50 //     void setIsServer( bool isServer );
    51 //     bool isServer();
    5247
    5348    virtual void varChangeHandler( std::list<int> & id );
     
    7974  protected:
    8075    NetworkStream*    networkStream;  //!< reference network stream we are connected to
    81 //     int               state;
     76
    8277
    8378  private:
  • branches/proxy/src/orxonox.cc

    r9357 r9396  
    7272REGISTER_ARG_FLAG( l, license,    "misc",  "showLicenseAndExit", "Prints the license and exit",      "1" );
    7373REGISTER_ARG_FLAG( c, client,     "game",  "gameType",           "Connect to Server (-H)",           "multiplayer_client" );
    74 REGISTER_ARG_FLAG( s, server,     "game",  "gameType",           "Start Orxonox as Game Server",     "multiplayer_server" );
     74REGISTER_ARG_FLAG( s, server,     "game",  "gameType",           "Start Orxonox as Game Server",     "multiplayer_master_server" );
     75REGISTER_ARG_FLAG( x, proxy,      "game",  "gameType",           "Start Orxonox as Proxy Server",    "multiplayer_proxy_server" );
    7576REGISTER_ARG_ARG(  H, host,       "game",  "host",               "Host to connect to",               "host");
    7677REGISTER_ARG_ARG(  p, port,       "game",  "port",               "Port to use",                      "port" );
     
    7980REGISTER_ARG_FLAG( f, fullscreen, "video", "Fullscreen-mode",    "start Orxonox in fullscreen mode", "1");
    8081REGISTER_ARG_FLAG( w, windowed,   "video", "Fullscreen-mode",    "start Orxonox in windowed mode",   "0");
    81 REGISTER_ARG_ARG(  r, resolution, "video", "Resolution",         "Sets resolution / window size",    "res");
     82REGISTER_ARG_ARG(  r, resolution, "video", "Resolution",         "sets resolution / window size",    "res");
     83REGISTER_ARG_FLAG( d, dedicated,  "video", "Norender-mode",      "the scene is not rendered",        "1" );
    8284
    8385REGISTER_ARG_FLAG( a, audio,      "audio", "Disable-Audio",      "Enable audio",                     "0" );
     
    144146  SDL_QuitSubSystem(SDL_INIT_TIMER);
    145147  ClassList::debug();
    146  
     148
    147149  Preferences::getInstance()->save();
    148150
     
    301303{
    302304  PRINT(3)("> Initializing networking\n");
    303 
    304   if( this->serverName != "") // we are a client
     305  std::string gameType = Preferences::getInstance()->getString( "game", "gameType", "" );
     306
     307  if( gameType == "multiplayer_client") // we are a client
    305308  {
    306309    State::setOnline(true);
    307     NetworkManager::getInstance()->establishConnection(this->serverName, port);
    308   }
    309   else if( this->port > 0)
    310   {    // we are a server
     310    NetworkManager::getInstance()->createClient(this->serverName, port);
     311  }
     312  else if( gameType == "multiplayer_master_server")
     313  {    // we are a master server
    311314    State::setOnline(true);
    312     NetworkManager::getInstance()->createServer(port);
    313   }
    314   return 0;
     315    NetworkManager::getInstance()->createMasterServer(port);
     316  }
     317  else if( gameType == "multiplayer_proxy_server")
     318  {    // we are a proxy server
     319    State::setOnline(true);
     320    NetworkManager::getInstance()->createProxyServer(port);
     321  }
     322
     323  return 0;
     324
    315325}
    316326
     
    459469  if( Preferences::getInstance()->getString("game", "showGui", "") == "1" )
    460470    showGui = true;
    461   else if( Preferences::getInstance()->getString( "game", "gameType", "" ) == "multiplayer_server" ||
     471  else if( Preferences::getInstance()->getString( "game", "gameType", "" ) == "multiplayer_master_server" ||
     472           Preferences::getInstance()->getString( "game", "gameType", "" ) == "multiplayer_proxy_server" ||
    462473           Preferences::getInstance()->getString( "game", "gameType", "" ) == "multiplayer_client" )
    463474    return startNetworkOrxonox(argc, argv);
     
    493504    startOrxonox(argc, argv, host.c_str(), port);
    494505  }
    495   else if ( gameType == "multiplayer_server" )
     506  else if ( gameType == "multiplayer_master_server" )
    496507  {
    497508    int port = Preferences::getInstance()->getInt( "game", "port", DEFAULT_ORXONOX_PORT );
    498509
    499510    printf("Starting Orxonox as server: listening on port %i\n", port);
     511
     512    startOrxonox(argc, argv, "", port);
     513  }
     514  else if ( gameType == "multiplayer_proxy_server" )
     515  {
     516    int port = Preferences::getInstance()->getInt( "game", "port", DEFAULT_ORXONOX_PORT );
     517
     518    printf("Starting Orxonox as proxy server: listening on port %i\n", port);
    500519
    501520    startOrxonox(argc, argv, "", port);
  • branches/proxy/src/story_entities/game_world.cc

    r9235 r9396  
    512512void GameWorld::display ()
    513513{
     514
     515    // if this server is a dedicated server the game workd does not need to be drawn
     516  if( !GraphicsEngine::getInstance()->isDedicated())
     517  {
    514518  // render the reflection texture
    515519  this->renderPassReflection();
    516520  // redner the refraction texture
    517521  this->renderPassRefraction();
     522  }
    518523  // render all
    519524  this->renderPassAll();
     
    643648  LightManager::getInstance()->draw();
    644649
    645   /* Draw the BackGround */
    646   this->drawEntityList(State::getObjectManager()->getObjectList(OM_BACKGROUND));
    647   engine->drawBackgroundElements();
    648 
    649   /* draw all WorldEntiy groups */
    650   for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
    651     this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));
    652 
    653   AtmosphericEngine::getInstance()->draw();
    654 
    655   if( unlikely( this->showBV))
    656   {
    657     CDEngine* engine = CDEngine::getInstance();
     650  // only render the world if its not dedicated mode
     651  if( !GraphicsEngine::getInstance()->isDedicated())
     652  {
     653    /* Draw the BackGround */
     654    this->drawEntityList(State::getObjectManager()->getObjectList(OM_BACKGROUND));
     655    engine->drawBackgroundElements();
     656
     657    /* draw all WorldEntiy groups */
    658658    for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
    659       engine->drawBV(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]), this->showBVLevel);
    660   }
    661 
    662   if( unlikely(this->showPNodes))
    663     PNode::getNullParent()->debugDraw(0);
     659      this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));
     660
     661    AtmosphericEngine::getInstance()->draw();
     662
     663    if( unlikely( this->showBV))
     664    {
     665      CDEngine* engine = CDEngine::getInstance();
     666      for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
     667        engine->drawBV(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]), this->showBVLevel);
     668    }
     669
     670    if( unlikely(this->showPNodes))
     671      PNode::getNullParent()->debugDraw(0);
     672
     673    // draw the game ruls
     674    if( likely(this->dataTank->gameRule != NULL))
     675      this->dataTank->gameRule->draw();
     676  }
    664677
    665678  engine->draw();
    666 
    667   // draw the game ruls
    668   if( likely(this->dataTank->gameRule != NULL))
    669     this->dataTank->gameRule->draw();
    670679}
    671680
  • branches/proxy/src/story_entities/menu/game_menu.cc

    r9369 r9396  
    574574      OrxGui::GLGuiButton* createButton = new OrxGui::GLGuiPushButton("Create Server");
    575575      serverNetworkBox->pack(createButton);
    576       createButton->released.connect(this, &GameMenu::createServer);
     576      createButton->released.connect(this, &GameMenu::createMasterServer);
    577577    }
    578578  }
     
    593593
    594594  State::setOnline(true);
    595   NetworkManager::getInstance()->establishConnection( this->ipInputLine->_getText(), 9999 );
     595  NetworkManager::getInstance()->createClient( this->ipInputLine->_getText(), 9999 );
    596596
    597597  Preferences::getInstance()->setString( "multiplayer", "lastVisitedServer", this->ipInputLine->_getText() );
     
    600600}
    601601
    602 void GameMenu::createServer( )
     602void GameMenu::createMasterServer( )
    603603{
    604604  PRINTF(0)("Create server\n" );
    605605
    606606  State::setOnline(true);
    607   NetworkManager::getInstance()->createServer( 9999 );
     607  NetworkManager::getInstance()->createMasterServer( 9999 );
    608608
    609609  this->startLevel( 5 );
  • branches/proxy/src/story_entities/menu/game_menu.h

    r9059 r9396  
    5050   
    5151    void showServerMenu();
    52     void createServer();
     52    void createMasterServer();
    5353
    5454
  • branches/proxy/src/story_entities/multi_player_world_data.cc

    r9388 r9396  
    4747#include "player_stats.h"
    4848
    49 #include "proxy/proxy_settings.h"
     49#include "proxy/network_settings.h"
    5050
    5151#include "glmenu_imagescreen.h"
     
    112112  const TiXmlElement* element = NULL;
    113113
    114   if( NetworkManager::getInstance()->isMasterServer() )
     114  if( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
    115115  {
    116116    /* load the spawning points */
     
    148148    element = element->FirstChildElement();
    149149
    150     if( NetworkManager::getInstance()->isMasterServer() )
     150    if( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
    151151    {
    152152      while( element != NULL)
     
    206206
    207207
    208     if( NetworkManager::getInstance()->isMasterServer())
     208    if( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
    209209    {
    210210      this->localPlayer = new Player();
     
    281281  GameWorldData::loadScene(root);
    282282
    283 //   LoadParamXML(root, "ProxySettings", ProxySettings::getInstance(), ProxySettings, loadProxySettings);
     283//   LoadParamXML(root, "NetworkSettings", NetworkSettings::getInstance(), NetworkSettings, loadNetworkSettings);
    284284
    285285  // create server playable
    286   if ( NetworkManager::getInstance()->isMasterServer() )
     286  if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
    287287  {
    288288    NetworkGameManager::getInstance()->signalNewPlayer( 0 );
     
    300300{
    301301  // delete the proxy settings
    302   delete ProxySettings::getInstance();
     302  delete NetworkSettings::getInstance();
    303303
    304304  /* call underlying function */
  • branches/proxy/src/subprojects/network/network_unit_test.cc

    r9347 r9396  
    205205
    206206  /* create a server stream */
    207   nm->createServer(port);
     207  nm->createMasterServer(port);
    208208
    209209  /* esatblish a connection */
     
    213213  if(error == -1)
    214214    printf("\n\nerror on address resolution, program inconsistancy\n\n");
    215   nm->establishConnection("localhost", port);
     215  nm->createClient("localhost", port);
    216216  nm->connectSynchronizeable( *clientSync );
    217217  /* adding some break for connection setup */
     
    262262  netMan->initialize();
    263263 
    264   netMan->createServer(/**ss, */ 9999);
     264  netMan->createMasterServer(/**ss, */ 9999);
    265265 
    266266  SimpleSync* ss = new SimpleSync("Server");
     
    307307    host = "localhost";
    308308 
    309   netMan->establishConnection(host, 9999);
     309  netMan->createClient(host, 9999);
    310310 
    311311//  SimpleSync* ss = new SimpleSync("SimpleSync");
     
    361361  Synchronizeable* ss = new SimpleSync("SimpleSync\0");
    362362
    363   netMan->establishConnection( name, port );
     363  netMan->createClient( name, port );
    364364  netMan->connectSynchronizeable( *ss );
    365365
  • branches/proxy/src/util/game_rules.cc

    r9387 r9396  
    8787void GameRules::registerKill(const Kill& kill)
    8888{
    89   if ( !SharedNetworkData::getInstance()->isMasterServer() )
     89  if ( SharedNetworkData::getInstance()->isClient() )
    9090    return;
    9191
  • branches/proxy/src/util/kill_target.cc

    r9357 r9396  
    5656
    5757
    58 MissionState KillTarget::checkMissionGoal(float dt) {}
     58MissionState KillTarget::checkMissionGoal(float dt)
     59{
    5960
     61}
     62
  • branches/proxy/src/util/multiplayer_team_deathmatch.cc

    r9371 r9396  
    204204  assignPlayable();
    205205
    206   if ( !SharedNetworkData::getInstance()->isMasterServer() )
     206  if ( SharedNetworkData::getInstance()->isClient() )
    207207    return;
    208208
     
    268268void MultiplayerTeamDeathmatch::checkGameRules()
    269269{
    270   if ( !SharedNetworkData::getInstance()->isMasterServer() )
     270  if ( SharedNetworkData::getInstance()->isClient() )
    271271    return;
    272272
  • branches/proxy/src/world_entities/bsp_entity.cc

    r9059 r9396  
    11/*
    22   orxonox - the future of 3D-vertical-scrollers
    3  
     3
    44   Copyright (C) 2004 orx
    5  
     5
    66   This program is free software; you can redistribute it and/or modify
    77   it under the terms of the GNU General Public License as published by
    88   the Free Software Foundation; either version 2, or (at your option)
    99   any later version.
    10  
     10
    1111   ### File Specific:
    1212   main-programmer: Claudio Botta
     
    5353
    5454  this->bspManager = NULL;
    55  
     55
    5656  this->name_handle = registerVarId( new SynchronizeableString( &this->name, &this->name_write, "name" ) );
    57  
     57
    5858  this->setSynchronized( true );
    5959}
     
    6363{
    6464  PRINTF(0)("+++++++++++ LOADING NAME %s\n", name.c_str());
    65  
     65
    6666  this->name = name;
    6767
  • branches/proxy/src/world_entities/creatures/fps_player.cc

    r9377 r9396  
    287287  //dealing damage
    288288
    289   if ( State::isOnline() && SharedNetworkData::getInstance()->isMasterServer() )
     289  if ( State::isOnline() && (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer()))
    290290  {
    291291    this->damageTicker -= time;
  • branches/proxy/src/world_entities/space_ships/space_ship.cc

    r9371 r9396  
    314314  if( entity->isA(CL_PROJECTILE) && entity != ref)
    315315  {
    316     if ( SharedNetworkData::getInstance()->isMasterServer() )
     316    if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
    317317    {
    318318      //TODO handle this
  • branches/proxy/src/world_entities/spawning_point.cc

    r9386 r9396  
    178178      }
    179179
    180       if ( found && SharedNetworkData::getInstance()->isMasterServer() )
     180      if ( found && SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
    181181        this->sendRespawnMessage( it->entity->getUniqueID() );
    182182
     
    218218bool SpawningPoint::respawnMessageHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId )
    219219{
    220   if ( SharedNetworkData::getInstance()->isMasterServer() )
     220  if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
    221221  {
    222222    PRINTF(2)("server received spawn message!\n");
Note: See TracChangeset for help on using the changeset viewer.