CitiesSkylinesMods / TMPE

Cities: Skylines Traffic Manager: President Edition
https://steamcommunity.com/sharedfiles/filedetails/?id=1637663252
MIT License
574 stars 85 forks source link

Basic support for Airports DLC #1458

Open krzychu124 opened 2 years ago

krzychu124 commented 2 years ago

Support for Airports DLC and Aircrafts/Taxiways in general

Update (19/Mar/2022)

Done

In progress

Planned

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:

https://user-images.githubusercontent.com/19638970/165813039-ee8c7899-3938-4c4b-8c28-c7f49778a2db.mp4

Closes #1354

Build zip

originalfoo commented 2 years ago

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:

krzychu124 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

Looks like it works X D

image

originalfoo commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

krzychu124 commented 2 years ago

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

krzychu124 commented 2 years ago

Work in progress

https://user-images.githubusercontent.com/19638970/159134105-a28384d9-3ced-4d30-aa72-9bb20f98e8a5.mp4

krzychu124 commented 2 years ago

@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 commented 2 years ago

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

originalfoo commented 2 years ago

Putting some possible icons for cargo aircraft:

Scissor lifts:

Fork lift trucks:

Elesbaan70 commented 2 years ago

@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 commented 2 years ago

Yeah, will do later today 😉

Elesbaan70 commented 2 years ago

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 commented 2 years ago

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.

t1a2l commented 1 year ago

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