Patch: "intelligent" depots

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

Akoz
Engineer
Engineer
Posts: 9
Joined: 31 Jan 2008 18:25

Patch: "intelligent" depots

Post by Akoz »

Features:

Let's you build "intelligent" depots by ctrl+clicking when placing depot. (Make sure you build the station first.)
Intelligent depots connects with the nearest station and its nearest industry type. It then creates a train of the most used type with enough wagons to fill the platform length, then sets it to full load at the station and send it on its way (End order needs to be added manually afterwards)
The depot will then monitor the station and clone up trains with shared orders of the first one if the station stands unserviced.
Bonus feature: The right depot direction is also automatically detected.
No gui is provided.
The patched version should work with 0.7.1 servers.

Known bugs / issues:
If you don't use station layouts that forces the trains into the depot to wait for the station to be free, trains might pile up. See figure 1 in my next post.
I-Depots aren't saved. If you save the game and reload, or rejoin a network game the depots are back to normal depots.

v0.2 Update 24/7:
- Added functionality settings in the advanced settings -> vehicles -> depot category.
- Added auto delete for "crowded" depots.
- Partially implemented 1 year auto-renew. (This is still quite bugged!)

v0.1 Update 22/7:
- All actions are now cost-checked before initiated.
- Cloning of new trains is no longer depending on the first train made being around.
(the patch files and binary has been replaced)


The patch has yet to be thoroughly tested. Any help is appreciated.
Attachments
intd v0.2 0.7.1.patch
patch for 0.7.1
(32.23 KiB) Downloaded 102 times
IntD v0.2.zip
0.7.1 win32 package
(3.06 MiB) Downloaded 104 times
autodepot.PNG
autodepot.PNG (5.26 KiB) Viewed 4956 times
Last edited by Akoz on 24 Jul 2009 14:52, edited 18 times in total.
User avatar
cmoiromain
Chief Executive
Chief Executive
Posts: 655
Joined: 15 Jan 2007 21:45
Location: FRANCE
Contact:

Re: Patch: "intelligent" depots

Post by cmoiromain »

Wow, this sounds impressive, and really practical!

Could you please provide a windows binary? I look forward to trying it out.
I am little, ugly, and nasty. How do you do?
Akoz
Engineer
Engineer
Posts: 9
Joined: 31 Jan 2008 18:25

Re: Patch: "intelligent" depots

Post by Akoz »

Edit: Moved it into the first post.

Putting the depot placement example and the r16905 patch here instead.
Note: the patch for r16905 is not updated with advanced settings and autodelete.
Attachments
figure 1.
figure 1.
loading dep.png (11.66 KiB) Viewed 4959 times
intd r16905.patch
(19.02 KiB) Downloaded 83 times
Last edited by Akoz on 24 Jul 2009 14:41, edited 2 times in total.
User avatar
cmoiromain
Chief Executive
Chief Executive
Posts: 655
Joined: 15 Jan 2007 21:45
Location: FRANCE
Contact:

Re: Patch: "intelligent" depots

Post by cmoiromain »

Thanks =)

I'm playing with it right now, and it really saves some time!
I like the feature of waiting until there is enough money to build the train if there isn't enough when you build the depot.

Only one suggestion: the depot builds trains a little too eagerly. Just as the first train leaves, it builds another one to replace it. I think it should wait until the station rating is under a given value, say, 70%, to build a new train. Currently, it builds two train right from the start, causing both of them to have very weak or even negative profit.
I am little, ugly, and nasty. How do you do?
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Patch: "intelligent" depots

Post by petert »

Cool! Hope its in the trunk soon!
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Patch: "intelligent" depots

Post by Yexo »

petert wrote:Cool! Hope its in the trunk soon!
I hope it won't. Sorry to say Akoz, but I[0] don't like this patch at all. The only thing is does is helping users who don't want to play. If you don't want to play, start an AI and watch it. If you want to play, you have to manage vehicles yourself in my opinion.
Besides that, the patch does not follow the OpenTTD codestyle at all.

[0]Note the singular 'I', other devs may have another opinion about it.
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Patch: "intelligent" depots

Post by petert »

hehe,

I guess not. Good argument
Last edited by petert on 27 Aug 2009 01:42, edited 1 time in total.
User avatar
cmoiromain
Chief Executive
Chief Executive
Posts: 655
Joined: 15 Jan 2007 21:45
Location: FRANCE
Contact:

Re: Patch: "intelligent" depots

Post by cmoiromain »

It depends. I don't like the micromanaging in OpenTTD. What I like is to build the rails, and try to reduce the congestions as much as I can. This patch creates the trains on its own, that way I don't need to waste my time checking all industries all the time to see where I need more trains.

Maybe an AI could be made, that never builds tracks, but only buys trains and sets the orders. If I could code, I'd try to do something like that. Until then, this patch allows me to play different kinds of games from time to time, where I only need to focus on building the tracks. The rest of the time, I only need to build regular depots.
I am little, ugly, and nasty. How do you do?
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Patch: "intelligent" depots

Post by Bilbo »

Well, this isn't first (and probably not last) patch that tries to make it easier to build stuff. There is copy & paste patch (draw design once, build many times). There is my vehicle console commands patch (apply some command to subset of vehicles). There are probably other I can't now think of.

But this patch is a bit "different" - unlike copy & paste and vehicle commands, which merely speed up otherwise repetitive manual actions, this patch tries to "think" on behalf of the player - the train length is determined automatically (but in some games, I build shorter trains than max, lenght, because engines are weak and stronger engines to support full length trains will appear in 30 years or so ....), the cargo is determined automatically (eh, what will be the result for farm? livestock? wheat? And what about multi-industry stations? Like coal and ore mine in reach of single station ...) And the auto-cloning? While this may be good idea, it is prone to errors - once trains jam somewhere, this feature will send more and more trains on the tracks, making the jam worse.

So while I am not opposed as Yexo to patches that make things "easier" for players, I don't like this patch too.

But I think perhaps few ideas could be "salvaged":

Types of trains: I have few "favorite" train layouts. Idea would be to allow to build consists in "virtual depot" and store them (with some name), or maybe to amke it easier, just take any existing train and declare this as representant of certain consist type. Then you can build one of your consists with single click.

Advantages:
* If you want to make new train of your favorite type, you don't need to search for it to clone it.
* You could save your favorite consists in configuration and use them in other maps too (this could be a bit tricky due to NewGRF's)
* Atomic building - if you don't have the money, you may end up with building engine and then realizing you dohn't have enough money for all the wagons. Not anymore with consists.
* Better replacing - you can replace consist with 4 wagons for consist with 7 wagons for example. Not something that could be easily done with ordinary autoreplace.

As for "autobuilding" - guessing correctly how many trains should be on certain track is sometimes hard. I think there could be function that gives hint to this - you build a train, give it orders (go to X, full load, go to Y, unload). Then you could be able to click some "estimate optimal number of trains" button - this will find out the travel time for entire trip (either from timetable, or do pathfinding and then produce some estimate based on train power, distance, etc ....), then take capacity of the train and production per month and just present result of simple math to player:

numtrains=production_per_month/train_capacity*traveltime_in_months

(and perhaps for convenience, also number of trains already having this order)

It is then up to player how much will he take from this advice.
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Patch: "intelligent" depots

Post by Yexo »

Bilbo wrote:Well, this isn't first (and probably not last) patch that tries to make it easier to build stuff. There is copy & paste patch (draw design once, build many times). There is my vehicle console commands patch (apply some command to subset of vehicles). There are probably other I can't now think of.

But this patch is a bit "different" - unlike copy & paste and vehicle commands, which merely speed up otherwise repetitive manual actions, this patch tries to "think" on behalf of the player - the train length is determined automatically (but in some games, I build shorter trains than max, lenght, because engines are weak and stronger engines to support full length trains will appear in 30 years or so ....), the cargo is determined automatically (eh, what will be the result for farm? livestock? wheat? And what about multi-industry stations? Like coal and ore mine in reach of single station ...) And the auto-cloning? While this may be good idea, it is prone to errors - once trains jam somewhere, this feature will send more and more trains on the tracks, making the jam worse.
You've just perfectly described some of the problems you encounter when creating an AI.
So while I am not opposed as Yexo to patches that make things "easier" for players, I don't like this patch too.
Don't get me wrong, I'm nog opposed to patches that make things easier for players (I like the vehicle console commands patch, but I think the console needs a rewrite first). However, I am opposed to patches that try to think for the player, as you put it so nicely. The fact that I'm against the copy-paste patch is not because it makes it easier, but because it makes users braindead. With that patch you'll get users just copy-pasting some layouts without building any rails themself, while in my opinion an important part of the game is to actually build rail tracks.
But I think perhaps few ideas could be "salvaged":

Types of trains: I have few "favorite" train layouts. Idea would be to allow to build consists in "virtual depot" and store them (with some name), or maybe to amke it easier, just take any existing train and declare this as representant of certain consist type. Then you can build one of your consists with single click.
This idea (and many variants) have been suggested multiple time, but implementing it is far from easy.
As for "autobuilding" - guessing correctly how many trains should be on certain track is sometimes hard. I think there could be function that gives hint to this - you build a train, give it orders (go to X, full load, go to Y, unload). Then you could be able to click some "estimate optimal number of trains" button - this will find out the travel time for entire trip (either from timetable, or do pathfinding and then produce some estimate based on train power, distance, etc ....), then take capacity of the train and production per month and just present result of simple math to player:

numtrains=production_per_month/train_capacity*traveltime_in_months

(and perhaps for convenience, also number of trains already having this order)
This might be an idea, but I fear as soon as this is implemented users will scream to take other factors into account, like how much competition there is, whether there is a jam, to biuld the trains automatically instead of just saying how much to build, etc. So while there might be some potential, I'm not sure I like it.
User avatar
Korenn
Tycoon
Tycoon
Posts: 1735
Joined: 26 Mar 2004 01:27
Location: Netherlands
Contact:

Re: Patch: "intelligent" depots

Post by Korenn »

cmoiromain wrote:Maybe an AI could be made, that never builds tracks, but only buys trains and sets the orders.
Actually, that sounds like a pretty good idea, and can be done with 0 code changes. A train-managing AI that would start sending trains around on the network you've built could be pretty interesting.
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Patch: "intelligent" depots

Post by Bilbo »

Yexo wrote:The fact that I'm against the copy-paste patch is not because it makes it easier, but because it makes users braindead. With that patch you'll get users just copy-pasting some layouts without building any rails themself, while in my opinion an important part of the game is to actually build rail tracks.
Well, depends on how you use the patch. I personally often use it to paste repetitive constructions, like the sideline with depots: http://wiki.openttd.org/Image:Depot_on_tracks.png or standardized "two platform station leading to two-way line: http://wiki.openttd.org/Image:Depot_at_ ... trance.png (something like those 6 squares of track plus that depot, except I use PBS in it). More creative constructions, like crossing of two lines or larger stations - I have some templates too, but you often are constrained by terrain or need it a bit different, so I usually end up building those by hand.
numtrains=production_per_month/train_capacity*traveltime_in_months

(and perhaps for convenience, also number of trains already having this order)
This might be an idea, but I fear as soon as this is implemented users will scream to take other factors into account, like how much competition there is, whether there is a jam, to biuld the trains automatically instead of just saying how much to build, etc. So while there might be some potential, I'm not sure I like it.
Well, there is no way competition can be "computed", unless you have some crystal ball to predict action of other companies, you can at best have some estimate - I think it would be up to the player to decide how large part of the cargo he'll get (could be 100% with exclusive rights, could be less than 50% with inferior trains) and then put so many trains on the lines.
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
Akoz
Engineer
Engineer
Posts: 9
Joined: 31 Jan 2008 18:25

Re: Patch: "intelligent" depots

Post by Akoz »

I have no intention of trying to get it into trunk :p

The patch is quite useless before you have 100+ trains as managing them yourself always is better than some dumb AI anyway.
This is more a patch for those that fully utilized the copy-paste patch to make 10-way tracks all over the map and needs enough trains to fill them up. Using copy+paste to make the stations, and then this patch to make the depots will save some time, allowing u to get those really big crazy networks going :).

I added some some options to the advanced settings. If you go with 10+ tile stations you should probably use 10-15 days before making new trains unless you want to have trains in the depot at all times. If you have shorter stations you could go with 5-10.

I also added a poorly functional 1-year autorenew. I'm going away for a couple of weeks and I was hoping to have it done before I left, but I ran into some trouble getting it to work correctly in multiplayer with any kind of latency. Use at your own risk.
rsdworker
Traffic Manager
Traffic Manager
Posts: 148
Joined: 18 Mar 2009 13:58

Re: Patch: "intelligent" depots

Post by rsdworker »

hey - just wondering how i can put ID in because i just put in and nothing happens = trains should appear out automaticlly - the depot acts normal depot = i did ctrl clicking but i am not sure which i have to click?
i have version 0.7.1
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Patch: "intelligent" depots

Post by DaleStan »

If you have version 0.7.1, then you don't have the features contained in this patch.
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
rsdworker
Traffic Manager
Traffic Manager
Posts: 148
Joined: 18 Mar 2009 13:58

Re: Patch: "intelligent" depots

Post by rsdworker »

DaleStan wrote:If you have version 0.7.1, then you don't have the features contained in this patch.
ah - so which should be work? 0.7.0? or less
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Patch: "intelligent" depots

Post by Yexo »

rsdworker wrote:ah - so which should be work? 0.7.0? or less
No, only a custom binary. If you don't know how to compile, keywords to search for (both in this forum, on wiki.openttd.org and on google) are patching and compiling.
rsdworker
Traffic Manager
Traffic Manager
Posts: 148
Joined: 18 Mar 2009 13:58

Re: Patch: "intelligent" depots

Post by rsdworker »

hmmm - i am confused -
The patched version should work with 0.7.1 servers.
i going ask him about installation info because its is working but its needs help - the settings for autodepot are there
:cry:
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: Patch: "intelligent" depots

Post by Zuu »

A custom built patched 0.7.1 is not the same as 0.7.1. And you previously said that you have 0.7.1 people though you meant the official 0.7.1 version.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
rsdworker
Traffic Manager
Traffic Manager
Posts: 148
Joined: 18 Mar 2009 13:58

Re: Patch: "intelligent" depots

Post by rsdworker »

Zuu wrote:A custom built patched 0.7.1 is not the same as 0.7.1. And you previously said that you have 0.7.1 people though you meant the official 0.7.1 version.
AHA - thanks for explaining
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 32 guests