ball_speed_decay

For all the help you need with Armagetron!
Post Reply
User avatar
dukevin
Round Winner
Posts: 219
Joined: Mon Aug 30, 2010 8:25 am
Location: Southern California
Contact:

ball_speed_decay

Post by dukevin »

ball_speed_decay 0 is the default. I am assuming that giving this number a postive value means that the ball slows down over time. But giving ball_speed_decay any number other than 0 (including decimal and negative values), causes the ball to launch at light speed and disappear. Having ball_respawn on, makes it come back but flash really fast when attemping to hit it. I tried putting speed decay in the xml file with the same results? What does ball_speed_decay actually do?
Image
User avatar
Z-Man
God & Project Admin
Posts: 11710
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Re: ball_speed_decay

Post by Z-Man »

I think it's supposed to reduce the ball speed by that given value per second. It's broken, however. Patch:

Code: Select all

=== modified file 'src/tron/gWinZone.cpp'
--- src/tron/gWinZone.cpp       2010-08-06 05:25:44 +0000
+++ src/tron/gWinZone.cpp       2010-10-12 20:12:24 +0000
@@ -721,10 +721,14 @@
        if (sg_ballSpeedDecay)
        {
                REAL SpeedFactor = V.Norm();
-               SpeedFactor = SpeedFactor - dt*sg_ballSpeedDecay;
-               SpeedFactor = SpeedFactor<0 ? 0 : SpeedFactor;
-               SetVelocity(V * SpeedFactor);
-               doRequestSync = true;
+        if( SpeedFactor > 0 )
+        {
+            SpeedFactor = SpeedFactor - dt*sg_ballSpeedDecay;
+            SpeedFactor = SpeedFactor<0 ? 0 : SpeedFactor;
+            V.Normalize();
+            SetVelocity(V * SpeedFactor);
+            doRequestSync = true;
+        }
        }
 
        // update time
Also, the code shouldn't set doRequestSync every frame, that can waste terrible amounts of bandwidth.
User avatar
dukevin
Round Winner
Posts: 219
Joined: Mon Aug 30, 2010 8:25 am
Location: Southern California
Contact:

Re: ball_speed_decay

Post by dukevin »

Thank you Z-man, I will try this out.
Image
User avatar
p4
On Lightcycle Grid
Posts: 10
Joined: Mon Jun 12, 2006 8:02 pm
Location: 50°17'50.79"N 18°41'04.70"E
Contact:

Re: ball_speed_decay

Post by p4 »

Thanks for contribution as well. :)
Image
Post Reply