Browse files

Fix timer getting way too slow and use more retail like tick interval

  • Loading branch information...
1 parent 71a4258 commit e52fc9e630ec58477c1613197f487f3829bf69aa @stfx stfx committed Feb 21, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/game/GameObject.cpp
7 src/game/GameObject.cpp
@@ -1959,6 +1959,7 @@ void GameObject::SetCapturePointSlider(int8 value)
m_captureSlider = value;
+ m_cooldownTime = time(NULL) + 5; // initial tick delay
@@ -1978,8 +1979,8 @@ void GameObject::SetCapturePointSlider(int8 value)
void GameObject::TickCapturePoint()
- // TODO: On retail at HP, NA and ZM: Ticks every 5.2 seconds. slider increase when new player enters on tick
- m_cooldownTime = time(NULL) + 3;
+ // TODO: On retail: Ticks every 5.2 seconds. slider increase when new player enters on tick
+ m_cooldownTime += 5;
GameObjectInfo const* info = GetGOInfo();
float radius = info->capturePoint.radius;
@@ -2037,7 +2038,7 @@ void GameObject::TickCapturePoint()
rangePlayers = -maxSuperiority;
// time to capture from 0% to 100% is maxTime for minSuperiority amount of players and minTime for maxSuperiority amount of players
- float diffTicks = 300.0f /
+ float diffTicks = 500.0f /
(float)((maxSuperiority - abs(rangePlayers)) * (info->capturePoint.maxTime - info->capturePoint.minTime) /
(float)(maxSuperiority - info->capturePoint.minSuperiority) + info->capturePoint.minTime);
xfurry added a line comment Mar 24, 2012

Something is really wrong with this calculation.
I tested on local and I can capture a tower in Terokkar in only a few seconds alone. Normally it should take at least 1 min to capture a Terokkar tower alone.
Terokkar 4,166666667 units / tick
Hellfire 0,833333333 units / tick
Zangar 0,833333333 units / tick
Plaguelands 0,416666667 units / tick
Halaa 0,833333333 units / tick
Venture 0,833333333 units / tick

I don't think this is correct. The calculation difference is too high between Terokkar and the others. Normally they should have the same progress rate and the difficulty difference should be done only by the neutral percent which is much more higher in Terokkar than on Hellfire.
@stfx can you please take a look at this?

stfx added a line comment Mar 25, 2012

As already mentioned in IRC the calculation is perfectly fine however the tick method is causing issues. The issue we have is that the initial tick time is set in the Gameobject:Create function but the update function is not called if noone is near. 5c44d76 is also not correct because it causes delay if it was called after 5.12 seconds for example.

One possible solution would be not to use m_cooldownTime but rather a new uint16 variable which uses milliseconds and then define the next tick time like this in Gameobject:Update:

m_captureTick += diff;
if (m_captureTick > 5000)
    m_captureTick -= 5000;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

0 comments on commit e52fc9e

Please sign in to comment.