Merge lp:~luke-jr/armagetronad/armagetronad-net-vulnerable-blinking into lp:~armagetronad-dev/armagetronad/trunk-armagetronad-work

Proposed by Luke-Jr
Status: Work in progress
Proposed branch: lp:~luke-jr/armagetronad/armagetronad-net-vulnerable-blinking
Merge into: lp:~armagetronad-dev/armagetronad/trunk-armagetronad-work
Diff against target: None lines
To merge this branch: bzr merge lp:~luke-jr/armagetronad/armagetronad-net-vulnerable-blinking
Reviewer Review Type Date Requested Status
Manuel Moos Needs Fixing
Review via email: mp+4415@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Luke-Jr (luke-jr) wrote :

gCycle::ReadSync is somewhat complex-- could someone make sure this looks sane?

Revision history for this message
Manuel Moos (z-man) wrote :

Looks basically fine. Just one problem:
syncs of other cycles that don't make turns are sent to the client once per second, and if the cycle turns vulnerable right after a sync, there's a potential one second delay between the change and the clients noticing it. Quick fix: comment out the sync writing of the two flags for now, as long as the clients have the correct logic implemented, its not needed. Only when the server decides to change the invulnerability logic, it would be needed to add a 'if blinking/vulnerability changed since the last frame, send a sync' bit in the timestep function. Move the branch to ~/armagetronad-dev and I'll take care of that right now, the timestep logic is kind of involved (lots of functions called TimestepSomething in gCycle and gCycleMovement).

review: Needs Fixing
Revision history for this message
Luke-Jr (luke-jr) wrote :

Unmerged revisions

895. By Luke-Jr

support syncing is-blinking over the network

894. By Luke-Jr

move is-blinking logic to a function

893. By Luke-Jr

allow server to determine when a cycle is or is not Vulnerable

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/protobuf/gCycle.proto'
--- src/protobuf/gCycle.proto 2009-02-03 10:53:00 +0000
+++ src/protobuf/gCycle.proto 2009-03-12 18:42:56 +0000
@@ -79,4 +79,7 @@
79 optional bool legacy_sync_end = 20001;79 optional bool legacy_sync_end = 20001;
8080
81 // extensions go here81 // extensions go here
82
83 optional bool vulnerable = 20;
84 optional bool blinking = 21;
82}85}
8386
=== modified file 'src/tron/gCycle.cpp'
--- src/tron/gCycle.cpp 2009-03-04 16:57:04 +0000
+++ src/tron/gCycle.cpp 2009-03-12 18:42:56 +0000
@@ -25,6 +25,8 @@
2525
26*/26*/
2727
28#include <boost/logic/tribool.hpp>
29
28#include "eEventNotification.h"30#include "eEventNotification.h"
29#include "gCycle.h"31#include "gCycle.h"
30#include "nConfig.h"32#include "nConfig.h"
@@ -4268,7 +4270,7 @@
42684270
4269 // are we blinking from invulnerability?4271 // are we blinking from invulnerability?
4270 bool blinking = false;4272 bool blinking = false;
4271 if ( lastTime > spawnTime_ && !Vulnerable() )4273 if ( Blinking() )
4272 {4274 {
4273 double time = tSysTimeFloat();4275 double time = tSysTimeFloat();
4274 double wrap = time - floor(time);4276 double wrap = time - floor(time);
@@ -5080,6 +5082,9 @@
5080 sync.set_turns(turns);5082 sync.set_turns(turns);
5081 sync.set_braking(braking);5083 sync.set_braking(braking);
50825084
5085 sync.set_vulnerable( Vulnerable() );
5086 sync.set_blinking( Blinking() );
5087
5083 // write last turn position5088 // write last turn position
5084 GetLastTurnPos().WriteSync( *sync.mutable_last_turn_position() );5089 GetLastTurnPos().WriteSync( *sync.mutable_last_turn_position() );
50855090
@@ -5421,6 +5426,11 @@
5421 sync.lastTurn = currentWall->beg;5426 sync.lastTurn = currentWall->beg;
5422 }5427 }
54235428
5429 if ( syncX.has_vulnerable() )
5430 vulnerable_ = syncX.vulnerable();
5431 if ( syncX.has_blinking() )
5432 blinking_ = syncX.blinking();
5433
5424 bool canUseExtrapolatorMethod = false;5434 bool canUseExtrapolatorMethod = false;
54255435
5426 bool rubberSent = false;5436 bool rubberSent = false;
@@ -6200,5 +6210,14 @@
62006210
6201bool gCycle::Vulnerable() const6211bool gCycle::Vulnerable() const
6202{6212{
6213 if (!boost::logic::indeterminate(vulnerable_))
6214 return vulnerable_;
6203 return Alive() && lastTime > spawnTime_ + sg_cycleInvulnerableTime;6215 return Alive() && lastTime > spawnTime_ + sg_cycleInvulnerableTime;
6204}6216}
6217
6218bool gCycle::Blinking() const
6219{
6220 if (!boost::logic::indeterminate(blinking_))
6221 return blinking_;
6222 return lastTime > spawnTime_ && !Vulnerable();
6223}
62056224
=== modified file 'src/tron/gCycle.h'
--- src/tron/gCycle.h 2009-02-12 21:25:13 +0000
+++ src/tron/gCycle.h 2009-03-12 18:42:56 +0000
@@ -30,6 +30,8 @@
3030
31//#define USE_HEADLIGHT31//#define USE_HEADLIGHT
3232
33#include <boost/logic/tribool.hpp>
34
33#include "gStuff.h"35#include "gStuff.h"
34//#include "rTexture.h"36//#include "rTexture.h"
35//#include "rModel.h"37//#include "rModel.h"
@@ -163,6 +165,10 @@
163 std::auto_ptr< gCycleChatBot > chatBot_;165 std::auto_ptr< gCycleChatBot > chatBot_;
164166
165 bool dropWallRequested_; //!< flag indicating that someone requested a wall drop167 bool dropWallRequested_; //!< flag indicating that someone requested a wall drop
168
169 boost::logic::tribool vulnerable_;
170 boost::logic::tribool blinking_;
171
166public:172public:
167 eCoord lastGoodPosition_; // the location of the last known good position173 eCoord lastGoodPosition_; // the location of the last known good position
168174
@@ -245,6 +251,7 @@
245 int WindingNumber() const {return windingNumber_;}251 int WindingNumber() const {return windingNumber_;}
246252
247 virtual bool Vulnerable () const ; //!< returns whether the cycle can be killed253 virtual bool Vulnerable () const ; //!< returns whether the cycle can be killed
254 virtual bool Blinking() const; //!< returns whether the cycle should blink
248255
249 // bool CanMakeTurn() const { return pendingTurns <= 0 && lastTime >= nextTurn; }256 // bool CanMakeTurn() const { return pendingTurns <= 0 && lastTime >= nextTurn; }
250257

Subscribers

People subscribed via source and target branches

to status/vote changes: