Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
rtri
committed
Feb 10, 2016
1 parent
eb5b2b6
commit 788c804
Showing
7 changed files
with
20 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
788c804
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.
strafeAir have a different brakingdistance since they also have drag:
https://github.com/spring/spring/blob/develop/rts/Sim/MoveTypes/StrafeAirMoveType.cpp#L1245
788c804
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 suppose the
BrakingDistance
function could be virtual and overriden by SAMT, butlandRadiusSq
: https://github.com/spring/spring/blob/develop/rts/Sim/MoveTypes/StrafeAirMoveType.cpp#L94788c804
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.
oh, forgot that!
cool then
788c804
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.
This fixes #5079 and #5080, but the solution is not optimal for fighter type planes (I guess that's SAMT), because now the Activated and StartMoving callins are not separated enough.
Before, for SAMT, the startmoving event was called when the plane is leaving ground, usually vertically, and the activated event was called when the horizontal movement begins. Many games use the activated callin to enable missiles, because otherwise SAMT can shoot when also on the ground or when just moving slightly (like when displaced because of shockwave), but the activated event makes them need a little bit of altitude before they can do that. Also used for radar or sonars to become operational with a slight delay I think.
It would be better if at least for SAMT, the activated event would still happen in Flying.
788c804
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.
Activate could be called twice (once on takeoff, once when entering the flying state) so scripts would be able to decide based on altitude, but I really prefer clean code. If you need it, a workaround is to make Activate spawn a thread that sleeps for a second or two (or whatever the expected climb-time is) and then enables weapons.
788c804
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.
https://github.com/spring/spring/blob/develop/rts/Sim/Units/Unit.cpp#L2320
activate won't be called twice without interfering with even more stuff
since we're in a feature freeze, I'd much prefer to keep it to the previous state, where activate happens on flying and deactivate on landing
788c804
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.
"could be" meaning theoretically, and activate-on-takeoff is not a feature.
I'll go along with SAMT activate on flying/deactivate after landing, but only for 101.
788c804
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.
why if I may ask?
788c804
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.
The workaround would create a mismatch between activate sound event and unit animation, and if activate is called twice, it would play the sound twice.
788c804
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.
because event handling should be symmetric: more predictable behavior, less chance of state conflicts. events that are each other's logical inverse (activate/deactivate) should also be coupled to logically inverse states.
no.
the engine would take care of that, but it ain't happening anyway.
788c804
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.
"events that are each other's logical inverse (activate/deactivate) should also be coupled to logically inverse states."
not to logically inverse states, but to logically inverse changes:
currently activate happens on 2 and deactivate happens on 3
you changed it so activate happens on 1 and deactivate happens on 4
788c804
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.
hmm, a better way to put it since some state changes are bidirectional:
Before:
After:
788c804
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.
yeah, I was about to say that 2 isn't the only transition where activate happens, and 3 isn't the only transition where deactivate happens.
788c804
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.
my point is that both decisions are logical
788c804
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.
not quite because one allows more state conflicts than the other.
788c804
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.
how?
788c804
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.
see your own "landing on a moving carrier" example.
788c804
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.
Yes, but one can also use StartMoving() and StopMoving() to get info about the landed state, minus some minor exceptions such as movement due to shockwaves. #5080 can also be worked around with a widget issuing fly state to units who are guarding, although that's probably not desirable in games with limited fuel.
Why not just check if unit has commands before calling Deactivate?
788c804
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.
@springjools that's (more or less) how it's fixed in the latest commit