New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add adjustable delay to how fast QuickDrop fires #6113
base: deploy/fafdevelop
Are you sure you want to change the base?
Conversation
lua/sim/units/AirTransportUnit.lua
Outdated
ForkThread(function() | ||
WaitTicks(QuickDropDelay) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forking a thread waits 1 tick but then WaitTicks correctly waits 10 ticks from before the thread was forked. e.g.:
LOG(GetGameTick()) -- tick 1
ForkThread(function ()
LOG(GetGameTick()) -- tick 2
WaitTicks(10)
LOG(GetGameTick()) -- tick 11
I don't really understand it but it works as long as QuickDropDelay >= 2 (1 delay ends up the same as 2).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think that warrants a warning if the delay is too short? I don't see this number being changed too often.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting ticks is a bit strange - waiting 0 and 1 ticks is effectively the same tick! When we pass in 1 tack then we effectively tell the game to perform this function at the end of the current tick. When we wait 2 ticks, we tell the game to queue it for the next tick.
Effectively we also wait for the 'current' tick.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think that warrants a warning if the delay is too short? I don't see this number being changed too often.
I think a comment saying that the minimum is 2 ticks is sufficient.
When we pass in 1 tack then we effectively tell the game to perform this function at the end of the current tick. When we wait 2 ticks, we tell the game to queue it for the next tick.
Is that why some waits have off by 1 error compensation?
Lines 24 to 29 in b29226f
-- various delays in ticks + 1 | |
local BuildCubeGlowDuration = 2 | |
local BuildCubeDelay = 8 | |
local BuildCubeFirstSliceDelay = 3 | |
local BuildCubeSlicePeriod = 12 | |
local BuilderSlicePeriod = 6 |
fa/lua/sim/projectiles/components/TacticalMissileComponent.lua
Lines 132 to 135 in b29226f
for t = 0.2, accelTime, 0.2 do | |
self:SetMaxSpeed(maxSpeed - (maxSpeed - terminalSpeed) * t/accelTime) | |
WaitTicks(3) -- This waits 2 ticks instead of 3 according to GetGameTick(). | |
end |
fa/lua/sim/units/seraphim/SEnergyBallUnit.lua
Lines 82 to 84 in b29226f
-- Wait a tick to let the target update awesomely. | |
WaitTicks(2) | |
self.timeAlive = self.timeAlive + .1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this pull request takes it in the right direction. I understand what it is trying to fix, but what if we'd just remove the quick drop functionality instead?
Since the transport changes loading and unloading was much faster than it was before to begin with. I may run a few simulations to verify how much quick drop actually makes everything drop faster.
The original motive was not even to make transports drop faster, but to untangle drop time from transport
If [1] has been fixed (through an engine patch?) I could see quick drop no longer being necessary, but as long as it remains [2] is going to apply. I didn't see a huge need for the addition of this delay, but it was raised as an issue on the discord (not a majority opinion, perhaps) so I figured I'd bang it out. (And a minor point, but the visuals of the transports taking a moment to level out are much better, which means we could undo the bank factor changes that came with the original QuickDrop because dropping at a steep bank looked rather jarring.) |
When I was logging the tick timings I noticed that it drops without having to abort navigation when arriving to the drop location from a lower surface height (e.g. from water/land onto a cliff/plateau), and it does abort navigation when arriving to the drop location from an equal surface height. |
Saw enough talk both ways that I'd figured I'd bang this out as an option. Adds a minimum time for QuickDrop to fire.
Reasons: