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
1=== modified file 'src/protobuf/gCycle.proto'
2--- src/protobuf/gCycle.proto 2009-02-03 10:53:00 +0000
3+++ src/protobuf/gCycle.proto 2009-03-12 18:42:56 +0000
4@@ -79,4 +79,7 @@
5 optional bool legacy_sync_end = 20001;
6
7 // extensions go here
8+
9+ optional bool vulnerable = 20;
10+ optional bool blinking = 21;
11 }
12
13=== modified file 'src/tron/gCycle.cpp'
14--- src/tron/gCycle.cpp 2009-03-04 16:57:04 +0000
15+++ src/tron/gCycle.cpp 2009-03-12 18:42:56 +0000
16@@ -25,6 +25,8 @@
17
18 */
19
20+#include <boost/logic/tribool.hpp>
21+
22 #include "eEventNotification.h"
23 #include "gCycle.h"
24 #include "nConfig.h"
25@@ -4268,7 +4270,7 @@
26
27 // are we blinking from invulnerability?
28 bool blinking = false;
29- if ( lastTime > spawnTime_ && !Vulnerable() )
30+ if ( Blinking() )
31 {
32 double time = tSysTimeFloat();
33 double wrap = time - floor(time);
34@@ -5080,6 +5082,9 @@
35 sync.set_turns(turns);
36 sync.set_braking(braking);
37
38+ sync.set_vulnerable( Vulnerable() );
39+ sync.set_blinking( Blinking() );
40+
41 // write last turn position
42 GetLastTurnPos().WriteSync( *sync.mutable_last_turn_position() );
43
44@@ -5421,6 +5426,11 @@
45 sync.lastTurn = currentWall->beg;
46 }
47
48+ if ( syncX.has_vulnerable() )
49+ vulnerable_ = syncX.vulnerable();
50+ if ( syncX.has_blinking() )
51+ blinking_ = syncX.blinking();
52+
53 bool canUseExtrapolatorMethod = false;
54
55 bool rubberSent = false;
56@@ -6200,5 +6210,14 @@
57
58 bool gCycle::Vulnerable() const
59 {
60+ if (!boost::logic::indeterminate(vulnerable_))
61+ return vulnerable_;
62 return Alive() && lastTime > spawnTime_ + sg_cycleInvulnerableTime;
63 }
64+
65+bool gCycle::Blinking() const
66+{
67+ if (!boost::logic::indeterminate(blinking_))
68+ return blinking_;
69+ return lastTime > spawnTime_ && !Vulnerable();
70+}
71
72=== modified file 'src/tron/gCycle.h'
73--- src/tron/gCycle.h 2009-02-12 21:25:13 +0000
74+++ src/tron/gCycle.h 2009-03-12 18:42:56 +0000
75@@ -30,6 +30,8 @@
76
77 //#define USE_HEADLIGHT
78
79+#include <boost/logic/tribool.hpp>
80+
81 #include "gStuff.h"
82 //#include "rTexture.h"
83 //#include "rModel.h"
84@@ -163,6 +165,10 @@
85 std::auto_ptr< gCycleChatBot > chatBot_;
86
87 bool dropWallRequested_; //!< flag indicating that someone requested a wall drop
88+
89+ boost::logic::tribool vulnerable_;
90+ boost::logic::tribool blinking_;
91+
92 public:
93 eCoord lastGoodPosition_; // the location of the last known good position
94
95@@ -245,6 +251,7 @@
96 int WindingNumber() const {return windingNumber_;}
97
98 virtual bool Vulnerable () const ; //!< returns whether the cycle can be killed
99+ virtual bool Blinking() const; //!< returns whether the cycle should blink
100
101 // bool CanMakeTurn() const { return pendingTurns <= 0 && lastTime >= nextTurn; }
102

Subscribers

People subscribed via source and target branches

to status/vote changes: