Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Mon Apr 22, 2019 3:06 pm

All times are UTC




Post new topic  Reply to topic  [ 3079 posts ]  Go to page 1 2 3 4 5154 Next
Author Message
 Post subject: Cargo Distribution
PostPosted: Tue Feb 24, 2009 12:37 am 
Offline
President
President
User avatar

Joined: Sat Oct 13, 2007 8:28 am
Posts: 945
So, this is the (n+1)th attempt to provide passenger and cargo with destinations and then getting them there using the existing transport links as efficiently as possible. This means it includes what others call "load balancing". I have moved the main description of cargodist into the wiki, see http://wiki.openttd.org/Passenger_and_c ... stribution. Here you'll only get some status information on the progress for the different mile stones. Basically cargodist does what I envisioned when I started it and now I'm only tweaking some things to integrate it more nicely with the rest of the game. You can get the code from my github repository at http://github.com/ulfhermann/openttd . The relevant branch is "cd". Have a look at https://github.com/ulfhermann/openttd/commits/cd to see the individual milestones which have been reached. If you don't want to use git you can get a diff between trunk and cd at this URL: https://github.com/ulfhermann/openttd/c ... ...cd.diff . You can always find the current trunk revision the patch is meant to be applied to by looking at the topmost commit at https://github.com/ulfhermann/openttd/commits/master . You can also download a source package from https://github.com/ulfhermann/openttd/archive/cd.zip and directly compile that without patching. It is equivalent to the openttd source package, but has cargodist included.

To check out the release branch, do:

Code:
git clone git://github.com/ulfhermann/openttd.git
git checkout origin/cd


The openttd compile farm creates binaries for various platforms from the "cd" branch every night and stores them at http://bundles.openttdcoop.org/cargodist/. Downloading a bundle from there is probably the fastest way to get started with cargodist. If you experience a crash please go ahead and post a report, including crash.log, crash.sav, crash.png and crash.dmp (if available) in this thread. The same goes for any non-crashing unexpected behavior or anything you think might be a bug. I'll examine and fix the problem as soon as possible. If you like to discuss how to play with cargodist and what strategies to apply and so on, please do that in this thread: viewtopic.php?f=29&t=58091

My plan for further development is (in no particular order):
  • Support more order modifications like "unload all" and "transfer" in the routing algorithm rather than just routing like they don't exist.
  • Make the time a thread gets for calculating the linkgraph dependent on the relevant settings and the size of the linkgraph to be calculated. Right now the time reserved for the link graph calculation is based on a worst case scenario and thus very long. This is the direct cause of the long delay between changes in the game and reactions in the routing scheme.
  • Convince people to publicly play network games and show to the devs that Cargodist really is stable and ready for trunk inclusion (or fix any bugs showing up in that process).


Attachments:
File comment: link graph overlays over main viewport and smallmap
overlay.png
overlay.png [ 80.04 KiB | Viewed 48769 times ]
File comment: Station GUI with routing information
station-gui.png
station-gui.png [ 55.02 KiB | Viewed 48769 times ]

_________________
The guy on the picture is not me, it's Alonso.


Last edited by fonso on Mon Apr 08, 2013 3:53 pm, edited 80 times in total.
Top
   
 Post subject: Re: Link Capacities
PostPosted: Tue Feb 24, 2009 3:40 am 
Offline
Tycoon
Tycoon

Joined: Sun Dec 09, 2007 9:28 pm
Posts: 1919
This sounds very nice, better than the approximate estimation of traffic we have to rely on now.

1) If the station has passengers piling up, it needs more trains
2) If trains are consistantly partially empty, you can remove trains.

It takes so long to check 2) that most routes end up with too many trains, and any shared track ends up with so many trains on it that half the game is spent upgrading it.

Assuming you get this finished, it could be a massive time saver :)

_________________
Jon


Top
   
 Post subject: Re: Link Capacities
PostPosted: Tue Feb 24, 2009 9:16 am 
Offline
President
President
User avatar

Joined: Sat Oct 13, 2007 8:28 am
Posts: 945
The timesaving when estimating which routes are over- and underloaded is already feasible. The only problem is that you can't decipher the numbers in the smallmap for short links. If someone comes up with an idea how to solve that and if that's easy to do I'll implement it. For now I'll stick to saving and configuration.

OK, I'll come up with an idea myself: The overall capacity of a link could be represented by the width of a line and the usage ratio by its color. Then you don't need the numbers anymore. I'll try to implement it.

_________________
The guy on the picture is not me, it's Alonso.


Top
   
 Post subject: Re: Link Capacities
PostPosted: Tue Feb 24, 2009 11:40 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4551
Location: /home/sweden
An idea that pops out of my head is to draw the higher level network not only in the minimap but as a overlay in the main viewport. That way there is more space for more details. Though the overview that might be as important is lost then. And would probably require quite some initial coding time to get that started.

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
PostPosted: Tue Mar 03, 2009 10:16 am 
Offline
President
President
User avatar

Joined: Sat Oct 13, 2007 8:28 am
Posts: 945
updated. See first post.

_________________
The guy on the picture is not me, it's Alonso.


Top
   
 Post subject: Re: Cargo Distribution
PostPosted: Fri Mar 13, 2009 10:38 pm 
Offline
President
President
User avatar

Joined: Sat Oct 13, 2007 8:28 am
Posts: 945
updated again. See first post. But if no one is interested I will stop updating and only tell you when it's done ...

_________________
The guy on the picture is not me, it's Alonso.


Top
   
 Post subject: Re: Cargo Distribution
PostPosted: Sat Mar 14, 2009 12:27 am 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Wed Jun 28, 2006 6:25 pm
Posts: 302
Location: Florida
No no, don't do that! If you keep us aware of how things are coming along, then we're comforted in a small way that you're still working on it. As a Cargodest fan, i'm interested in your work. But like most of us, i'm more interested in its implementation and what it means to gameplay. This is why we want to know how it's going.

Remember, a lot more folks are interested in your work than those who will actually place a comment in this thread.... Our deep-down dream is that you don't give up, especially because you don't think anyone cares about what you're doing! :wink:


Top
   
 Post subject: Re: Cargo Distribution
PostPosted: Mon Mar 16, 2009 7:02 pm 
Offline
President
President
User avatar

Joined: Sat Oct 13, 2007 8:28 am
Posts: 945
So, I found a new toy called git. It allows me to easily create and maintain hierarchical patches on top of each other. So I can give you the link capacities which are fairly useful on their own as standalone version, which is still being maintained while I work on other parts of cargo distribution. As patches to be applied on top of that you get first connected components and then demands. Others will follow. While I did all that I also cleaned up the code so that it conforms to OpenTTD coding standards (or at least tries to). Due to the 3 file limit I'll post only the capacities patch and an all-in-one patch with all of cargo distribution in the first post.


Attachments:
capacities_r15743.diff [28.34 KiB]
Downloaded 669 times
linkgraph_r15743.diff [16.41 KiB]
Downloaded 458 times
demands_r15743.diff [6.93 KiB]
Downloaded 464 times

_________________
The guy on the picture is not me, it's Alonso.
Top
   
 Post subject: Re: Cargo Distribution
PostPosted: Tue Mar 17, 2009 2:05 am 
Offline
Tycoon
Tycoon

Joined: Sun Dec 09, 2007 9:28 pm
Posts: 1919
This looks very good, especially compared to what you had when I first posted.

Any chance of a binary? Visual Studio is having a disagreement with my laptop :-(

_________________
Jon


Top
   
 Post subject: Re: Cargo Distribution
PostPosted: Tue Mar 17, 2009 10:29 am 
Offline
President
President
User avatar

Joined: Sat Oct 13, 2007 8:28 am
Posts: 945
audigex wrote:
This looks very good, especially compared to what you had when I first posted.

Any chance of a binary? Visual Studio is having a disagreement with my laptop :-(


Not from me. I don't use Windows. But of course anyone is free to build a Windows binary. And if you tell me the exact problem you are having I might be able to find out if it's related to my code and fix it if that's the case.

_________________
The guy on the picture is not me, it's Alonso.


Top
   
 Post subject: Re: Cargo Distribution
PostPosted: Thu Mar 19, 2009 2:39 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4551
Location: /home/sweden
I tried to use your combined diff from the first post. However examinating the patch I found out that SVN tortoise would probably not understand it, so i used patch.exe from cygwin. From reading the patch I figured -p0 is the correct way to apply it but that fails:

Code:
G:\Programming\OpenTTD\Trunk>patch -p0 < cargodist_r15743.diff
patching file source.list
Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.


-p1 gives:
Code:
G:\Programming\OpenTTD\Trunk>patch -p 1 < cargodist_r15743.diff
missing header for unified diff at line 5 of patch
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git source.list source.list
|index 6f34894..0080d24 100644
|--- source.list
|+++ source.list
--------------------------
File to patch:

I type source.list and <enter>

But then I get
Code:
patching file source.list
missing header for unified diff at line 21 of patch
can't find file to patch at input line 21
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|,7 @@ heightmap.cpp
| highscore.cpp
| ini.cpp
| landscape.cpp
|+linkgraph.cpp
| map.cpp
| md5.cpp
| minilzo.cpp
--------------------------
File to patch:


Which seams to correspond to part of the changes to source.list.

I also tried google for patch.exe and downloaded it directly from GnuForWindows, but that just gave the same errors. (not surprisingly as it is the same version)



I don't know if it is anything you can do about it really, just wanted to inform that I tried to do something but it failed.

Edit: I have "updated" to version r15743 using SVN, which is the revision in the patch file name.

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
 Post subject: Re: Cargo Distribution
PostPosted: Thu Mar 19, 2009 2:50 pm 
Offline
Engineer
Engineer

Joined: Sat May 24, 2008 11:06 pm
Posts: 22
Very cool project. I'll have to try compiling it this weekend. Any chance we can see a few pictures of the map overlays?


Top
   
 Post subject: Re: Cargo Distribution
PostPosted: Thu Mar 19, 2009 3:43 pm 
Offline
President
President
User avatar

Joined: Sat Oct 13, 2007 8:28 am
Posts: 945
Zuu wrote:
I tried to use your combined diff from the first post. However examinating the patch I found out that SVN tortoise would probably not understand it, so i used patch.exe from cygwin. From reading the patch I figured -p0 is the correct way to apply it but that fails:

Code:
G:\Programming\OpenTTD\Trunk>patch -p0 < cargodist_r15743.diff
patching file source.list
Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

...


-p0 should be correct. The problem is that git produces diffs with some special lines the windows patch.exe doesn't understand. I'll try to create a Windows-friendly patch by manually running diff between two different trees later when I prepare today's update. And I'll give you a screenshot ...

_________________
The guy on the picture is not me, it's Alonso.


Top
   
 Post subject: Re: Cargo Distribution
PostPosted: Thu Mar 19, 2009 9:52 pm 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
fonso wrote:
I'll try to create a Windows-friendly patch by ...

I'd try removing the "index" and "new file" lines.

And Zuu, what's the output of patch -v or patch --version?

_________________
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser


Top
   
 Post subject: Re: Cargo Distribution
PostPosted: Thu Mar 19, 2009 10:10 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4551
Location: /home/sweden
DaleStan wrote:
And Zuu, what's the output of patch -v or patch --version?

patch 2.5.9

And then the copyright notice.

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
 Post subject: Re: Cargo Distribution
PostPosted: Fri Mar 20, 2009 12:15 am 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
Very much not the answer I was expecting. My patch(1) ("patch 2.5.8", from Cygwin) can apply the patch just fine. Are you sure that the line endings in the diff and the source match?

_________________
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser


Top
   
 Post subject: Re: Cargo Distribution
PostPosted: Fri Mar 20, 2009 1:04 am 
Offline
President
President
User avatar

Joined: Sat Oct 13, 2007 8:28 am
Posts: 945
So here are the three patches up-to-date with configurable demands functions per cargo class and with an antisymmetric demand function. I removed all the index and /dev/null entries. Please tell me if that helps.


Attachments:
capacities_r15774.diff [28.15 KiB]
Downloaded 541 times
linkgraph_r15774.diff [16.59 KiB]
Downloaded 421 times
demands_r15774.diff [18.76 KiB]
Downloaded 413 times

_________________
The guy on the picture is not me, it's Alonso.
Top
   
 Post subject: Re: Cargo Distribution
PostPosted: Fri Mar 20, 2009 7:35 am 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4551
Location: /home/sweden
DaleStan wrote:
Very much not the answer I was expecting. My patch(1) ("patch 2.5.8", from Cygwin) can apply the patch just fine. Are you sure that the line endings in the diff and the source match?


About line endings, most likely not. As SVN tortoise convert the line endings if I recall correctly. Meaning that I need to convert the patch file too. As reading your post I guess the patch tool do not handle differences in line ending characters between source and patch file. (or at least not without applying some flag for that)

Thanks for pointing out that DaleStan.

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
 Post subject: Re: Cargo Distribution
PostPosted: Sun Mar 22, 2009 10:59 pm 
Offline
Tycoon
Tycoon

Joined: Sun Dec 09, 2007 9:28 pm
Posts: 1919
fonso wrote:
audigex wrote:
This looks very good, especially compared to what you had when I first posted.

Any chance of a binary? Visual Studio is having a disagreement with my laptop :-(


Not from me. I don't use Windows. But of course anyone is free to build a Windows binary. And if you tell me the exact problem you are having I might be able to find out if it's related to my code and fix it if that's the case.


Thanks for the offer, but it's nothing to do with your code :-) I can't even make it compile trunk and I'm at a complete loss as to why not. I need to try a different compiler when I get the time.

_________________
Jon


Top
   
PostPosted: Wed Mar 25, 2009 12:55 am 
Offline
President
President
User avatar

Joined: Sat Oct 13, 2007 8:28 am
Posts: 945
I have updated the first post and the patches. I'm using git's patch format again as no one could say if the other one is better. You get the all-in-one patch in this post.


Attachments:
File comment: all-in-one patch
cargodist_r15839.diff [61.22 KiB]
Downloaded 661 times

_________________
The guy on the picture is not me, it's Alonso.
Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3079 posts ]  Go to page 1 2 3 4 5154 Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2019 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2019.
Hosted by Zernebok Hosting.