Changeset 9396 in orxonox.OLD for branches/proxy/src
- Timestamp:
- Jul 23, 2006, 10:07:23 PM (18 years ago)
- Location:
- branches/proxy/src
- Files:
-
- 3 added
- 3 deleted
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/defs/class_id.h
r9347 r9396 127 127 CL_NETWORK_MANAGER = 0x00000050, 128 128 CL_SHARED_NETWORK_DATA = 0x00000051, 129 CL_ PROXY_SETTINGS= 0x00000052,129 CL_NETWORK_SETTINGS = 0x00000052, 130 130 CL_ATMOSPHERIC_ENGINE = 0x00000061, 131 131 -
branches/proxy/src/defs/globals.h
r7661 r9396 47 47 48 48 #define CONFIG_NAME_FULLSCREEN "Fullscreen-mode" 49 #define CONFIG_NAME_NO_RENDER "Norender-mode" 49 50 #define CONFIG_NAME_RESOLUTION "Resolution" 50 51 #define CONFIG_NAME_WIREFRAME "WireFrame-mode" -
branches/proxy/src/lib/graphics/graphics_engine.cc
r9351 r9396 66 66 this->bDisplayFPS = false; 67 67 this->bAntialiasing = false; 68 this->bDedicated = false; 68 69 this->minFPS = 9999; 69 70 this->maxFPS = 0; … … 163 164 MultiType textures = Preferences::getInstance()->getString(CONFIG_SECTION_VIDEO_ADVANCED, CONFIG_NAME_TEXTURES, "1"); 164 165 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(); 165 170 166 171 // searching for a usefull resolution … … 603 608 } 604 609 610 /** 611 * this draws the graphics engines graphics effecs 612 */ 605 613 void GraphicsEngine::draw() const 606 614 { 607 // LightManager::getInstance()->draw(); 608 609 if (this->graphicsEffects != NULL) 615 if( this->graphicsEffects != NULL) 610 616 { 611 617 //draw the graphics effects -
branches/proxy/src/lib/graphics/graphics_engine.h
r9351 r9396 46 46 void toggleFullscreen(); 47 47 static void setBackgroundColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha = 1.0); 48 inline bool isDedicated() { return this->bDedicated; } 48 49 49 50 inline void setAntialiasing(bool flag) { this->bAntialiasing = flag; } … … 114 115 bool particlesEnabled; //!< If particles should be enabled. 115 116 bool bAntialiasing; //!< true if antialiasing enabled 117 bool bDedicated; //!< true if this server is a dedicated server and should not render the scene 116 118 117 119 int particlesValue; //!< How many particles -
branches/proxy/src/lib/gui/qt/gui_video.cc
r8362 r9396 50 50 layout->addWidget(fullscreen, 0, 0); 51 51 52 QtGuiCheckBox* dedicated = new QtGuiCheckBox(CONFIG_NAME_NO_RENDER, this, false); 53 //fullscreen->setName(); 54 layout->addWidget(dedicated, 1, 0); 55 52 56 QtGuiCheckBox* wireframe = new QtGuiCheckBox(CONFIG_NAME_WIREFRAME, this, false); 53 layout->addWidget(wireframe, 1, 0);57 layout->addWidget(wireframe, 2, 0); 54 58 55 59 { 56 60 QComboBox* resolution = new QtGuiComboBox(CONFIG_NAME_RESOLUTION, this, "640x480"); 57 61 resolution->setEditable(true); 58 layout->addWidget(resolution, 2, 0);62 layout->addWidget(resolution, 3, 0); 59 63 std::vector<QString> resolutions; 60 64 this->getResolutions(resolutions); -
branches/proxy/src/lib/network/Makefile.am
r9393 r9396 26 26 udp_broadcast.cc \ 27 27 \ 28 proxy/ proxy_settings.cc \28 proxy/network_settings.cc \ 29 29 \ 30 30 monitor/connection_monitor.cc \ 31 31 monitor/network_monitor.cc \ 32 32 monitor/network_node.cc \ … … 75 75 udp_broadcast.h \ 76 76 \ 77 proxy/ proxy_settings.cc \77 proxy/network_settings.cc \ 78 78 \ 79 79 monitor/connection_monitor.h \ -
branches/proxy/src/lib/network/converter.cc
r9357 r9396 10 10 11 11 ### 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) 14 14 */ 15 15 … … 38 38 { 39 39 /* set the class id for the base object */ 40 //this->setClassID(CL_ENTITY_MANAGER, "EntityManager");41 40 } 42 41 -
branches/proxy/src/lib/network/handshake.cc
r9367 r9396 31 31 /* set the class id for the base object */ 32 32 this->setClassID(CL_HANDSHAKE, "Handshake"); 33 33 34 34 35 // register all variable handlers -
branches/proxy/src/lib/network/handshake.h
r9367 r9396 80 80 inline bool redirect() { return this->redirectProxy;} 81 81 /** @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; } 83 83 84 84 /** @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; } 86 86 /** @returns the address of the proxy server 1 if any */ 87 87 inline IP getProxy1Address() { return this->proxy1; } 88 88 /** @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; } 90 90 /** @returns the address of the proxy server 2 if any */ 91 91 inline IP getProxy2Address() { return this->proxy2; } -
branches/proxy/src/lib/network/monitor/network_monitor.cc
r9373 r9396 19 19 #include "debug.h" 20 20 21 #include "proxy/ proxy_settings.h"21 #include "proxy/network_settings.h" 22 22 #include "shared_network_data.h" 23 23 … … 57 57 { 58 58 // 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(); 60 60 std::vector<IPaddress*>::iterator it = proxyList->begin(); 61 61 // 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 55 55 inline void removeMasterServer(NetworkNode* node, PeerInfo* pInfo) { node->removeMasterServer(pInfo); } 56 56 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 57 63 /* slots admin and info interface */ 58 64 /** @returns the total number of players in this game (including all proxy servers etc)*/ … … 63 69 /** @param node node to be checked for slots @returns true if there are still free network slots available at this node */ 64 70 inline bool gotFreeSlots(NetworkNode* node) { return (node->getPlayerNumber() < SharedNetworkData::getInstance()->getMaxPlayer())?true:false; } 65 PeerInfo* getFirstChoiceProxy(); 66 PeerInfo* getSecondChoiceProxy(); 71 67 72 /** @returns true if the next client should be reconnected to some other proxy server with more connections */ 68 73 inline bool isReconnectNextClient() { return (this->localNode->getPlayerNumber() >= SharedNetworkData::getInstance()->getMaxPlayer())?true:false; } -
branches/proxy/src/lib/network/monitor/network_node.h
r9347 r9396 37 37 PeerInfo* getMasterServer(int index); 38 38 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 39 49 /** @returns the number of players */ 40 50 inline int getPlayerNumber() { return this->playerNumber; } -
branches/proxy/src/lib/network/network_game_manager.cc
r9371 r9396 91 91 bool NetworkGameManager::signalNewPlayer( int userId ) 92 92 { 93 assert( SharedNetworkData::getInstance()->isMasterServer() );93 assert( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer()); 94 94 assert( State::getGameRules() ); 95 95 assert( State::getGameRules()->isA( CL_NETWORK_GAME_RULES ) ); … … 168 168 bool NetworkGameManager::delSynchronizeableHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId ) 169 169 { 170 if ( SharedNetworkData::getInstance()->isMasterServer() )170 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer()) 171 171 { 172 172 PRINTF(2)("Recieved DeleteSynchronizeable message from client %d!\n", userId); … … 229 229 bool NetworkGameManager::preferedTeamHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId ) 230 230 { 231 assert( SharedNetworkData::getInstance()->isMasterServer() );231 assert( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer()); 232 232 233 233 int teamId = 0; … … 261 261 void NetworkGameManager::prefereTeam( int teamId ) 262 262 { 263 if ( SharedNetworkData::getInstance()->isMasterServer() )263 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer()) 264 264 setPreferedTeam( SharedNetworkData::getInstance()->getHostID(), teamId ); 265 265 else … … 305 305 { 306 306 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() ) 308 308 { 309 309 MessageManager::getInstance()->sendMessage( messageId, data, dataLength, RT_ALL_NOT_ME, 0, MP_HIGHBANDWIDTH ); … … 347 347 assert( Converter::stringToByteArray(message, buf+2*INTSIZE, message.length()+INTSIZE) == message.length()+INTSIZE ); 348 348 349 if ( SharedNetworkData::getInstance()->isMasterServer() )349 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer()) 350 350 MessageManager::getInstance()->sendMessage( MSGID_CHATMESSAGE, buf, message.length()+3*INTSIZE, RT_ALL_ME, 0, MP_HIGHBANDWIDTH ); 351 351 else -
branches/proxy/src/lib/network/network_manager.cc
r9357 r9396 10 10 11 11 ### 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) 14 14 */ 15 15 … … 98 98 99 99 100 101 /** 102 * creates a new NetworkStream of server type 103 * @param port: number of the TCP port 104 */ 105 int 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 */ 126 int 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 100 150 /** 101 151 * creates a connection from one object to a host 102 152 * @param hostName: the name of the destination host 103 153 */ 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); 154 int 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 108 162 this->networkStream->startHandshake(); 163 164 PRINTF(0)("Created Network Client"); 109 165 return 1; 110 166 } … … 112 168 113 169 /** 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 */ 130 173 void NetworkManager::connectSynchronizeable(Synchronizeable& sync) 131 174 { … … 144 187 if( likely(this->elapsedTime < 1.0f / NETWORK_FREQUENCY)) 145 188 return; 189 146 190 this->elapsedTime = 0.0f; 147 191 148 if ( networkStream )192 if ( this->networkStream ) 149 193 networkStream->processData(); 150 194 -
branches/proxy/src/lib/network/network_manager.h
r9347 r9396 36 36 void shutdown(); 37 37 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); 47 41 48 42 void connectSynchronizeable(Synchronizeable& sync); … … 58 52 private: 59 53 static NetworkManager* singletonRef; //!< Pointer to the only instance of this Class 60 NetworkStream* networkStream; //!< pointer to network stream54 NetworkStream* networkStream; //!< pointer to network stream 61 55 62 56 float elapsedTime; //!< elapsed time since the last network update -
branches/proxy/src/lib/network/network_stream.cc
r9386 r9396 70 70 71 71 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 ) 72 NetworkStream::NetworkStream( int nodeType) 78 73 { 79 74 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 88 103 // get the local ip address 89 104 IPaddress ip; 90 SDLNet_ResolveHost( &ip, NULL, port);105 SDLNet_ResolveHost( &ip, NULL, 0); 91 106 this->pInfo->ip = ip; 92 107 } 93 108 94 95 /**96 * start as a server97 * @param port: at this port98 */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 address105 IPaddress ip;106 SDLNet_ResolveHost( &ip, NULL, port );107 this->pInfo->ip = ip;108 }109 109 110 110 … … 182 182 183 183 /** 184 * establish a connection to a remote master server 185 * @param host: host name 186 * @param port: the port number 187 */ 188 void 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 */ 205 void 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 */ 221 void NetworkStream::createServer(int port) 222 { 223 this->serverSocket = new UdpServerSocket(port); 224 } 225 226 227 /** 184 228 * creates a new instance of the network game manager 185 229 */ … … 187 231 { 188 232 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 191 234 this->networkGameManager->setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() ); 192 235 MessageManager::getInstance()->setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() ); … … 260 303 } 261 304 262 if ( this->pInfo-> nodeType == NET_MASTER_SERVER)305 if ( this->pInfo->isMasterServer()) 263 306 { 264 307 // execute everytthing the master server shoudl do … … 268 311 this->updateConnectionList(); 269 312 } 270 else if( this->pInfo-> nodeType == NET_PROXY_SERVER_ACTIVE)313 else if( this->pInfo->isProxyServer()) 271 314 { 272 315 // execute everything the proxy server should do 316 if ( serverSocket ) 317 serverSocket->update(); 318 319 this->updateConnectionList(); 273 320 } 274 321 else … … 442 489 void NetworkStream::debug() 443 490 { 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 { 447 498 PRINT(0)(" Host ist Client with ID: %i\n", this->pInfo->userId); 499 } 448 500 449 501 PRINT(0)(" Got %i connected Synchronizeables, showing active Syncs:\n", this->synchronizeables.size()); … … 493 545 { 494 546 495 if ( this->pInfo-> nodeType == NET_CLIENT)547 if ( this->pInfo->isClient() ) 496 548 { 497 498 549 SharedNetworkData::getInstance()->setHostID( it->second.handshake->getHostId() ); 499 550 this->pInfo->userId = SharedNetworkData::getInstance()->getHostID(); … … 528 579 if ( it->second.handshake->canDel() ) 529 580 { 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() ) 531 597 { 532 598 it->second.nodeType = it->second.handshake->getRemoteNodeType(); … … 639 705 continue; 640 706 641 // if we are a server and this is not our handshake642 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 ) 643 709 continue; 644 710 … … 654 720 655 721 // 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 ) 657 723 n = Converter::intToByteArray( 0, buf + offset, UDP_PACKET_SIZE - offset ); 658 724 else … … 703 769 // now compress the data with the zip library 704 770 int compLength = 0; 705 if ( this->isMasterServer())771 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer()) 706 772 compLength = Zip::getInstance()->zip( buf, offset, compBuf, UDP_PACKET_SIZE, dictServer ); 707 773 else … … 783 849 } 784 850 785 while ( offset + 2 *INTSIZE < length )851 while ( offset + 2 * INTSIZE < length ) 786 852 { 787 853 assert( offset > 0 ); … … 797 863 Synchronizeable * sync = NULL; 798 864 865 // look for the synchronizeable in question 799 866 for ( SynchronizeableList::iterator it = synchronizeables.begin(); it != synchronizeables.end(); it++ ) 800 867 { … … 807 874 } 808 875 876 // this synchronizeable does not yet exist! create it 809 877 if ( sync == NULL ) 810 878 { 811 879 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 812 882 if ( oldSynchronizeables.find( uniqueId ) != oldSynchronizeables.end() ) 813 883 { … … 816 886 } 817 887 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() ) 819 890 { 820 891 offset += syncDataLength; … … 833 904 assert( leafClassId != 0 ); 834 905 906 835 907 BaseObject * b = NULL; 836 908 /* These are some small exeptions in creation: Not all objects can/should be created via Factory */ … … 838 910 if( leafClassId == CL_NULL_PARENT || leafClassId == CL_SYNCHRONIZEABLE || leafClassId == CL_NETWORK_GAME_MANAGER ) 839 911 { 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); 841 913 offset += syncDataLength; 842 914 continue; … … 913 985 // do all game relevant stuff here 914 986 networkGameManager->signalNewPlayer( userId ); 915 916 // register the new client at the network monitor917 // this->networkMonitor->addClient();918 987 } 919 988 -
branches/proxy/src/lib/network/network_stream.h
r9347 r9396 36 36 public: 37 37 NetworkStream(); 38 NetworkStream( std::string host, int port);39 NetworkStream( int port);38 NetworkStream(int nodeType); 39 virtual ~NetworkStream(); 40 40 41 virtual ~NetworkStream();42 41 void init(); 42 43 void connectToMasterServer(std::string host, int port); 44 void connectToProxyServer(std::string host, int port); 45 void createServer(int port); 43 46 44 47 void createNetworkGameManager(); … … 49 52 void disconnectSynchronizeable(Synchronizeable& sync); 50 53 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; }56 54 inline int getMaxConnections(){ return SharedNetworkData::getInstance()->getMaxPlayer(); } 57 55 -
branches/proxy/src/lib/network/peer_info.h
r9347 r9396 24 24 inline bool isMasterServer() { return this->nodeType == NET_MASTER_SERVER; } 25 25 inline bool isProxyServer() { return this->nodeType == NET_PROXY_SERVER_ACTIVE; } 26 inline bool isProxyServerPassive() { return this->nodeType == NET_PROXY_SERVER_PASSIVE; } 26 27 inline bool isClient() { return this->nodeType == NET_CLIENT; } 27 28 … … 30 31 31 32 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 35 36 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 39 40 40 int lastAckedState; 41 int lastRecvedState; 41 int lastAckedState; //!< last acked state synchronized state 42 int lastRecvedState; //!< last received state 42 43 }; 43 44 -
branches/proxy/src/lib/network/player_stats.cc
r9386 r9396 191 191 void PlayerStats::setNickName( std::string nick ) 192 192 { 193 if ( SharedNetworkData::getInstance()->isMasterServer() )193 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer() ) 194 194 { 195 195 this->nickName = nick; -
branches/proxy/src/lib/network/shared_network_data.cc
r9388 r9396 34 34 this->setClassID(CL_SHARED_NETWORK_DATA, "SharedNetworkData"); 35 35 36 this->nodeType = NET_CLIENT; 36 37 this->hostID = -1; 37 38 this->defaultSyncStream = NULL; 38 39 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; 44 43 } 45 44 -
branches/proxy/src/lib/network/shared_network_data.h
r9388 r9396 9 9 #include "base_object.h" 10 10 #include "netdefs.h" 11 #include "proxy/ proxy_settings.h"11 #include "proxy/network_settings.h" 12 12 13 13 //!< maximal connectinons for the server … … 40 40 41 41 /** @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(); } 43 43 44 44 /** @returns the hostID of the node */ -
branches/proxy/src/lib/network/synchronizeable.cc
r9386 r9396 11 11 12 12 ### File Specific: 13 main-programmer: Silvan Nellen14 co-programmer: Benjamin Wuest13 main-programmer: Christoph Renner (rennerc@ee.ethz.ch) 14 co-programmer: Patrick Boenzli (patrick@orxonox.ethz.ch) 15 15 */ 16 16 … … 72 72 this->networkStream->disconnectSynchronizeable(*this); 73 73 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 ) ) 75 76 NetworkGameManager::getInstance()->removeSynchronizeable( this->getUniqueID() ); 76 77 } … … 112 113 113 114 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 */ 114 125 int Synchronizeable::getStateDiff( int userId, byte* data, int maxLength, int stateId, int fromStateId, int priorityTH ) 115 126 { … … 189 200 int n; 190 201 191 bool hasPermission ;202 bool hasPermission = false; 192 203 bool sizeChanged = false; 193 204 … … 195 206 for ( SyncVarList::iterator it = syncVarList.begin(); it != syncVarList.end(); it++ ) 196 207 { 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 203 232 204 233 if ( sizeIter == stateFrom->sizeList.end() || *sizeIter != (*it)->getSize() ) … … 209 238 n = (*it)->writeToBuf( stateTo->data+i, stateTo->dataLength - i ); 210 239 //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); 212 241 stateTo->sizeList.push_back( n ); 213 242 // this is only for very hardcore debug sessions … … 257 286 * @param fromStateId id of the base state id 258 287 * @return number bytes read 288 * 259 289 * @todo check for permissions 260 290 */ … … 275 305 StateHistoryEntry * stateFrom = NULL; 276 306 307 // search the state from wich the diff is made of 277 308 StateHistory::iterator it = recvStates[userId].begin(); 278 309 while ( it != recvStates[userId].end() && (*it)->stateId != fromStateId ) 279 310 it++; 280 311 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 287 313 if ( it == recvStates[userId].end() ) 288 314 { … … 300 326 stateFrom = (*it); 301 327 302 //apply diff 328 329 // apply diff 303 330 for ( int i = 0; i<length; i++ ) 304 331 { … … 307 334 else 308 335 stateTo->data[i] = data[i]; 309 310 336 } 311 337 … … 316 342 int n = 0; 317 343 std::list<int> changes; 318 344 bool hasPermission = false; 345 346 // extract the new state for every client 319 347 for ( SyncVarList::iterator it = syncVarList.begin(); it != syncVarList.end(); it++ ) 320 348 { 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) 327 375 { 328 376 n = (*it)->readFromBuf( stateTo->data + i, stateTo->dataLength - i ); 329 377 i += n; 330 378 //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); 332 380 //(*it)->debug(); 333 381 if ( (*it)->getHasChanged() ) -
branches/proxy/src/lib/network/synchronizeable.h
r9386 r9396 22 22 #include <list> 23 23 24 //State constants: They have to be of the form 2^n25 #define STATE_SERVER 126 24 27 25 struct StateHistoryEntry … … 47 45 Synchronizeable(); 48 46 virtual ~Synchronizeable(); 49 50 // void setIsServer( bool isServer );51 // bool isServer();52 47 53 48 virtual void varChangeHandler( std::list<int> & id ); … … 79 74 protected: 80 75 NetworkStream* networkStream; //!< reference network stream we are connected to 81 // int state; 76 82 77 83 78 private: -
branches/proxy/src/orxonox.cc
r9357 r9396 72 72 REGISTER_ARG_FLAG( l, license, "misc", "showLicenseAndExit", "Prints the license and exit", "1" ); 73 73 REGISTER_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" ); 74 REGISTER_ARG_FLAG( s, server, "game", "gameType", "Start Orxonox as Game Server", "multiplayer_master_server" ); 75 REGISTER_ARG_FLAG( x, proxy, "game", "gameType", "Start Orxonox as Proxy Server", "multiplayer_proxy_server" ); 75 76 REGISTER_ARG_ARG( H, host, "game", "host", "Host to connect to", "host"); 76 77 REGISTER_ARG_ARG( p, port, "game", "port", "Port to use", "port" ); … … 79 80 REGISTER_ARG_FLAG( f, fullscreen, "video", "Fullscreen-mode", "start Orxonox in fullscreen mode", "1"); 80 81 REGISTER_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"); 82 REGISTER_ARG_ARG( r, resolution, "video", "Resolution", "sets resolution / window size", "res"); 83 REGISTER_ARG_FLAG( d, dedicated, "video", "Norender-mode", "the scene is not rendered", "1" ); 82 84 83 85 REGISTER_ARG_FLAG( a, audio, "audio", "Disable-Audio", "Enable audio", "0" ); … … 144 146 SDL_QuitSubSystem(SDL_INIT_TIMER); 145 147 ClassList::debug(); 146 148 147 149 Preferences::getInstance()->save(); 148 150 … … 301 303 { 302 304 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 305 308 { 306 309 State::setOnline(true); 307 NetworkManager::getInstance()-> establishConnection(this->serverName, port);308 } 309 else if( this->port > 0)310 { // we are a server310 NetworkManager::getInstance()->createClient(this->serverName, port); 311 } 312 else if( gameType == "multiplayer_master_server") 313 { // we are a master server 311 314 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 315 325 } 316 326 … … 459 469 if( Preferences::getInstance()->getString("game", "showGui", "") == "1" ) 460 470 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" || 462 473 Preferences::getInstance()->getString( "game", "gameType", "" ) == "multiplayer_client" ) 463 474 return startNetworkOrxonox(argc, argv); … … 493 504 startOrxonox(argc, argv, host.c_str(), port); 494 505 } 495 else if ( gameType == "multiplayer_ server" )506 else if ( gameType == "multiplayer_master_server" ) 496 507 { 497 508 int port = Preferences::getInstance()->getInt( "game", "port", DEFAULT_ORXONOX_PORT ); 498 509 499 510 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); 500 519 501 520 startOrxonox(argc, argv, "", port); -
branches/proxy/src/story_entities/game_world.cc
r9235 r9396 512 512 void GameWorld::display () 513 513 { 514 515 // if this server is a dedicated server the game workd does not need to be drawn 516 if( !GraphicsEngine::getInstance()->isDedicated()) 517 { 514 518 // render the reflection texture 515 519 this->renderPassReflection(); 516 520 // redner the refraction texture 517 521 this->renderPassRefraction(); 522 } 518 523 // render all 519 524 this->renderPassAll(); … … 643 648 LightManager::getInstance()->draw(); 644 649 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 */ 658 658 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 } 664 677 665 678 engine->draw(); 666 667 // draw the game ruls668 if( likely(this->dataTank->gameRule != NULL))669 this->dataTank->gameRule->draw();670 679 } 671 680 -
branches/proxy/src/story_entities/menu/game_menu.cc
r9369 r9396 574 574 OrxGui::GLGuiButton* createButton = new OrxGui::GLGuiPushButton("Create Server"); 575 575 serverNetworkBox->pack(createButton); 576 createButton->released.connect(this, &GameMenu::create Server);576 createButton->released.connect(this, &GameMenu::createMasterServer); 577 577 } 578 578 } … … 593 593 594 594 State::setOnline(true); 595 NetworkManager::getInstance()-> establishConnection( this->ipInputLine->_getText(), 9999 );595 NetworkManager::getInstance()->createClient( this->ipInputLine->_getText(), 9999 ); 596 596 597 597 Preferences::getInstance()->setString( "multiplayer", "lastVisitedServer", this->ipInputLine->_getText() ); … … 600 600 } 601 601 602 void GameMenu::create Server( )602 void GameMenu::createMasterServer( ) 603 603 { 604 604 PRINTF(0)("Create server\n" ); 605 605 606 606 State::setOnline(true); 607 NetworkManager::getInstance()->create Server( 9999 );607 NetworkManager::getInstance()->createMasterServer( 9999 ); 608 608 609 609 this->startLevel( 5 ); -
branches/proxy/src/story_entities/menu/game_menu.h
r9059 r9396 50 50 51 51 void showServerMenu(); 52 void create Server();52 void createMasterServer(); 53 53 54 54 -
branches/proxy/src/story_entities/multi_player_world_data.cc
r9388 r9396 47 47 #include "player_stats.h" 48 48 49 #include "proxy/ proxy_settings.h"49 #include "proxy/network_settings.h" 50 50 51 51 #include "glmenu_imagescreen.h" … … 112 112 const TiXmlElement* element = NULL; 113 113 114 if( NetworkManager::getInstance()->isMasterServer())114 if( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer()) 115 115 { 116 116 /* load the spawning points */ … … 148 148 element = element->FirstChildElement(); 149 149 150 if( NetworkManager::getInstance()->isMasterServer())150 if( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer()) 151 151 { 152 152 while( element != NULL) … … 206 206 207 207 208 if( NetworkManager::getInstance()->isMasterServer())208 if( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer()) 209 209 { 210 210 this->localPlayer = new Player(); … … 281 281 GameWorldData::loadScene(root); 282 282 283 // LoadParamXML(root, " ProxySettings", ProxySettings::getInstance(), ProxySettings, loadProxySettings);283 // LoadParamXML(root, "NetworkSettings", NetworkSettings::getInstance(), NetworkSettings, loadNetworkSettings); 284 284 285 285 // create server playable 286 if ( NetworkManager::getInstance()->isMasterServer())286 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer()) 287 287 { 288 288 NetworkGameManager::getInstance()->signalNewPlayer( 0 ); … … 300 300 { 301 301 // delete the proxy settings 302 delete ProxySettings::getInstance();302 delete NetworkSettings::getInstance(); 303 303 304 304 /* call underlying function */ -
branches/proxy/src/subprojects/network/network_unit_test.cc
r9347 r9396 205 205 206 206 /* create a server stream */ 207 nm->create Server(port);207 nm->createMasterServer(port); 208 208 209 209 /* esatblish a connection */ … … 213 213 if(error == -1) 214 214 printf("\n\nerror on address resolution, program inconsistancy\n\n"); 215 nm-> establishConnection("localhost", port);215 nm->createClient("localhost", port); 216 216 nm->connectSynchronizeable( *clientSync ); 217 217 /* adding some break for connection setup */ … … 262 262 netMan->initialize(); 263 263 264 netMan->create Server(/**ss, */ 9999);264 netMan->createMasterServer(/**ss, */ 9999); 265 265 266 266 SimpleSync* ss = new SimpleSync("Server"); … … 307 307 host = "localhost"; 308 308 309 netMan-> establishConnection(host, 9999);309 netMan->createClient(host, 9999); 310 310 311 311 // SimpleSync* ss = new SimpleSync("SimpleSync"); … … 361 361 Synchronizeable* ss = new SimpleSync("SimpleSync\0"); 362 362 363 netMan-> establishConnection( name, port );363 netMan->createClient( name, port ); 364 364 netMan->connectSynchronizeable( *ss ); 365 365 -
branches/proxy/src/util/game_rules.cc
r9387 r9396 87 87 void GameRules::registerKill(const Kill& kill) 88 88 { 89 if ( !SharedNetworkData::getInstance()->isMasterServer() )89 if ( SharedNetworkData::getInstance()->isClient() ) 90 90 return; 91 91 -
branches/proxy/src/util/kill_target.cc
r9357 r9396 56 56 57 57 58 MissionState KillTarget::checkMissionGoal(float dt) {} 58 MissionState KillTarget::checkMissionGoal(float dt) 59 { 59 60 61 } 62 -
branches/proxy/src/util/multiplayer_team_deathmatch.cc
r9371 r9396 204 204 assignPlayable(); 205 205 206 if ( !SharedNetworkData::getInstance()->isMasterServer() )206 if ( SharedNetworkData::getInstance()->isClient() ) 207 207 return; 208 208 … … 268 268 void MultiplayerTeamDeathmatch::checkGameRules() 269 269 { 270 if ( !SharedNetworkData::getInstance()->isMasterServer() )270 if ( SharedNetworkData::getInstance()->isClient() ) 271 271 return; 272 272 -
branches/proxy/src/world_entities/bsp_entity.cc
r9059 r9396 1 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 4 4 Copyright (C) 2004 orx 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of the GNU General Public License as published by 8 8 the Free Software Foundation; either version 2, or (at your option) 9 9 any later version. 10 10 11 11 ### File Specific: 12 12 main-programmer: Claudio Botta … … 53 53 54 54 this->bspManager = NULL; 55 55 56 56 this->name_handle = registerVarId( new SynchronizeableString( &this->name, &this->name_write, "name" ) ); 57 57 58 58 this->setSynchronized( true ); 59 59 } … … 63 63 { 64 64 PRINTF(0)("+++++++++++ LOADING NAME %s\n", name.c_str()); 65 65 66 66 this->name = name; 67 67 -
branches/proxy/src/world_entities/creatures/fps_player.cc
r9377 r9396 287 287 //dealing damage 288 288 289 if ( State::isOnline() && SharedNetworkData::getInstance()->isMasterServer())289 if ( State::isOnline() && (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())) 290 290 { 291 291 this->damageTicker -= time; -
branches/proxy/src/world_entities/space_ships/space_ship.cc
r9371 r9396 314 314 if( entity->isA(CL_PROJECTILE) && entity != ref) 315 315 { 316 if ( SharedNetworkData::getInstance()->isMasterServer() )316 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer()) 317 317 { 318 318 //TODO handle this -
branches/proxy/src/world_entities/spawning_point.cc
r9386 r9396 178 178 } 179 179 180 if ( found && SharedNetworkData::getInstance()->isMasterServer() )180 if ( found && SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer()) 181 181 this->sendRespawnMessage( it->entity->getUniqueID() ); 182 182 … … 218 218 bool SpawningPoint::respawnMessageHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId ) 219 219 { 220 if ( SharedNetworkData::getInstance()->isMasterServer() )220 if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer()) 221 221 { 222 222 PRINTF(2)("server received spawn message!\n");
Note: See TracChangeset
for help on using the changeset viewer.