Timetable Improvement Patch

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
ic111
Director
Director
Posts: 608
Joined: 17 Jul 2007 17:56

Timetable Improvement Patch

Post by ic111 » 24 Dec 2012 20:59

Update 20th October 2014
=================================================================================================================
Current version: v20 (attached here)
Windows binary of v15 can be downloaded at http://www.tt-ms.de/forum/showthread.ph ... 4#pid87114
Bugtracker can be found at: https://dev.openttdcoop.org/projects/op ... tip/issues
===> Please report problems either here in this thread, or by opening a ticket.

State of the patch: Feature-complete, played (though not the newest version) with bigger train networks, testers welcome :-)



Especially, at some point someone not being interested in timetables at all (for finding out wether I accidentally broke non-timetable functionality) but playing with this patch being applied, and people who more heavily play with timetabled road vehicles, ships, aircrafts than I do would be good.
=================================================================================================================

Readme describing the individual patches, and the general concepts of the patch, in a quite code-oriented way, but also with some examples.
readme.txt
(19.4 KiB) Downloaded 275 times
=============================================================================================================


Merry Christmas!

After about a year of (occasional) development, I am able to publish
version one of the Timetable Improvement Patch. Note that it aims for
people who like to do detailed timetabling on their maps, e.g. trains
meeting always in the same station at some specified time. If you do
not care about that, then this is not the right patch for you ---
however, it does not want to force the player to use timetabling, so
you should be able to ignore the new features even with the patch
being applied.

This patch in fact is a quite big patch queue, introducing the
following features (for a short overview, see the attached screenshot):

- You can enter routes, consisting of route nodes.
- Vehicle orders can refer to routes. They serve as vias: A vehicle
travels from station A via route Foo to station B.
- Timetables are specified using absolute dates: Each OrderList (aka
timetable) has a (global) start date and a length. Individual
vehicles refer to their timetable using an offset. E.g. vehicle one
drives with offset zero months, vehicle two with offset one month.
Arrivals and departures at individual stations are also specified
using absolute dates, and are a property of the timetable, i.e. the
vehicle offsets work for them either.
- Once a vehicle reaches the end of its orders, the timetable length
will be added to its offset. If all shared timetables leave the
range 0 ... timetable length, the global timetable start date and
the offsets will be adjusted accordingly to keep offsets small.
- Timetable offsets and lengths can be specified in days, months and
years. This way, one can easily specify timetables where vehicles
will always do some action the same day of some month.
E.g. timetable length two months, always meet in station bar the
15th of a month with some other vehicle.
- If no timetable information is entered, then everything is supposed
to work the traditional way, without timetabling.
- The Goto tool works either the traditional way, or using a new GUI
supporting routes. Imagine the previous order is for some station
Foo, then the Goto tool will offer all stations reachable from Foo
via some route in a extra window, no scrolling and clicking on the
main map is necessary.
- Timetabling also works using a extra GUI, which allows to specify
several arrivals or departures in a row, without any window closing
and reopening in between.
- Stations have a station timetable.
- For routes, you can open either a train graph, or a tabular route
timetable.

The overall goal is making timetabling in OpenTTD much more robust
(avoid problems with unwanted timetable shifts, when relative dates
in a timetable are changed), and offering tools for planning and
synchronizing timetables in-game, in my games on unchanged trunk
I always had to use several sheets of paper to keep track of information
like which trains meet where etc.

The key to that goal IMHO is the introduction of routes, as for
displaying the traffic on some railway line in some useful way, I
first need some concept representing it.

This patch is neither actually finished, nor was I (for reasons of
time) able to play a bigger game using it yet. But I hope, that the
most severe bugs, problems of user handling, etc. are already fixed,
i.e. that this patch is ready for playing test games using it.

Major problems and tasks I am aware of:
- Generally, GUI handling is not yet tested in a bigger game. I am
quite sure that the ideas are the right ones for the problems I
want to solve using them, but there might be GUI problems which
one notices once a game grows beyond some size.
- The node and route timetables are not yet finished; in the node
timetable some heuristics for choosing the displayed destination is
still needed, in the route timetable I am not sure wether all of the
more complex cases (like trains overtaking each other) do already
work.
- I added the ability to have route nodes formed by a set of tiles.
However, such an ability is not yet introduced into the Goto
meachanism. At first, I thought about just using them for
timetabling (offer routes intersecting outside stations, plus
updated delay information outside stations), but in fact I believe
that supporting order destinations formed by a set of tiles may be
realistic using that infrastructure. After all, in terms of a
pathfinding algorithm, a station with multiple tracks is also a
collection of possible destination tiles (either enter track A, or
B, or C), and in terms of the algorithm, my hope is that this is
more or less equivalent to supporting a set of arbitrary destination
tiles. This might also be a solution for the common problem of defining
that certain trains must enter certain tracks (but not other ones) of some
particular stations. But I did not yet inspect this further.
- Arrivals and departures are currently forced to be in the interval
timetable start ... timetable start plus length. My feeling
currently is that this restriction may be too severe in terms of
easy user handling, maybe just ignoring that interval, or silently
adjusting arrivals outside that interval by multiples of the
timetable length is a better way to deal with that.
- Updating dialogs like the node and route timetables if some affected
piece of information changes is not really implemented at all
affected places.

The future: In the short term, I have quite little time to even answer
in this thread during the next about two weeks. But also in the longer
term, do not expect too much activity from me concerning this patch.
If there is real interest in this patch, then probably opening a bug
tracker for it is the best choice.

And now: Have fun :-)
Attachments
stip_v20.zip
(164.13 KiB) Downloaded 65 times
Last edited by ic111 on 23 Apr 2017 18:49, edited 13 times in total.

User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2365
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: Timetable Improvement Patch

Post by Lord Aro » 25 Dec 2012 00:24

I've never really liked the default timetables, so this may push me to use them a bit more

And that's some strange formatting you have there :L

Merry Christmas!
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra

ic111
Director
Director
Posts: 608
Joined: 17 Jul 2007 17:56

Re: Timetable Improvement Patch

Post by ic111 » 25 Dec 2012 15:43

Concerning layout, I typed it in an external text editor to avoid the danger of loosing it if I do something wrong :-)

Also, I just noticed that the two new settings in the Vehicles settings tree also suffered from that problem: http://www.tt-forums.net/viewtopic.php? ... 0#p1058434
(those settings control to what degree the player is offered the new GUI dialogs by default).

I added a version two, see above in the updated first message.

Furthermore, maybe I should have pointed it out better: The route management dialogs are accessible from the menu where also the minimap is located.

Eddi
Tycoon
Tycoon
Posts: 7412
Joined: 17 Jan 2007 00:14

Re: Timetable Improvement Patch

Post by Eddi » 25 Dec 2012 17:33

maybe it makes more sense from the train/truck/whatever menu? (from the "manage list" dropdown, where autoreplace etc. is)

it would be easier to separate the routes for different vehicle types (it would be unlikely that trucks and ships would share timetables)
You might not exactly be interested in Ferion, but if you are, have fun :)

ic111
Director
Director
Posts: 608
Joined: 17 Jul 2007 17:56

Re: Timetable Improvement Patch

Post by ic111 » 25 Dec 2012 18:03

Do you mean as a second top level entry for each of the train / road / ship /aircraft menus? Or as a new button etc. in the train / road / ship / aircraft list?

If the latter, it would come at the cost of a more difficult access to the route management dialog, so I would probably prefer the first solution.

You are right with the observation that trucks and ships etc. probably won´t share routes. So, obviously this can be done (although I probably wouldn´t regard it first priority), technically it would just mean adding a type attribute to the Route data structure and filtering accordingly.

Regarding bug tracker for such a project, is http://dev.openttdcoop.org/ and there the link "Please, create a ticket for a new project here." the right place to look at?

Eddi
Tycoon
Tycoon
Posts: 7412
Joined: 17 Jan 2007 00:14

Re: Timetable Improvement Patch

Post by Eddi » 25 Dec 2012 18:08

i mean in the train list window, on the lower end the "manage list" dropdown. maybe it's not the best place, but it certainly is more logical than the map menu... (imho)

on the other hand, maybe this and the autoreplace window should go into a more easily accessible spot anyway, so maybe the train/whatever menus could have sub-entries:
  • your trains
  • routes
  • autoreplace [all-vehicles group]
  • other companies' trains
You might not exactly be interested in Ferion, but if you are, have fun :)

ic111
Director
Director
Posts: 608
Joined: 17 Jul 2007 17:56

Re: Timetable Improvement Patch

Post by ic111 » 25 Dec 2012 18:32

Yes, this might indeed be a good idea, as those menus all have just one subentry at present.

Also, known problems I found while playing a bit:

There seems to be an off-by-one-line error when setting arrivals/departures in some, but not all, circumstances. (you click "Change Arrival for station B", and it opens the dialog for station A). Workaround: Set data for station A to the identical data, and use Choose and Next.

I will have to think about what to do if a player alters (parts of) routes that are in use by some timetables, probably some cases are not yet handled properly.

ic111
Director
Director
Posts: 608
Joined: 17 Jul 2007 17:56

Re: Timetable Improvement Patch

Post by ic111 » 25 Dec 2012 18:54

... and in the meantime, I am quite sure that I´ll have to relax checking Arrival / Departure dates in some way. At present, it in fact forces you to start the timetable with the first station of the OrderList, and this is not senseful.

User avatar
Lordmwa
President
President
Posts: 896
Joined: 20 May 2006 19:30
Location: West Sussex, England

Re: Timetable Improvement Patch

Post by Lordmwa » 27 Dec 2012 13:47

If anyone has created a win32 binary based on beta 1.3 would they be willing to post it to allow easier testing? :)
The TT forums trivia tournament! Come along and join in the fun
http://www.funtrivia.com/private/main.cfm?tid=90722

User avatar
jvassie
Tycoon
Tycoon
Posts: 3420
Joined: 18 Dec 2002 18:00
Location: High Wycombe, England
Contact:

Re: Timetable Improvement Patch

Post by jvassie » 31 Dec 2012 11:46

Forgive me if this is answered already, but I didn't see it when I glanced through - does this patch offer or can it integrate with another patch which allows timetabling based on a 24 hour clock (hh:mm)?
(British) Modular Stations Set - Thread: | Website:
Swiss Set - Thread: | Website:
Route Map Creator
Image

AndiK
Engineer
Engineer
Posts: 53
Joined: 07 Dec 2004 18:34
Location: Grafing bei München (Munich)
Contact:

Re: Timetable Improvement Patch

Post by AndiK » 01 Jan 2013 21:16

I'm playing around with your patch(set) right now.

While I managed to get a simple test tram line with 4 stations and 2 trains working, I'm wondering about a few things:
1. Is there any way to get the Autofill working? The button always snaps out again right away.
2. Why do I have to specify start date, offset and especially a duration before I can even start setting up times? I understand that it's impossible to specify absolute times without an origin to refer to. But right now, creating a timetable seems to involve a lot more hassle than really needed.

In addition to this, I'd love to have some way to (semi-)automatically set up offsets to spread my vehicles over the timetable. (Analogous to the various timetable separation patches out there)

Anyway, I see a lot of potential in your work and would love to see it refined. :]

... and now back to finding some workflow to tackle this thing. ^_^

Edit:
Proposed feature for order assembly: A button "Add whole route" with a "return trip" option. Should save a few clicks...

User avatar
Wowanxm
Engineer
Engineer
Posts: 28
Joined: 09 Jul 2010 18:07
Location: Minsk, Belarus
Contact:

Re: Timetable Improvement Patch

Post by Wowanxm » 03 Jan 2013 15:31

jvassie wrote:can it integrate with another patch which allows timetabling based on a 24 hour clock (hh:mm)?
I'd like to ask the same question. :) Realistic timetable based on days (instead of time) looks rather odd.

ic111
Director
Director
Posts: 608
Joined: 17 Jul 2007 17:56

Re: Timetable Improvement Patch

Post by ic111 » 11 Jan 2013 23:22

Autofill: Just not implemented yet.

Timetables based on time: The problem IMHO is that time in OpenTTD is a concept of days, not of hours and minutes. At the bottom of the screen, you see "now is January 12th", not "now is 0:12 a.m.". Thus: One could think about using hours and minutes throughout the timetabling dialogs, but how would you connect that information with the concept of date shown elsewhere in the game? I mean, IMHO it is an absolute must that you can easily compare the time as given in the timetabling dialogs with the global OpenTTD time. E.g. the timetable says "leave station at January 17th",one has a look at the global date "ah, it´s January 7th", so "ok, vehicle will leave in 10 days". Thus, unless one changes the global concept of time (at least in a graphically sense) I think displaying time in days and months is senseful.

But, now a question from me: I have heard some time ago that for projects like this one having a bugtracker at http://dev.openttdcoop.org/ is possible. Is this correct? I assume that it is the link "Please, create a ticket for a new project here." on that page. However, if I click it I am asked for username/password (I assume that it means the one I use e.g. for this forum), and a OpenID URL. What is the latter? Can anyone help?

Eddi
Tycoon
Tycoon
Posts: 7412
Joined: 17 Jan 2007 00:14

Re: Timetable Improvement Patch

Post by Eddi » 12 Jan 2013 00:49

no, the username/password is separate to the forum or to the openttd (bugtracker/translator/...) login.

"OpenID" is something for lazy people who can't remember passwords, you don't have to use it... ;)
You might not exactly be interested in Ferion, but if you are, have fun :)

User avatar
ChillCore
Tycoon
Tycoon
Posts: 2656
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

Re: Timetable Improvement Patch

Post by ChillCore » 12 Jan 2013 01:01

The account that you would use at the openttdcoop devzone would be seperate from the one you have here.
I can not redirect you to the correct page to create an account there because of being on the wrong computer.

Also, you can not just create a new project IIRC, at least not before you managed another one or something like that.
Maybe send a pm to planetmaker or Ammler for more, more accurate, details?
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.

MacaCZ
Engineer
Engineer
Posts: 3
Joined: 15 Jan 2013 21:42

Re: Timetable Improvement Patch

Post by MacaCZ » 15 Jan 2013 21:59

It looks good, but I have problem with patching:

Code: Select all

martin@martin-laptop:~/openttd$ patch -p1 -i /home/martin/patches/600_RouteTimetableData.patch
patching file src/timetable.h
Hunk #1 FAILED at 13.
Hunk #2 FAILED at 29.
2 out of 2 hunks FAILED -- saving rejects to file src/timetable.h.rej
patching file src/timetable_cmd.cpp
Hunk #1 FAILED at 15.
Hunk #2 succeeded at 218 with fuzz 2 (offset 196 lines).
Hunk #3 FAILED at 660.
2 out of 3 hunks FAILED -- saving rejects to file src/timetable_cmd.cpp.rej
OS: Ubuntu
Any idea?

User avatar
ChillCore
Tycoon
Tycoon
Posts: 2656
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

Re: Timetable Improvement Patch

Post by ChillCore » 16 Jan 2013 07:38

Hello MacaCZ,

You most likely patched a different revision than the patch was intended for.
You can try to fix the rejects yourself (as in manually) but as this patch series is rather big, I suggest patching r24853 instead, which was the last revision made the day the first post was last modified, and see if that goes any better. ;)
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.

MacaCZ
Engineer
Engineer
Posts: 3
Joined: 15 Jan 2013 21:42

Re: Timetable Improvement Patch

Post by MacaCZ » 16 Jan 2013 08:38

Hello,
I update source to r24853, but the new problem is there :D :

Code: Select all

martin@martin-laptop:~/openttd$ patch -p1 -i /home/martin/patches/265_UpdateRouteNodesInOrders.patch 
patching file src/route_cmd.cpp
Hunk #1 FAILED at 329.
Hunk #2 succeeded at 401 (offset 6 lines).
Hunk #3 succeeded at 463 (offset 8 lines).
1 out of 3 hunks FAILED -- saving rejects to file src/route_cmd.cpp.rej
?(

And one question: Is it possible to put all patches in one-file patch?

User avatar
ChillCore
Tycoon
Tycoon
Posts: 2656
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

Re: Timetable Improvement Patch

Post by ChillCore » 16 Jan 2013 11:09

As I wanted to give this patch a test myself one of these days ...

I can patch r24853 without conflicts and only have a few compiler warnings:

Code: Select all

[SRC] Compiling route_cmd.cpp
~/route_cmd.cpp: In functie ‘CommandCost CmdAddNodeToRoute(TileIndex, DoCommandFlag, uint32, uint32, const char*)’:
~/route_cmd.cpp:388:3: let op: format ‘%i’ expects argument of type ‘int’, but argument 4 has type ‘std::vector<RouteNode*>::size_type {aka long unsigned int}’ [-Wformat]
~/route_cmd.cpp: In functie ‘CommandCost CmdRemoveNodeFromRoute(TileIndex, DoCommandFlag, uint32, uint32, const char*)’:
~/route_cmd.cpp:435:3: let op: format ‘%i’ expects argument of type ‘int’, but argument 4 has type ‘std::vector<RouteNode*>::size_type {aka long unsigned int}’ [-Wformat]

[SRC] Compiling timetable_gui.cpp
~/timetable_gui.cpp: In static member function ‘static const char* TimetableWindow::GetTimetableLineString(char*, const char*, const Order*, VehicleOrderID, const Vehicle*)’:
~/timetable_gui.cpp:717:12: let op: variable ‘timetable_length’ set but not used [-Wunused-but-set-variable]

[SRC] Compiling traingraph_gui.cpp
~/traingraph_gui.cpp: In functie ‘bool InsertIntervalIfPossible(BlockedIntervals*, int, int, bool)’:
~/traingraph_gui.cpp:78:2: let op: format ‘%i’ expects argument of type ‘int’, but argument 3 has type ‘std::vector<int>::size_type {aka long unsigned int}’ [-Wformat]
~/traingraph_gui.cpp: In memberfunctie ‘bool NodeLine::InsertIntervalIntoLine(int, int, int, bool)’:
~/traingraph_gui.cpp:185:3: let op: format ‘%i’ expects argument of type ‘int’, but argument 7 has type ‘std::map<int, std::vector<int>*>::size_type {aka long unsigned int}’ [-Wformat]
Attached is a complete version of the patch, anything other than compiling and starting the game I have not yet tested.
Hope this works better you.

EDIT:
Removed the patch for now ... seems like something went wrong when I created it and instead it was a patch for removing the patch. :P
EDIT2:
Ah ... "-rtip:19897" != "-r19897:tip" (the latter being the correct thing to do). Added the complete version of the patch.
A version that adds code this time. :roll:
Attachments
TIP_v2_r24853.diff
Note: patch might be against a different revision as intended by ic111.
HG patch apply with -p1
(742.13 KiB) Downloaded 193 times
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.

MacaCZ
Engineer
Engineer
Posts: 3
Joined: 15 Jan 2013 21:42

Re: Timetable Improvement Patch

Post by MacaCZ » 16 Jan 2013 12:39

Now it works! Thank you :bow:

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Google [Bot] and 4 guests