Navigation Menu

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

Suggestion: Allow AI/GS to fully timetable vehicles. #7923

Closed
James103 opened this issue Jan 10, 2020 · 1 comment
Closed

Suggestion: Allow AI/GS to fully timetable vehicles. #7923

James103 opened this issue Jan 10, 2020 · 1 comment

Comments

@James103
Copy link
Contributor

James103 commented Jan 10, 2020

Version of OpenTTD

Last tested: 2020-01-08 master

Expected result

AIs and Game Scripts can use the following new class (that I have proposed) to timetable their vehicles (ScriptTimetable). If needed, the final implementation could be merged into the ScriptOrder class instead. The proposed implementation is subject to change, but it is suggested that the same functionality is retained.

  • ScriptTimetable::ChangeWaitTime(vehicle_id, order_position, time)
    Sets the wait time of an order. Acts as if you pressed the "Change Time" button with the order highlighted and entered the value (in ticks) passed into time. Set null to instead act as if you pressed the "Clear Time" button.
  • ScriptTimetable::ChangeTravelTime(vehicle_id, order_position, time)
    Sets the travel time of an order. Acts as if you pressed the "Change Time" button with the "Travel for X days/ticks" highlighted and entered the value (in ticks) passed into time. Set null to instead act as if you pressed the "Clear Time" button.
  • ScriptTimetable::ChangeSpeedLimit(vehicle_id, order_position, speed_limit)
    Sets the speed limit of an order. Acts as if you pressed the "Change Speed Limit" button with the "Travel for X days/ticks" highlighted and entered the value (in internal units) passed into speed_limit. Set null to instead act as if you pressed the "Clear Speed Limit" button.
  • ScriptTimetable::SetStartDate(vehicle_id, start_date, distribute)
    Sets the starting date of the timetable. Acts as if you pressed the "Start date" button and set the date passed into start_date. If the distribute flag is set, acts as if you also held CTRL.
  • ScriptTimetable::ResetLateCounter(vehicle_id)
    Resets the late counter of a vehicle. Acts as if you pressed the "Reset Late Counter" button.
  • ScriptTimetable::Autofill(vehicle_id, non_destructive)
    Acts as if you pressed the "Autofill" button. If the non_destructive flag is set, acts as if you also held CTRL.
  • ScriptTimetable::GetWaitTime(vehicle_id, order_position)
    ScriptTimetable::GetTravelTime(vehicle_id, order_position)
    ScriptTimetable::GetSpeedLimit(vehicle_id, order_position)
    Gets the wait time, travel time, or speed limit of an order. Times are returned in ticks, while the speed limit is returned in OpenTTD's internal speed unit (mph/1.6).
  • ScriptTimetable::GetTimetableDelay(vehicle_id)
    Gets how far behind or ahead the vehicle is from schedule. Negative values are late, positive values are behind. Zero means vehicle is on time, and an invalid value means the vehicle's lateness has not been graded yet.

Actual result

There is no such class built-in. AIs and Game Scripts can not timetable their vehicles in any built-in way.

Reasoning

I would like if AI/GS could fully timetable vehicles in the same way that a human player already can. This would allow for AI/GS to create 'realistic' services that don't end-up bunching up and instead are spaced out for optimal service (and therefore station rating).

@James103
Copy link
Contributor Author

James103 commented Sep 7, 2022

Closing as this is unlikely to happen anytime soon.

@James103 James103 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 7, 2022
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

No branches or pull requests

1 participant