-
Notifications
You must be signed in to change notification settings - Fork 89
tweak(behavior): Make aircraft takeoff order deterministic #1297
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
tweak(behavior): Make aircraft takeoff order deterministic #1297
Conversation
GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp
Outdated
Show resolved
Hide resolved
@xezon I made a small adjustment to the code to make it a bit more flexible. Airfields with equal counts of spaces and runways are excluded. Index checks are now tied to the runway count so that it can now handle this 3 runway / 6 space airfield: https://www.moddb.com/mods/operation-firestorm/images/usa-airforce-generals-airfield If there are airfields with say 2 runways and more than 4 spaces (i.e. more than double the runway count), the fix in this PR will not work 100%. I'm not sure how to fix that yet or if such airfields even exist. |
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 tested this and it works in principle but there is one bug.
A bit of documentation for the new logic would be good.
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp
Outdated
Show resolved
Hide resolved
…l009/GeneralsGameCode into fix_airfield_takeoff_order
I can replicate this in Generals if there are no other issues. |
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.
Logically makes sense. If it works without bugs, then it is good to go.
Should be good to go. |
I figured it'd be good to provide some visual aid. This is the layout of the USA airfield: // TheSuperHackers @tweak Block the first attempt to reserve a runway for 'upper' space indices.
// This allows 'lower' space indices to reserve a runway first to ensure deterministic takeoff ordering.
if (m_spaces.size() > m_runways.size() && spaceIndex >= m_runways.size()) Block the first attempt from S2 and S3 to reserve a runway, so that S0 and S1 can always go first. |
The order in which aircraft take off from airfields is non-deterministic, which can cause delays between pairs of aircraft taking off. This PR defers an airfield runway reservation request once, if that request came from a 'lower priority' space.
TODO