Tmpe: Why ShipAI alone does not have skipQueue

Created on 14 Jun 2020  路  7Comments  路  Source: CitiesSkylinesMods/TMPE

@krzychu124 did you forgot to add skipQueue to ShipAI?
If so we should delete this line:
```c#
//CreatePathPatch.cs
if (ai is ShipAI) args.skipQueue = false; // TODO [issue #952] why ShipAI should be different than others?

```
If not we should add a comment there explaining why.

BUG Harmony PATHFINDER triage

All 7 comments

Just in case you don't know: all code changed before Jan 2019 is not mine. It's pointless to ask me about it, because most of the times I would have to respond: don't know.

It's easy to figure out why it's false here (same as vanilla). Path recalculation due to segment change is not the problem here because ships follow invisible line dedicated for ships == no despawn risk.

Ships do need to wait in a queue some times to get to the dock if there is too many..
Then what about Airplanes? They also are like ships.

Actually we have not customized aircraft AI.
So why have we customized ShipAI but not aircraftAI?

Wait... skipQueue was not changed (for other types) to speed up searching for path, but for fixing problem with despawning, because every time you touch segment or node (changing restriction and other things) segment is invalidated, so without skipQueue, those vehicles (driving through invalidated segments) could despawn before they get corrected path again. In vanilla there are not such problems because invalidation occurs only when you remove or add segment/node (despawn is not surprise).

We don't have any restrictions for aircraft or ship lines, so I don't think we need to change anything there

I see. But why ShipAI has customization but AircraftAI does not?

Maybe it would help to group things in to "meta" network categories, and then seek consistency within each meta category?

  • Dynamic: No fixed network (eg. helicopters)
  • Flexible: Easy to reroute (eg. cars, cims)
  • Limited: Difficult to reroute, but feasible (eg. ships, aircraft)
  • Rigid: Not logical/possible to reroute (eg. track-bound vehicles)

The frequency at which users alter networks is influenced by those same factors, which determines the importance of repathing already-spawned vehicles.

I assume failing to repath a vehicle leads to despawning. So on things like ship and plane routes it could be problematic if we try repath too soon?

@aubergine10 see also #954.

Limited: Difficult to reroute, but feasible (eg. ships, aircraft)

I think aircraft is like a helicopter. They are dynamic, aren't they?

EDIT:
I can provide shared methods to be called by prefixes:
StartPathFindRigid
StartPathFindFlexible
...

Aircraft is half-dynamic I think. Specifically, maps with air connections have routes drawn on them (the yellow routes if you have More Network Stuff mod and open Aircraft transport tab). However, the link between the yellow routes and the actual airport is dynamic.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TroublesomeCorvid picture TroublesomeCorvid  路  5Comments

aditya-murda picture aditya-murda  路  6Comments

aubergine10 picture aubergine10  路  3Comments

kianzarrin picture kianzarrin  路  3Comments

blackeva8 picture blackeva8  路  5Comments