Changeset 1516 for code/branches
- Timestamp:
- Jun 2, 2008, 2:33:17 PM (16 years ago)
- Location:
- code/branches/network
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/TODO
r1505 r1516 1 1 - should we use enet_peer_ping to test if a client is still alive ? 2 2 - enet_host_broadcast ? (to all peers) 3 - enet_host_check_events ? instead of enet_host_service -
code/branches/network/src/network/ClientInformation.cc
r1505 r1516 191 191 failures_=0; 192 192 } 193 194 enet_uint32 ClientInformation::getRTT(){ 195 return peer_->roundTripTime; 196 } 197 198 enet_uint32 ClientInformation::getPacketLoss(){ 199 return peer_->packetLoss; 200 } 193 201 194 202 int ClientInformation::getGamestateID() { -
code/branches/network/src/network/ClientInformation.h
r1505 r1516 87 87 void addFailure(); 88 88 void resetFailures(); 89 enet_uint32 getRTT(); 90 enet_uint32 getPacketLoss(); 89 91 90 92 bool removeClient(int clientID); -
code/branches/network/src/network/GameStateClient.cc
r1505 r1516 82 82 if (loadSnapshot(gs)){ 83 83 gameStateMap.insert(std::pair<int, GameState*>(gs->id, gs)); 84 COUT( 4) << "adding decoded gs with id: " << gs->id << " diffed from: " << gs->base_id << std::endl;84 COUT(5) << "adding decoded gs with id: " << gs->id << " diffed from: " << gs->base_id << std::endl; 85 85 last_diff_=gs->base_id; 86 86 //last_gamestate_=gs->id; … … 241 241 size+=it->getSize(); // size of the actual data of the synchronisable 242 242 size+=3*sizeof(int); // size of datasize, classID and objectID 243 COUT( 4) << "getpartialsnapshot: size: " << size << std::endl;243 COUT(5) << "getpartialsnapshot: size: " << size << std::endl; 244 244 } 245 245 //retval->data = (unsigned char*)malloc(size); … … 380 380 //std::cout << "length " << length << std::endl; 381 381 switch ( retval ) { 382 case Z_OK: COUT( 4) << "successfully decompressed" << std::endl; break;382 case Z_OK: COUT(5) << "successfully decompressed" << std::endl; break; 383 383 case Z_MEM_ERROR: COUT(1) << "not enough memory available" << std::endl; return NULL; 384 384 case Z_BUF_ERROR: COUT(2) << "not enough memory available in the buffer" << std::endl; return NULL; … … 399 399 400 400 GameState *GameStateClient::decode(GameState *old, GameStateCompressed *diff) { 401 COUT( 4) << "using diffed gamestate" << std::endl;401 COUT(5) << "using diffed gamestate" << std::endl; 402 402 GameState *t = decode(diff); 403 403 if(!t) -
code/branches/network/src/network/GameStateManager.cc
r1505 r1516 106 106 break; 107 107 if( (*it).second <= 0 ){ 108 COUT( 4) << "GameStateManager: deleting gamestate with id: " << (*it).first << ", uses: " << (*it).second << std::endl;108 COUT(5) << "GameStateManager: deleting gamestate with id: " << (*it).first << ", uses: " << (*it).second << std::endl; 109 109 std::map<int, GameState *>::iterator tempit = gameStateMap.find((*it).first); 110 110 if( tempit != gameStateMap.end() ){ … … 140 140 client = it->second; 141 141 GameState *server = reference; 142 COUT(4) << "client: " << client << " server: " << server << " gamestatemap: " << &gameStateMap << " size: " << server->size << std::endl; 142 //COUT(4) << "client: " << client << " server: " << server << " gamestatemap: " << &gameStateMap << " size: " << server->size << std::endl; 143 COUT(4) << "client: " << (client!=0 ? client->id : (int)client) << " server: " << server->id << " gamestatemap: " << &gameStateMap << " size: " << server->size << std::endl; 143 144 if(client) 144 145 return encode(client, server); … … 267 268 sync.data = data; 268 269 data+=sync.length; 269 COUT( 4) << "objectID: " << sync.objectID << " classID: " << sync.classID << std::endl;270 COUT(5) << "objectID: " << sync.objectID << " classID: " << sync.classID << std::endl; 270 271 while(it && it->objectID!=sync.objectID) 271 272 ++it; … … 319 320 320 321 GameStateCompressed *GameStateManager::encode(GameState *a, GameState *b) { 321 COUT( 4) << "G.St.Man: this will be a DIFFED gamestate" << std::endl;322 COUT(5) << "G.St.Man: this will be a DIFFED gamestate" << std::endl; 322 323 GameState *r = diff(a,b); 323 324 GameStateCompressed *c = compress_(r); -
code/branches/network/src/network/PacketDecoder.cc
r1505 r1516 151 151 void PacketDecoder::gstate( ENetPacket* packet, int clientID ) 152 152 { 153 if(!testAndRemoveCRC(packet)){154 155 return;156 }153 // if(!testAndRemoveCRC(packet)){ 154 // COUT(3) << "crc test of gamestate failed - dropping packet" << std::endl; 155 // return; 156 // } 157 157 GameStateCompressed* currentState = NULL; 158 158 currentState = new GameStateCompressed; -
code/branches/network/src/network/PacketGenerator.cc
r1505 r1516 144 144 COUT(4) << "PacketGenerator generating totalLen " << totalLen << std::endl; 145 145 //delete[] data; 146 if(!addCRC(packet))147 COUT(3) << "could not add crc to gamestate packet" << std::endl;146 // if(!addCRC(packet)) 147 // COUT(3) << "could not add crc to gamestate packet" << std::endl; 148 148 return packet; 149 149 } -
code/branches/network/src/network/Server.cc
r1505 r1516 202 202 void Server::updateGamestate() { 203 203 gamestates->update(); 204 COUT( 4) << "Server: one gamestate update complete, goig to sendGameState" << std::endl;204 COUT(5) << "Server: one gamestate update complete, goig to sendGameState" << std::endl; 205 205 //std::cout << "updated gamestate, sending it" << std::endl; 206 206 //if(clients->getGamestateID()!=GAMESTATEID_INITIAL) 207 207 sendGameState(); 208 COUT( 4) << "Server: one sendGameState turn complete, repeat in next tick" << std::endl;208 COUT(5) << "Server: one sendGameState turn complete, repeat in next tick" << std::endl; 209 209 //std::cout << "sent gamestate" << std::endl; 210 210 } … … 229 229 continue; 230 230 } 231 COUT(4) << "client id: " << temp->getID() << " RTT: " << temp->getRTT() << " loss: " << temp->getPacketLoss() << std::endl; 231 232 COUT(5) << "Server: doing gamestate gamestate preparation" << std::endl; 232 233 int gid = temp->getGamestateID(); //get gamestate id … … 312 313 COUT(4) << "Con.Man: creating client id: " << temp->getID() << std::endl; 313 314 connection->syncClassid(temp->getID()); 314 COUT( 4) << "creating spaceship for clientid: " << temp->getID() << std::endl;315 COUT(5) << "creating spaceship for clientid: " << temp->getID() << std::endl; 315 316 // TODO: this is only a hack, untill we have a possibility to define default player-join actions 316 317 if(!createShip(temp)) -
code/branches/network/src/orxonox/objects/SpaceShip.cc
r1505 r1516 469 469 if( myShip_ ) 470 470 { 471 COUT( 4) << "steering our ship: " << objectID << std::endl;471 COUT(5) << "steering our ship: " << objectID << std::endl; 472 472 this->acceleration_.x = 0; 473 473 this->acceleration_.y = 0;
Note: See TracChangeset
for help on using the changeset viewer.