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

Fix: Powered Arms Dealer Door Still Open When Chain Building Technicals and Combat Bikes #538

Merged
merged 1 commit into from
Oct 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10420,11 +10420,14 @@ Object Chem_GLAArmsDealer
Behavior = FXListDie ModuleTag_09
DeathFX = FX_StructureMediumDeath
End

; Patch104p @bugfix commy2 09/10/2021 Fix door not closing in time when building Technicals or Combat Bikes with power.

Behavior = ProductionUpdate ModuleTag_10
NumDoorAnimations = 1
DoorOpeningTime = 2000 ;in mSeconds
DoorWaitOpenTime = 3000 ;in mSeconds
DoorCloseTime = 2000 ;in mSeconds
DoorWaitOpenTime = 2000 ;in mSeconds
DoorCloseTime = 1800 ;in mSeconds
ConstructionCompleteDuration = 1500 ;in mSeconds
End
Behavior = DefaultProductionExitUpdate ModuleTag_11
Expand Down
7 changes: 5 additions & 2 deletions Patch104pZH/GameFilesEdited/Data/INI/Object/DemoGeneral.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10364,11 +10364,14 @@ Object Demo_GLAArmsDealer
Behavior = FXListDie ModuleTag_09
DeathFX = FX_StructureMediumDeath
End

; Patch104p @bugfix commy2 09/10/2021 Fix door not closing in time when building Technicals or Combat Bikes with power.

Behavior = ProductionUpdate ModuleTag_10
NumDoorAnimations = 1
DoorOpeningTime = 2000 ;in mSeconds
DoorWaitOpenTime = 3000 ;in mSeconds
DoorCloseTime = 2000 ;in mSeconds
DoorWaitOpenTime = 2000 ;in mSeconds
DoorCloseTime = 1800 ;in mSeconds
ConstructionCompleteDuration = 1500 ;in mSeconds
End
Behavior = DefaultProductionExitUpdate ModuleTag_11
Expand Down
14 changes: 10 additions & 4 deletions Patch104pZH/GameFilesEdited/Data/INI/Object/FactionBuilding.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26846,11 +26846,14 @@ Object GLAArmsDealer
Behavior = FXListDie ModuleTag_09
DeathFX = FX_StructureMediumDeath
End

; Patch104p @bugfix commy2 09/10/2021 Fix door not closing in time when building Technicals or Combat Bikes with power.

Behavior = ProductionUpdate ModuleTag_10
NumDoorAnimations = 1
DoorOpeningTime = 2000 ;in mSeconds
DoorWaitOpenTime = 3000 ;in mSeconds
DoorCloseTime = 2000 ;in mSeconds
DoorWaitOpenTime = 2000 ;in mSeconds
DoorCloseTime = 1800 ;in mSeconds
ConstructionCompleteDuration = 1500 ;in mSeconds
End
Behavior = DefaultProductionExitUpdate ModuleTag_11
Expand Down Expand Up @@ -36305,11 +36308,14 @@ Object GLAArmsDealerNoHole
Behavior = FXListDie ModuleTag_09
DeathFX = FX_StructureMediumDeath
End

; Patch104p @bugfix commy2 09/10/2021 Fix door not closing in time when building Technicals or Combat Bikes with power.

Behavior = ProductionUpdate ModuleTag_10
NumDoorAnimations = 1
DoorOpeningTime = 2000 ;in mSeconds
DoorWaitOpenTime = 3000 ;in mSeconds
DoorCloseTime = 2000 ;in mSeconds
DoorWaitOpenTime = 2000 ;in mSeconds
DoorCloseTime = 1800 ;in mSeconds
ConstructionCompleteDuration = 1500 ;in mSeconds
End
Behavior = DefaultProductionExitUpdate ModuleTag_11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4316,11 +4316,14 @@ Object GC_Chem_GLAArmsDealer
Behavior = FXListDie ModuleTag_09
DeathFX = FX_StructureMediumDeath
End

; Patch104p @bugfix commy2 09/10/2021 Fix door not closing in time when building Technicals or Combat Bikes with power.

Behavior = ProductionUpdate ModuleTag_10
NumDoorAnimations = 1
DoorOpeningTime = 2000 ;in mSeconds
DoorWaitOpenTime = 3000 ;in mSeconds
DoorCloseTime = 2000 ;in mSeconds
DoorWaitOpenTime = 2000 ;in mSeconds
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Wouldn't it have been enough to just decrease DoorWaitOpenTime by a few milliseconds? I don't understand why 2 variables had to be changed. Plus now Door close is quicker than door open. Why?

Copy link
Collaborator Author

@commy2 commy2 Oct 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plus now Door close is quicker than door open. Why?

The time it takes for the door to close is animation based, so part of the model. DoorCloseTime is used to make the logic register that the door was already closed. You could set DoorCloseTime to 2 minutes and it wouldn't speed up / slow down the animation at all.

Wouldn't it have been enough to just decrease DoorWaitOpenTime by a few milliseconds?

The game is not precise enough for a few msecs to mean anything. It runs at 30 FPS in multiplayer, so to make an actual difference, you need at least 33.33 msecs (= 1 frame).

Copy link
Collaborator Author

@commy2 commy2 Oct 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may help:

https://i.imgur.com/PGIyjQh.png

Edit: oops, replace "fps" with "milliseconds per frame". 1/30 FPS = 0.033 seconds per frame.

Copy link
Collaborator Author

@commy2 commy2 Oct 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Condition for not bugging out door opening for fast building units:
DoorWaitOpenTime + DoorCloseTime < (fastest) BuildTime
2000 msec + 1800 msec < 4.0 sec (Combat Bike w/ power)
3800 msec < 4000 msec, check

Condition for not bugging out door animation:
<animation frame count> / 30 FPS < DoorCloseTime
50 (Arms Dealer) / 30 FPS < 1800 msec
1667 msec < 1800 msec, check

Copy link
Collaborator Author

@commy2 commy2 Oct 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DoorOpeningTime and DoorCloseTime do not determine the speed of the door animation. To not bug out the visuals, these must be bigger than the actual door animation time though.

DoorOpeningTime is important in that it adds a constant to actual build-time of units.

DoorCloseTime and DoorWaitOpenTime are less important, but must together be smaller than the fastest BuiltTime of any unit, otherwise the DoorOpeningTime delay is skipped.

If necessary, the door animations can be adjusted by using AnimationSpeedFactorRange in the W3DModelDraw module. That parameter can be used indepentently for door opening and closing.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok now it makes sense. Bike build is 4000 ms. I was wondering why door close time is combined 3800 ms when Technical build is 5000 ms. What you refer to as "milliseconds per frame" is called "frame time" in programmer terms.

DoorCloseTime = 1800 ;in mSeconds
ConstructionCompleteDuration = 1500 ;in mSeconds
End
Behavior = DefaultProductionExitUpdate ModuleTag_11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4186,11 +4186,14 @@ Object GC_Slth_GLAArmsDealer
Behavior = FXListDie ModuleTag_09
DeathFX = FX_StructureMediumDeath
End

; Patch104p @bugfix commy2 09/10/2021 Fix door not closing in time when building Technicals or Combat Bikes with power.

Behavior = ProductionUpdate ModuleTag_10
NumDoorAnimations = 1
DoorOpeningTime = 2000 ;in mSeconds
DoorWaitOpenTime = 3000 ;in mSeconds
DoorCloseTime = 2000 ;in mSeconds
DoorWaitOpenTime = 2000 ;in mSeconds
DoorCloseTime = 1800 ;in mSeconds
ConstructionCompleteDuration = 1500 ;in mSeconds
End
Behavior = DefaultProductionExitUpdate ModuleTag_11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11056,11 +11056,14 @@ Object Slth_GLAArmsDealer
Behavior = FXListDie ModuleTag_09
DeathFX = FX_StructureMediumDeath
End

; Patch104p @bugfix commy2 09/10/2021 Fix door not closing in time when building Technicals or Combat Bikes with power.

Behavior = ProductionUpdate ModuleTag_10
NumDoorAnimations = 1
DoorOpeningTime = 2000 ;in mSeconds
DoorWaitOpenTime = 3000 ;in mSeconds
DoorCloseTime = 2000 ;in mSeconds
DoorWaitOpenTime = 2000 ;in mSeconds
DoorCloseTime = 1800 ;in mSeconds
ConstructionCompleteDuration = 1500 ;in mSeconds
End
Behavior = DefaultProductionExitUpdate ModuleTag_11
Expand Down