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

Basic support for Airports DLC #1458

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from
Draft

Conversation

krzychu124
Copy link
Member

@krzychu124 krzychu124 commented Mar 5, 2022

Support for Airports DLC and Aircrafts/Taxiways in general

  • vehicle restrictions (passenger plane/ cargo plane)
  • lane connector (might be disabled after feedback - taxiways have only one vehicle lane)
  • priority signs (work-in-progress),
  • speed limits

Update (19/Mar/2022)

  • slightly improved lane reservation,
  • increased wait time for planes (they react slower than other vehicles),
  • improved priority detection for planes,
  • fixed a bug with speed limit at runway (not final solution)
  • cargo truck paths recalculation if cargo plane changed target airplane stand

Done

  • trigger for cargo airplane stand recalculation
  • BFS search algorithm - better Airplane stand finder
  • landing behavior improvements
  • support for Passenger Plane vehicle size restrictions (small/medium/large)

In progress

  • Passenger Plane vehicle size restriction saving
  • Passenger Plane vehicle size - Asset Editor extension for vehicles and taxiways

Planned

  • take-off behavior improvements

I'm thinking about how to implement size restrictions for taxiways/runways(?) (I've got working UI in-progress but I'm not sure how to handle it properly yet)

Dynamic cargo airplane stand selection:

2022-04-28.19-29-53.mp4

Closes #1354

Build zip

@krzychu124 krzychu124 added feature A new distinct feature LANE ROUTING Feature: Lane arrows / connectors DESPAWN TOOLS Feature: Clear traffic, toggle despawn, vehicle/parked/cim despawns SPEED LIMITS Feature: Speed limits VEHICLE RESTRICTIONS Feature: Vehicle restrictions PRIORITY SIGNS Feature: Stop / Yield / Priority signs PATHFINDER Pathfinding tweaks or issues Harmony Vehicle Behavior Vehicle behavior related issue labels Mar 5, 2022
@krzychu124 krzychu124 self-assigned this Mar 5, 2022
added patch for priority check,
traffic monitoring and vehicle position update(segment registering)
@originalfoo
Copy link
Member

originalfoo commented Mar 5, 2022

Currently runways/taxiways are essentially one-way train tracks, but for planes; if bidirectional taxiways/runways become a thing then lane connectors would be more useful. We'd need something like one-way train AI, but for planes.

For me "vehicle" restrictions are far, far more useful:

  • aircraft size (tiny, small, medium, large)
    • tiny = air tours EDIT: aviation club (sunset harbour) if there's some way to integrate those with airports
    • not sure what happens for pre-Airpots DLC aircraft vehicles
  • aircraft type (cargo, passenger)
    • already done in this PR
  • takeoff (heading to runway) vs. landing (heading to stand)
    • do vehicle flags give any indication of whether plane is heading to stand vs. runway?

@krzychu124
Copy link
Member Author

if bidirectional taxiways/runways become a thing then lane connectors would be more useful. We'd need something like one-way train AI, but for planes.

I'm working on it but from what I tested STTAI (modified for taxiways) works only for super simple setups fails completely on slight more advanced ones mostly by causing deadlocks. It requires some sort of signaling process that could manage which vehicle can move and where should stop and wait. Obviously everything is doable, just need a good description what/when - decision tree.

tiny = air tours (sunset harbour) if there's some way to integrate those with airports

Theoretically yes, but I haven't experimented with that. The biggest problem will me ItemClass that defines which aircraft stand vehicle can use.

not sure what happens for pre-Airpots DLC aircraft vehicles

If they are all set as sunset harbor tour vehicles then see above, otherwise, the same as vanilla airplanes they use ItemClass "Medium aircraft"

takeoff (heading to runway) vs. landing (heading to stand)

  • do vehicle flags give any indication of whether plane is heading to stand vs. runway?

No, what would be the use case?

aircraft size (tiny, small, medium, large)

I plan to add AssetEditor support for more configurable properties (I already listed on trello what is possible to tweak) so the Asset creator could use vanilla ItemClass for vanilla compatible vehicle but with additional UI to alter it and configure more settings. I'm thinking about creating Project to organize things before starting implementation.

@originalfoo
Copy link
Member

originalfoo commented Mar 5, 2022

No, what would be the use case?

I sometimes have planes taking v. strange routes as illustrated in image below:

image

About 80% of time (green line), planes from the large/small stands (top-right of image) go towards the medium stands (top-left of image) on their way to the runway (bottom-left of image) when they should avoid that area completely and use the shorter and more direct route (blue line) which bypasses the medium stands.

The point where the taxiway splits (one branch going to runway, the other to medium stands) would have restrictions so the shorter segment is for "takeoff only" and the longer segment (to medium stands) is for "landing only".

@krzychu124
Copy link
Member Author

About 80% of time (green line), planes from the large/small stands (top-right of image) go towards the medium stands (top-left of image) on their way to the runway (bottom-left of image) when they should avoid that area completely and use the shorter and more direct route (blue line) which bypasses the medium stands.

Hmm, if you notice that only on this build it might be caused by AdvancedAI (it's enabled for aircrafts, I'm still experimenting with DLS) and segment penalties (congestion/traffic usage)

@krzychu124
Copy link
Member Author

tiny = air tours (sunset harbour) if there's some way to integrate those with airports

@aubergine10 ok, I can clone vehicle and swap AI to PassengerPlaneAI on load... but I'm pretty sure that not all SH tour vehicles are tiny

@originalfoo
Copy link
Member

originalfoo commented Mar 5, 2022

tiny = air tours (sunset harbour) if there's some way to integrate those with airports

@aubergine10 ok, I can clone vehicle and swap AI to PassengerPlaneAI on load... but I'm pretty sure that not all SH tour vehicles are tiny

Sorry, typo, by tiny I meant aviation club which IIRC are all small?

I think air tours is more relating to hot air balloons or something like that?

@krzychu124
Copy link
Member Author

Looks like it works X D

image

…nto feature/airports-DLC-support

� Conflicts:
�	TLM/TLM/Util/Extensions/VehicleExtensions.cs
@originalfoo
Copy link
Member

Hmm, if you notice that only on this build it might be caused by AdvancedAI (it's enabled for aircrafts, I'm still experimenting with DLS) and segment penalties (congestion/traffic usage)

It happens on master branch - although maybe due to lane randomisation of the pathfinder?

In the example cited, another solution might be the aircraft size restrictions - eg. I could prevent small/large aircraft from using medium stands route. However, that's semantically incorrect and it wouldn't be viable on larger / more complex airports; hence the desire to have landing vs. takeoff (arrivals vs. departures?) restrictions. It's a way to limit a taxiway to "going to stand" or "going to runway" even if that taxiway is a viable route for the alternative.

@krzychu124
Copy link
Member Author

I don't know how to detect where vehicle is going and... pathfinding is a play of adding up penalties. I'm not sure how to "suggest" something when PF is calculating score for each lane till find the one is searching (starting point, since PF runs backwards, from finish to the start)

@krzychu124 krzychu124 added this to the 11.7.0 milestone Mar 13, 2022
@krzychu124
Copy link
Member Author

I don't know how to detect where vehicle is going...

Argh, I need to figure that out to limit number of unnecessary queries for better aircraft stand since now I use blocked counter - there is no reason to check it when airplane is blocked by traffic when tries to leave the airport

@krzychu124
Copy link
Member Author

Updated code, PR description, in-progress tasks will be finished either later today or tomorrow,

…s for cargo airplane stand recalculation, changes to speed calulations on the ground, yield stop position changes
@krzychu124
Copy link
Member Author

@aubergine10 I've added few new features, let me know what you think, how it works etc.

@krzychu124
Copy link
Member Author

Work in progress

2022-03-19.19-33-16.mp4

@krzychu124
Copy link
Member Author

@aubergine10 Question about size restrictions. How they should work?
I think there are two ways for testing the size but I'm not sure which is better (don't see how to mix both):

  1. treat size restriction strict (exactly as set, 1:1). The user disabled medium then only medium size vehicles cannot go there
  2. treat setting as a limit of vehicle load that can handle: The user disabled medium then only small and lower can go there (medium, large cannot)

Second option has more sense from asset creator perspective if we allow setting size restriction per asset in the Asset Editor. On the other hand with 1. you can achieve the same as with the 2. Settings does not apply to cargo vehicles since I can't really tell their size (one option would be to set size margins and automatically set the size depends on model of aircraft) 🤷‍♂️

@originalfoo
Copy link
Member

@krzychu124 I think option 1 is best; at least from my own use case.

For exmaple, I only want medium planes going down a certain taxiway (which leads exclusively to medium stands) and thus want to block both small and large planes on that taxiway. I would not be able to achieve that with option 2.

For asset creators they'd just set whichever restrictions make sense for the size of taxiway/runway, ie. using option 1 to get the effect of option 2.


// aircraft related flags
GoingToOutside = 1 << 2,
GoingFromOutside = 1 << 3,
Copy link
Member

Choose a reason for hiding this comment

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

Would this be better named ComingFromOutside ?

Also, is there any merit to using existing vehicle flags such as Arriving and Leaving? Or Importing and Exporting?

Copy link
Member Author

Choose a reason for hiding this comment

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

Arriving and Leaving are temporary flag, Import, Export are related with outside connection transfer.

Comment on lines 499 to +502
maxNumSigns = RoadVehicleTypes.Length;
} else if (VehicleRestrictionsManager.Instance.IsRailSegment(segmentInfo)) {
maxNumSigns = RailVehicleTypes.Length;
} else if (VehicleRestrictionsManager.Instance.IsPlaneNetInfo(segmentInfo)) {
Copy link
Member

Choose a reason for hiding this comment

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

Inconsistent naming?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not really but I figure out better name

Comment on lines +182 to +184
(connectionClass.m_subService == ItemClass.SubService.PublicTransportMonorail) ||
(connectionClass.m_subService == ItemClass.SubService.PublicTransportPlane)
)))) {
Copy link
Member

Choose a reason for hiding this comment

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

Would this be a lot cleaner and more legible as

connectionClass.m_subservice is
    ItemClass.SubService.PublicTransportTrain or
    ItemClass.SubService.PublicTransportMetro or
    ItemClass.SubService.PublicTransportMonorail or
    ItemClass.SubService.PublicTransportPlane

@Elesbaan70
Copy link
Contributor

@krzychu124 Can you merge the latest master into this branch? It will help me examine your changes, which I want to do as part of making sure my XML Persistence design isn't too specific to traffic lights.

@krzychu124
Copy link
Member Author

Yeah, will do later today 😉

…nto feature/airports-DLC-support

� Conflicts:
�	TLM/TLM/Manager/Impl/LaneConnection/LaneConnectionSubManager.cs
�	TLM/TLM/UI/SubTools/VehicleRestrictionsTool.cs
�	TLM/TLM/UI/Textures/RoadUI.cs
@Elesbaan70
Copy link
Contributor

Have you been operating under the assumption that this change would break savegames? Because that was the impression I got, but I'm not sure it will. You might want to check that, because I believe enums are already stored as raw numbers, and I don't see any new types or fields being added.

@krzychu124
Copy link
Member Author

krzychu124 commented Apr 29, 2022

Have you been operating under the assumption that this change would break savegames? Because that was the impression I got, but I'm not sure it will. You might want to check that, because I believe enums are already stored as raw numbers, and I don't see any new types or fields being added.

@Elesbaan70 TL;DR current PR does not introduce any incompatibility yet.

At least not yet. I didn't push changes adding new things to the TMPE savegame data. Currently it only allows to "add" Passenger/CargoPlane enum to vehicle restrictions. Enum values are already available and it shouldn't break anything if you set lane vehicle restriction value with more enum flags (they will be ignored since in previous version of the mod (e.g. current master) there is no handling of those vehicle types - aircraft in general are completely ignored by TM:PE)

I'll push new changes with regards to passenger airplane size restrictions probably tomorrow once I decide how data should look like because I would like to push final solution once, and not change it all the time (I'm lazy and I don't want to remember which savegame requires which mod version 😄 ) in case if you want to try testing your changes to data persistence 😉

BTW, that's why is still Draft PR - things may change or changes are not complete yet.

@krzychu124 krzychu124 linked an issue Jun 3, 2022 that may be closed by this pull request
@t1a2l
Copy link

t1a2l commented Oct 30, 2022

@krzychu124 long time since april, where does it stands? what needs still to be done?

@krzychu124 krzychu124 modified the milestones: 11.8.0, 11.9.0 May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DESPAWN TOOLS Feature: Clear traffic, toggle despawn, vehicle/parked/cim despawns feature A new distinct feature Harmony LANE ROUTING Feature: Lane arrows / connectors PATHFINDER Pathfinding tweaks or issues PRIORITY SIGNS Feature: Stop / Yield / Priority signs SPEED LIMITS Feature: Speed limits Vehicle Behavior Vehicle behavior related issue VEHICLE RESTRICTIONS Feature: Vehicle restrictions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for Taxiways and Runways (DLC and non DLC) Not all Cargo airport stand is used
4 participants