From: <z-...@us...> - 2009-02-16 15:58:06
|
Revision: 9008 http://armagetronad.svn.sourceforge.net/armagetronad/?rev=9008&view=rev Author: z-man Date: 2009-02-16 15:58:01 +0000 (Mon, 16 Feb 2009) Log Message: ----------- Merging branch 0.2.8 from revision 8996 to 9004: ------------------------------------------------------------------------ r9004 | bazaarmagetron | 2009-02-16 16:45:49 +0100 (Mon, 16 Feb 2009) | 2 lines Manuel Moos: Implemented a variant of RLBOT simulating tripple binds. Useful for stress tests. ------------------------------------------------------------------------ r9002 | bazaarmagetron | 2009-02-16 14:20:21 +0100 (Mon, 16 Feb 2009) | 2 lines Manuel Moos: No more respawining while death/winzone is active. ------------------------------------------------------------------------ r9001 | bazaarmagetron | 2009-02-16 14:18:57 +0100 (Mon, 16 Feb 2009) | 2 lines Manuel Moos: Fixed cycle extrapolator getting permanently stuck. ------------------------------------------------------------------------ r9000 | bazaarmagetron | 2009-02-16 11:52:27 +0100 (Mon, 16 Feb 2009) | 5 lines author: Manuel Moos Ammendment to object ID recycling bugfix: sending object create and delete messages in alternating bursts now. Pending deletes should not block creations indefinitely. ------------------------------------------------------------------------ r8999 | bazaarmagetron | 2009-02-16 11:51:31 +0100 (Mon, 16 Feb 2009) | 2 lines Manuel Moos: Removed small hickup detection in regular debug builds. ------------------------------------------------------------------------ r8998 | bazaarmagetron | 2009-02-16 02:28:18 +0100 (Mon, 16 Feb 2009) | 2 lines Manuel Moos: Removed small hickup detection in regular debug builds. ------------------------------------------------------------------------ r8997 | bazaarmagetron | 2009-02-16 02:26:58 +0100 (Mon, 16 Feb 2009) | 4 lines author: Manuel Moos Rough fix for https://launchpad.net/bugs/329874: While there are deletion messages pending to a client, don't send creation messages. ------------------------------------------------------------------------ Revision Links: -------------- http://armagetronad.svn.sourceforge.net/armagetronad/?rev=8996&view=rev Modified Paths: -------------- armagetronad/trunk/armagetronad/src/network/nNetObject.cpp armagetronad/trunk/armagetronad/src/network/nNetwork.cpp armagetronad/trunk/armagetronad/src/tools/tSysTime.cpp armagetronad/trunk/armagetronad/src/tron/gCycle.cpp armagetronad/trunk/armagetronad/src/tron/gGame.cpp Property Changed: ---------------- armagetronad/trunk/ Property changes on: armagetronad/trunk ___________________________________________________________________ Modified: svn:mergeinfo - /armagetronad/branches/0.2.8:8751-8852,8855-8996 + /armagetronad/branches/0.2.8:8751-8852,8855-9004 Modified: armagetronad/trunk/armagetronad/src/network/nNetObject.cpp =================================================================== --- armagetronad/trunk/armagetronad/src/network/nNetObject.cpp 2009-02-16 15:51:02 UTC (rev 9007) +++ armagetronad/trunk/armagetronad/src/network/nNetObject.cpp 2009-02-16 15:58:01 UTC (rev 9008) @@ -979,7 +979,33 @@ static tJUST_CONTROLLED_PTR< nMessage > destroyers[MAXCLIENTS+2]; static REAL destroyersTime[MAXCLIENTS+2]; +static int destroyersCount[MAXCLIENTS+2]; +// special ack for destroy messages +class nWaitForAckDestroy: public nWaitForAck{ +public: + nWaitForAckDestroy(nMessage* m,int receiver) + :nWaitForAck(m,receiver) + { + ++destroyersCount[receiver]; + } + virtual ~nWaitForAckDestroy() + { + --destroyersCount[receiver]; + } +}; + +static void sn_SendDestroyer( int client ) +{ + tASSERT( 0 <= client && client <= MAXCLIENTS+1 ); + if ( destroyers[ client ] ) + { + destroyers[ client ]->SendImmediately( client, false ); + new nWaitForAckDestroy( destroyers[ client ], client ); + destroyers[ client ] = 0; + } +} + // list of netobjects that have a sync request running static tList< nNetObject > sn_SyncRequestedObject; @@ -1056,9 +1082,9 @@ } destroyers[user]->Write(id); - if (destroyers[user]->DataLen()>100){ - destroyers[user]->Send(user); - destroyers[user]=NULL; + if (destroyers[user]->DataLen() > ( destroyersCount[user] ? 1000 : 100 ) ) + { + sn_SendDestroyer( user ); } #ifdef DEBUG @@ -1543,19 +1569,6 @@ sn_syncedUser = user; - // send the destroy messages - if (destroyers[user]) - { - // but check whether the opportunity is good (big destroyers message, or a sync packet in the pipe) first - if ( destroyers[user]->DataLen() > 75 || - sn_Connections[user].sendBuffer_.Len() > 0 || - destroyersTime[user] < tSysTimeFloat()-.5 ) - { - destroyers[user]->Send(user); - destroyers[user]=NULL; - } - } - // con << sn_SyncRequestedObject.Len() << "/" << sn_netObjects.Len() << "\n"; int currentSync = sn_SyncRequestedObject.Len()-1; @@ -1574,6 +1587,31 @@ if (// nos->knowsAbout[user].syncReq && !nos->knowsAbout[user].knowsAboutExistence) { + // look for the object ID in the current destruction message + { + if ( destroyers[user] ) + { + for( int i = destroyers[user]->DataLen()-1; i >= 0; --i ) + { + if ( destroyers[user]->Data(i) == s ) + { + // found it. Send the destruction + // message and wait for its ack. + sn_SendDestroyer( user ); + break; + } + } + } + } + + if ( destroyersCount[user] ) + { + // don't send creation messages while destruction + // messages are unacknowledged. + --currentSync; + continue; + } + if (!nos->knowsAbout[user].acksPending){ #ifdef DEBUG //con << "remotely creating object " << s << '\n'; @@ -1638,6 +1676,18 @@ currentSync--; } + // send the destroy messages + if (destroyers[user] && !destroyersCount[user] ) + { + // but check whether the opportunity is good (big destroyers message, or a sync packet in the pipe) first + if ( destroyers[user]->DataLen() > 75 || + sn_Connections[user].sendBuffer_.Len() > 0 || + destroyersTime[user] < tSysTimeFloat()-.5-2*sn_Connections[user].ping.GetPing() ) + { + sn_SendDestroyer( user ); + } + } + sn_syncedUser = -1; #ifdef DEBUG @@ -1732,10 +1782,9 @@ // send out object deletion messages for ( int i = MAXCLIENTS;i>=0;i--) { - if ( sn_Connections[i].socket && destroyers[i] ) + if ( sn_Connections[i].socket ) { - destroyers[i]->Send(i); - destroyers[i] = NULL; + sn_SendDestroyer(i); } } } @@ -1884,11 +1933,9 @@ } // send and delete the remaining destroyer message - if ( destroyers[user] ) - { - destroyers[user]->Send(user); - destroyers[user]=NULL; - } + sn_SendDestroyer(user); + + destroyersCount[user] = 0; } static nCallbackLoginLogout nlc(&login_callback); Modified: armagetronad/trunk/armagetronad/src/network/nNetwork.cpp =================================================================== --- armagetronad/trunk/armagetronad/src/network/nNetwork.cpp 2009-02-16 15:51:02 UTC (rev 9007) +++ armagetronad/trunk/armagetronad/src/network/nNetwork.cpp 2009-02-16 15:58:01 UTC (rev 9008) @@ -2825,6 +2825,13 @@ sn_DisconnectUserNoWarn(i, "$network_kill_shutdown"); } + // repeat to clear out pending stuff created during + // the last run (destruction messages, for example) + for(int i=MAXCLIENTS+1;i>=0;i--) + { + sn_DisconnectUserNoWarn(i, "$network_kill_shutdown"); + } + sn_Connections[0].socket = 0; // shutdown network system to get new socket Modified: armagetronad/trunk/armagetronad/src/tools/tSysTime.cpp =================================================================== --- armagetronad/trunk/armagetronad/src/tools/tSysTime.cpp 2009-02-16 15:51:02 UTC (rev 9007) +++ armagetronad/trunk/armagetronad/src/tools/tSysTime.cpp 2009-02-16 15:58:01 UTC (rev 9008) @@ -369,7 +369,7 @@ } -#ifdef DEBUG +#ifdef DEBUG_X { static tTime oldRelative = timeRelative; tTime timeStep = timeRelative - oldRelative; Modified: armagetronad/trunk/armagetronad/src/tron/gCycle.cpp =================================================================== --- armagetronad/trunk/armagetronad/src/tron/gCycle.cpp 2009-02-16 15:51:02 UTC (rev 9007) +++ armagetronad/trunk/armagetronad/src/tron/gCycle.cpp 2009-02-16 15:58:01 UTC (rev 9008) @@ -463,6 +463,10 @@ , turnedRecently_ ( 0 ) , owner_ ( owner ) { +#ifdef RLBOT + rlDir = 1; + rlLastTime = -100; +#endif } // describes walls we like. We like enemy walls. We like to go between them. @@ -614,9 +618,51 @@ return owner_->CanMakeTurn( ( action == &gCycle::se_turnRight ) ? 1 : -1 ); } +#ifdef RLBOT + int rlDir; + REAL rlLastTime; +#endif + // does the main thinking void Activate( REAL currentTime ) { +#ifdef RLBOT + // hack chatbot for crazy turning + { + if (!owner_->Alive() || !owner_->Vulnerable() ) + { + return; + } + if( fabs( rlLastTime - currentTime) > 1 ) + { + owner_->Act( &gCycle::se_turnRight, 1 ); + rlDir = -1; + } + else if ( rlDir > 0 ) + { + if( CanMakeTurn( &gCycle::se_turnRight ) ) + { + owner_->Act( &gCycle::se_turnRight, 1 ); + owner_->Act( &gCycle::se_turnRight, 1 ); + owner_->Act( &gCycle::se_turnRight, 1 ); + rlDir = -1; + } + } + else + { + if( CanMakeTurn( &gCycle::se_turnLeft ) ) + { + owner_->Act( &gCycle::se_turnLeft, 1 ); + owner_->Act( &gCycle::se_turnLeft, 1 ); + owner_->Act( &gCycle::se_turnLeft, 1 ); + rlDir = 1; + } + } + rlLastTime = currentTime; + return; + } +#endif + // is it already time for activation? if ( currentTime < nextChatAI_ ) return; @@ -5148,11 +5194,24 @@ if ( newTime >= lastTime ) { // simulate extrapolator until now - eGameObject::TimestepThis( lastTime, extrapolator_ ); + if( lastTime > extrapolator_->LastTime() ) + { + eGameObject::TimestepThis( lastTime, extrapolator_ ); + } // test if there are real (the check for list does that) destinations left; we cannot call it finished if there are. gDestination* unhandledDestination = extrapolator_->GetCurrentDestination(); ret = !unhandledDestination || !unhandledDestination->list; + + if( !ret ) + { + if ( unhandledDestination->gameTime < newTime - Lag() * 2 - sn_Connections[0].ping.GetPing()*2 - GetTurnDelay()*4 ) + { + // emergency reset. + extrapolator_ = 0; + resimulate_ = true; + } + } newTime = lastTime; } Modified: armagetronad/trunk/armagetronad/src/tron/gGame.cpp =================================================================== --- armagetronad/trunk/armagetronad/src/tron/gGame.cpp 2009-02-16 15:51:02 UTC (rev 9007) +++ armagetronad/trunk/armagetronad/src/tron/gGame.cpp 2009-02-16 15:58:01 UTC (rev 9008) @@ -2951,7 +2951,7 @@ eGameObject *e=p->Object(); - if ( ( !e || !e->Alive() && e->DeathTime() < time - .5 ) && sn_GetNetState() != nCLIENT ) + if ( ( !e || ( !e->Alive() && e->DeathTime() < time - .5 ) ) && sn_GetNetState() != nCLIENT ) { sg_RespawnPlayer(time, grid, &arena, p); } @@ -3006,7 +3006,11 @@ #endif #ifdef RESPAWN_HACK - sg_Respawn(time,grid,Arena); + // no respawining while deathzone is active. + if( !winDeathZone_ ) + { + sg_Respawn(time,grid,Arena); + } #endif // chop timestep into small, managable bits This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |