Skip to content
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

Open
wants to merge 2 commits into
base: deploy/fafdevelop
Choose a base branch
from

Conversation

clyfordv
Copy link
Contributor

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:

  • Provides a balance knob
  • Current drop looks a little too sharp (units fly off at an odd velocity, transport isn't settled)

lua/sim/units/AirTransportUnit.lua Outdated Show resolved Hide resolved
Comment on lines 77 to 78
ForkThread(function()
WaitTicks(QuickDropDelay)
Copy link
Contributor

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).

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor

@lL1l1 lL1l1 May 3, 2024

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?

-- various delays in ticks + 1
local BuildCubeGlowDuration = 2
local BuildCubeDelay = 8
local BuildCubeFirstSliceDelay = 3
local BuildCubeSlicePeriod = 12
local BuilderSlicePeriod = 6

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

-- Wait a tick to let the target update awesomely.
WaitTicks(2)
self.timeAlive = self.timeAlive + .1

lua/sim/units/AirTransportUnit.lua Outdated Show resolved Hide resolved
@lL1l1 lL1l1 added area: balance related to units balance feature: transports related to the behavior of transports area: sim Area that is affected by the Simulation of the Game labels May 1, 2024
@lL1l1 lL1l1 added this to the Development iteration II of 2024 milestone May 1, 2024
Copy link
Member

@Garanas Garanas left a 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.

@clyfordv
Copy link
Contributor Author

clyfordv commented May 2, 2024

The original motive was not even to make transports drop faster, but to untangle drop time from transport LiftFactor and K factors, given that:

  1. Transports are pretty particular about how close they need to be to their drop point before releasing cargo.
  2. Adjusting flight characteristics so that transports don't (as an example) descend from mountains at a glacially slow pace caused them to oscillate around their drop point, taking even longer.

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.)

@lL1l1
Copy link
Contributor

lL1l1 commented May 3, 2024

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.
So while it isn't a perfect balance knob because it doesn't handle cliff drops, it can be useful to make normal drops faster or slower.

@Garanas
Copy link
Member

Garanas commented May 12, 2024

With these changes

transports-with.mp4

Without the quick drop feature

transports-without.mp4

There's not much difference in my opinion. Of course some maps have rather extreme cliffs, but there's a limit to what we can (not) support.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: balance related to units balance area: sim Area that is affected by the Simulation of the Game feature: transports related to the behavior of transports
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants