Skip to content

Few improvements to ChooChoo#1

Draft
SamuXarick wants to merge 1 commit into
mkonstapel:masterfrom
SamuXarick:choochoochanges
Draft

Few improvements to ChooChoo#1
SamuXarick wants to merge 1 commit into
mkonstapel:masterfrom
SamuXarick:choochoochanges

Conversation

@SamuXarick

Copy link
Copy Markdown
  • Improve the flow of trains on junctions if ever so slightly.
  • Use One Way PBS near stations just in case some train tries to reverse.
  • Build network tracks faster by using BuildTrack.FAST opposed to BuildTrack.FOLLOW which can be very slow at times.
  • Use AIPriorityQueue from OpenTTD C++ instead of BinaryQueue from Squirrel VM to increase pathfinding speed.
  • Busses transfer passengers to train stations and full load them from town. This improves profits in the long run.
  • Trains always enter depots, not just when they require service. This may help reduce train jams slightly, but not entirely.
  • Only cull trains, not busses, due to the use of transfer orders which might have busses with negative profits until a train route is in place.
  • Fix culling counting of vehicles.
  • Fix train distance calculation.

- Improve the flow of trains on junctions if ever so slightly.
- Use One Way PBS near stations just in case some train tries to reverse.
- Build network tracks faster by using BuildTrack.FAST opposed to BuildTrack.FOLLOW which can be very slow at times.
- Use AIPriorityQueue from OpenTTD C++ instead of BinaryQueue from Squirrel VM to increase pathfinding speed.
- Busses transfer passengers to train stations and full load them from town. This improves profits in the long run.
- Trains always enter depots, not just when they require service. This may help reduce train jams slightly, but not entirely.
- Only cull trains, not busses, due to the use of transfer orders which might have busses with negative profits until a train route is in place.
- Fix culling counting of vehicles.
- Fix train distance calculation.
@mkonstapel

Copy link
Copy Markdown
Owner

Use AIPriorityQueue from OpenTTD C++ instead of BinaryQueue from Squirrel VM to increase pathfinding speed.

I I just implemented the same thing :) And a few other pathfinder performance improvements.

I'll definitely take your fixes, but ChooChoo's focus is on building nice networks, not being maximally competitive, so aesthetics come first, performance second. If that means slower pathfinding, so be it :)

Comment thread builder_network.nut
RemoveRail([0,1], [1,1], [2,3]);
RemoveRail([0,2], [1,2], [2,0]);
RemoveRail([1,3], [1,2], [3,1]);
RemoveRail([3,2], [2,2], [1,0]);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

These definitely improve the flow, but they look a little too messy so that's why I took these bits out.

Comment thread builder_network.nut
local first = BuildTrack(this,
toCrossing.GetExit(toDirection), fromCrossing.GetEntrance(fromDirection),
reserved, SignalMode.FORWARD, network);
reserved, SignalMode.FORWARD, network, BuildTrack.FAST);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Nope, nice looking (double) track is more important :)

Maybe ChooChoo could have a "competitive" setting where it foregoes aesthetics in favor of performance, but that's not really its deal.

Comment thread builder_stations.nut
BuildSignal([0, p+1], [0, p+2], AIRail.SIGNALTYPE_PBS);
BuildSignal([1, p+1], [1, p], AIRail.SIGNALTYPE_PBS);
BuildSignal([0, p+1], [0, p+2], AIRail.SIGNALTYPE_PBS_ONEWAY);
BuildSignal([1, p+1], [1, p], AIRail.SIGNALTYPE_PBS_ONEWAY);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I don't think trains should ever go the wrong way, because the tracks have one-way block signals, but it doesn't hurt and I like the look 👍

Comment thread builder_stations.nut
AIOrder.AppendOrder(bus, trainStationTile, AIOrder.AIOF_NONE);
AIOrder.AppendOrder(bus, busStationTile, AIOrder.AIOF_NONE);
AIOrder.AppendOrder(bus, depot, AIOrder.AIOF_NONE);
AIOrder.AppendOrder(bus, trainStationTile, AIOrder.AIOF_TRANSFER | AIOrder.OF_NON_STOP_INTERMEDIATE | AIOrder.OF_NO_LOAD);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I did think of using TRANSFER orders, but just dropping them off does help station ratings so it's a tricky tradeoff.

Comment thread builder_stations.nut
AIOrder.AppendOrder(bus, busStationTile, AIOrder.AIOF_NONE);
AIOrder.AppendOrder(bus, depot, AIOrder.AIOF_NONE);
AIOrder.AppendOrder(bus, trainStationTile, AIOrder.AIOF_TRANSFER | AIOrder.OF_NON_STOP_INTERMEDIATE | AIOrder.OF_NO_LOAD);
AIOrder.AppendOrder(bus, busStationTile, AIOrder.OF_FULL_LOAD_ANY | AIOrder.OF_NON_STOP_INTERMEDIATE);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The busses are mostly "for looks" so I think I'd rather just have them go back and forth without waiting for a full load.

Comment thread builder_road.nut

function FindPath(a, b) {
local pathfinder = Road();
pathfinder._pathfinder._queue_class = AIPriorityQueue;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Nice one! I just happened to find out about that yesterday, but I still had it wrapped in a Squirrel class, this is even cleaner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants