[patch] drive-through 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

User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: [patch] drive-through depots

Post by planetmaker »

racetrack wrote:
planetmaker wrote:in order to maintain backward compatibility of your patch, IMO, it is necessary to allow for an advanced setting along the lines of "allow multiple trains within a depot" yes/no. I guess it could be incorporated quite easily into the code you wrote (though I haven't looked at it yet).
Nah, that would just more code to maintain when I think I did it the wrong way the first time anyway. As far as I'm concerned this patch is experimental until such time as it hits trunk. If anyone wants to maintain any particular functionality they're quite welcome to - the entire history is available in my personal repository.
Well... it is my feeling that you _need_ this kind of switch in order to make it into trunk in the first place. Or you won't be able to guarantee to load old savegames. And in my experience it's also beneficial to that end, if you allow users to keep their old habbit (e.g. here: having many trains in one depot).

EDIT: well... of course one could always disable changing the setting, if the depots are occupied by more than one train...
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: [patch] drive-through depots

Post by planetmaker »

A brief look at the patch raised a few questions for me:
why the hell this:

Code: Select all

-static DiagDirection _build_depot_direction; ///< Currently selected depot direction
+static int _build_depot_direction;        ///< Currently selected depot direction

Code: Select all

-void DrawRoadDepotSprite(int x, int y, DiagDirection dir, RoadType rt);
+void DrawRoadDepotSprite(int x, int y, int dir, RoadType rt);
looks like in those cases you want trackdir or something along those lines. int is a bad choice, there are special data types (enums) for that.

Also this looks like a not sufficiently justified change; if it is justified, magic numbers are BAD:

Code: Select all

-	_build_depot_direction = DIAGDIR_NW;
+	_build_depot_direction = 0;
Regards,
pm
User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 708
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: [patch] drive-through depots

Post by JacobD88 »

racetrack wrote:I'm still not sure about the way I've done the signalling. I'm still thinking it through, and depending on what I come up with you may see a new topic from me soon about an overhaul of the whole signalling setup. I'll provide some more details once I've thought about it.

One side-effect of the signalling and passing options is that if you have two trains on opposite sides of the depot wanting to pass at the same time they'll wait in front of their respective exits forever (or until they time out and turn around). This is different to if two trains meet at a signal where they would turn around immediately. I might change it but it does complicate the code somewhat and it really needs me to do the aforementioned pondering about signals in general first. In either case you've probably built your tracks wrong and should put in some passing lanes or double tracks or whatever.
I've been thinking about this signalling stuff with the depot, would it be better in some ways to remove all signalling from a depot tile and leave the user to build the correct signal system for their needs for both tracks entering the depot?

In other words, make the depots drive through without stopping (according to your switch) but leave them as open track tiles, this would mean that you could construct depot signalling systems in a similar manner to stations. For example in the screenshot below, as the steam train enters the third line down, trains would only be able to enter the 1st, 2nd, and 4th lines to enter a depot, or wait until the steamer had entered the depot on the 3rd line (and stopped in it) before they could enter the 3rd depot themselves :)
Station-like construction...
Station-like construction...
Barnden Transport, 16th Jan 1928_cropped 1.png (31.11 KiB) Viewed 4394 times
Similarly, you could create depots that operated as below...
Another system...
Another system...
Barnden Transport, 17th Sep 1928_cropped 1.png (13.75 KiB) Viewed 4397 times
If a train does not need servicing, it carries along the main-line...

If it does require servicing it turns off the mainline track into a waiting area (3-tiles long in this case, the length can be dependant on maximum train size) which allows for multiple trains entering the depot not to hold up the mainline.

The train then enters the depot for servicing, or whatever, then departs into another waiting area, which allows the train only to re-join the mainline when it is clear (hence the pre-signals).

Without signals present in the depot, this system would run smoothly and efficiently, only allowing trains to enter the depot if the depot tile was clear or a train had stopped within it, but with signals inside the depot tile it does not work so well as trains can get confused as the signals in the depot are surplus to requirements

A quick and dirty solution for this feature for depots at stations as follows (note not for 90 degree turn disabled patch)
Station depot
Station depot
Barnden Transport, 27th Jan 1929_cropped 1.png (28.76 KiB) Viewed 4389 times
In short would it be an idea to allow your patch to permit users to choose between a lack of your signal system on depot tiles, and the system you currently incorporate with a switch?
User avatar
racetrack
Engineer
Engineer
Posts: 17
Joined: 27 Feb 2009 00:59
Location: Melbourne, Australia
Contact:

Re: [patch] drive-through depots

Post by racetrack »

planetmaker wrote:Well... it is my feeling that you _need_ this kind of switch in order to make it into trunk in the first place. Or you won't be able to guarantee to load old savegames. And in my experience it's also beneficial to that end, if you allow users to keep their old habbit (e.g. here: having many trains in one depot)
Oh, I see there's some confusion. Go back and read what I wrote more carefully, or alternatively consider actually trying the patch before commenting on its functionality. I said there can't be more than one train on the depot tile. I never said there couldn't be more than one train in the depot. Thats quite different and would make no sense.
A brief look at the patch raised a few questions for me:
why the hell this:
This patch is not finished. I'm fully aware that magic numbers are bad. Search for "XXX dtd" in road_gui.cpp to see that I've thought about it. There's a few quite minor things that I have to fix that I either haven't decided how I want to do it or I just haven't got around to implementing it yet.

In case I haven't been clear, this patch is EXPERIMENTAL and UNFINISHED. Its also for me a way to learn the OpenTTD code and explore some ideas. I am not interested in backward compatibility within the patch series. I am interested in backward compatibility with release/trunk, and I do want this patch to hit trunk eventually, and will do what is necessary to ensure that.

Please, when you examine the patch (either the code or testing), work with that in mind. If something doesn't work properly, let me know. If I've broken some standard OpenTTD feature, let me know. But please test it first.
racetrack, a coder.
today's special is drive-through depots
User avatar
racetrack
Engineer
Engineer
Posts: 17
Joined: 27 Feb 2009 00:59
Location: Melbourne, Australia
Contact:

Re: [patch] drive-through depots

Post by racetrack »

New patch is up, against r15905. Only one small change this time in that trains on drive-through depot tiles are now limited to 61km/h.

The main reason for posting this now is that the next thing to do is add appropriate costing for drive-through depots to the pathfinders, but my cursory glance at the code indicates that might be quite a big job, and we're just about to have another baby so I'm not finding a lot of time to work on this. I didn't want to disappear for too long without posting what I have. Hopefully I won't lose too much time; we'll see!

As always, do let me know if you're trying this. Cheers!

Drive-through depots

Edit: If you grabbed this before I made this edit, grab it again - I forgot to bump the savegame version.
Last edited by racetrack on 31 Mar 2009 10:21, edited 1 time in total.
racetrack, a coder.
today's special is drive-through depots
User avatar
racetrack
Engineer
Engineer
Posts: 17
Joined: 27 Feb 2009 00:59
Location: Melbourne, Australia
Contact:

Re: [patch] drive-through depots

Post by racetrack »

JacobD88, sorry for taking so long to reply to this. I needed to find a few spare minutes to sit down and digest it and haven't had that until now.
JacobD88 wrote:I've been thinking about this signalling stuff with the depot, would it be better in some ways to remove all signalling from a depot tile and leave the user to build the correct signal system for their needs for both tracks entering the depot?

[...]

Without signals present in the depot, this system would run smoothly and efficiently, only allowing trains to enter the depot if the depot tile was clear or a train had stopped within it, but with signals inside the depot tile it does not work so well as trains can get confused as the signals in the depot are surplus to requirements
So I take it that last paragraph means that you tested this and weird things happened? It wouldn't surprise me, the logic for the in-depot signals are quite spooky and don't quite fit neatly under any of the existing signal types.
In short would it be an idea to allow your patch to permit users to choose between a lack of your signal system on depot tiles, and the system you currently incorporate with a switch?
OK, so this is what we're talking about. We want a new boolean option "Use automatic signalling for drive-through rail depots", on by default. If its on, things work as they do in the current patch. If its disabled, then there will be no checking at all on trains coming into the depot. Even if they're coming in from other sides and they both want to enter, no action will be taken (ie they'll collide even when they aren't exactly crossing). Correct so far?

The only piece of the signalling stuff we'd want to keep (presumably) is the bit that stops trains from leaving if there's something on the block outside the depot. That check should include both sides of the depot so the leaving train doesn't collide with a train entering at the same time (ie collision on the depot tile).

Finally, there needs to be an explicit cost for drive-through depots in the pathfinders so that you don't get routed off the mainline in your second example if its clear and a depot visit is not required.

Does that all sound right?

Before I do this, is there any way I could redo the depot signalling so that they can work in the scenarios you describe? When you think about this assume that the pathfinders are adding a cost for running through the depot. I don't mind adding a config option if its absolutely necessary, but I don't like doing it if it could be avoided.
racetrack, a coder.
today's special is drive-through depots
Forked
Engineer
Engineer
Posts: 43
Joined: 13 Jan 2008 20:36

Re: [patch] drive-through depots

Post by Forked »

win32 binary :)


edit: binary removed due to GPL violation (it was missing the LICENSE/COPYING, readme.txt etc.. this was not on purpose)
Last edited by Forked on 18 Apr 2009 00:43, edited 3 times in total.
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: [patch] drive-through depots

Post by DJ Nekkid »

OT: should you not be at work now Forked? Awnsering telephones about fiber-connections not working, and that dreadfull red(ish)-haired techition they keep sending out? :p
Member of the
ImageImage
Forked
Engineer
Engineer
Posts: 43
Joined: 13 Jan 2008 20:36

Re: [patch] drive-through depots

Post by Forked »

uploaded new win32 binary, racetrack fixed something.
(OT answer: I am at work :) )
User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 708
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: [patch] drive-through depots

Post by JacobD88 »

racetrack wrote:
In short would it be an idea to allow your patch to permit users to choose between a lack of your signal system on depot tiles, and the system you currently incorporate with a switch?
OK, so this is what we're talking about. We want a new boolean option "Use automatic signalling for drive-through rail depots", on by default. If its on, things work as they do in the current patch. If its disabled, then there will be no checking at all on trains coming into the depot. Even if they're coming in from other sides and they both want to enter, no action will be taken (ie they'll collide even when they aren't exactly crossing). Correct so far?

The only piece of the signalling stuff we'd want to keep (presumably) is the bit that stops trains from leaving if there's something on the block outside the depot. That check should include both sides of the depot so the leaving train doesn't collide with a train entering at the same time (ie collision on the depot tile).

Finally, there needs to be an explicit cost for drive-through depots in the pathfinders so that you don't get routed off the mainline in your second example if its clear and a depot visit is not required.

Does that all sound right?

Before I do this, is there any way I could redo the depot signalling so that they can work in the scenarios you describe? When you think about this assume that the pathfinders are adding a cost for running through the depot. I don't mind adding a config option if its absolutely necessary, but I don't like doing it if it could be avoided.
Yep the boolean option is exactly what i mean, i realise as you pointed out that indeed the deactivation of the current signalling system could cause crashes between trains in the scenario you described, and this is in part what i see as a "feature" of disabling it, you really have to think out your depot signalling system to allow trains to enter from either side without crashing giving the user who chooses to turn off the current system a choice of dealing with a different construction challange.

As to the single remaining piece of signalling to leave in, you are exactly right, this could to remain to avoid collisions though a signal placed immediately on the tile next to the depot would do the same job (as the YAPF pathinder will not let a train enter an occupied block anyway, not sure about the other pathfinders), so it is in your jurisdiction if you wish to keep that single signalling feature or see what removing it altogether does

The cost for depots in the pathfinder is something that i agree would be required, though as to how higher penalty i am not sure, maybe something that would give the same penalty as a standard depot in the following scenario as this already prevents trains entering the depot line if a service is not required...
Example...
Example...
Freathwaite Springs Transport, 2nd Mar 2054_cropped.png (12.74 KiB) Viewed 4072 times
I'm not sure exactly how to get the signalling systems i described to function on a single depot tile, but will have a think and get back to you if you would rather do that, but it would be nice to see what people can devise without the built in signalling if you choose to add the option to disable it

Hope that helps, and ill have a go with the newest patch probably tonight or tomorrow AM (BST)

Regards

Jacob
User avatar
mrMann
Tycoon
Tycoon
Posts: 2793
Joined: 27 Oct 2006 20:38
Location: A house.
Contact:

Re: [patch] drive-through depots

Post by mrMann »

Jacob, that looks somewhat similar to what I do where I can, but check this out for multiple route trains:

Two different setups.
Attachments
Junction + depots.jpg
Junction + depots.jpg (88.34 KiB) Viewed 4049 times
Hmm, what should I put here...
User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 708
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: [patch] drive-through depots

Post by JacobD88 »

mrMann wrote:Jacob, that looks somewhat similar to what I do where I can, but check this out for multiple route trains:

Two different setups.
Hi, that looks interesting, though as not to highjack this thread, could you PM me a link to that savegame or send a larger screenshot? DO you have any examples utilising racetracks patch that you use?

Would be nice to see how your network pads together and the depot system operates

I also have a link to various depot designs (for bigger depots, large trains and 90 degree turns "off" patch) in my signature, but this does not contain any i've designed with racetracks work yet as i'm waiting until it is complete :mrgreen:

Jacob
User avatar
mrMann
Tycoon
Tycoon
Posts: 2793
Joined: 27 Oct 2006 20:38
Location: A house.
Contact:

Re: [patch] drive-through depots

Post by mrMann »

JacobD88 wrote:
mrMann wrote:Jacob, that looks somewhat similar to what I do where I can, but check this out for multiple route trains:

Two different setups.
Hi, that looks interesting, though as not to highjack this thread, could you PM me a link to that savegame or send a larger screenshot? DO you have any examples utilising racetracks patch that you use?

Would be nice to see how your network pads together and the depot system operates

I also have a link to various depot designs (for bigger depots, large trains and 90 degree turns "off" patch) in my signature, but this does not contain any i've designed with racetracks work yet as i'm waiting until it is complete :mrgreen:

Jacob
No, because the savegame has never been uploaded, and nor has a larger screenshot. I don't use racetrack's patch because my PC refuses to patch OpenTTD with any of the programs that the OpenTTD Wiki tell me to use, even when I follow the instructions to the letter. And that savegame will have advanced a lot since then.
Hmm, what should I put here...
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: [patch] drive-through depots

Post by chrissicom »

Unfortunately I have a little problem with the patch file of this patch. I can neither use it with TortoiseSVN - I just see a white window with no files to be changed - nore with patch.exe from the GNU Tools for Windows - black screen there with nothing happening. Can you create a "normal" SVN .diff?
Sacro
Tycoon
Tycoon
Posts: 1145
Joined: 18 Jun 2005 21:08
Location: Here
Contact:

Re: [patch] drive-through depots

Post by Sacro »

chrissicom wrote:Unfortunately I have a little problem with the patch file of this patch. I can neither use it with TortoiseSVN - I just see a white window with no files to be changed - nore with patch.exe from the GNU Tools for Windows - black screen there with nothing happening. Can you create a "normal" SVN .diff?
Did you try with -p1 ? A quick glance suggests that should work.
We Am De Best

Host of ThroughTheTube site
ZxBiohazardZx
Tycoon
Tycoon
Posts: 1534
Joined: 14 Mar 2006 12:46
Location: Netherlands

Re: [patch] drive-through depots

Post by ZxBiohazardZx »

Sacro wrote:
chrissicom wrote:Unfortunately I have a little problem with the patch file of this patch. I can neither use it with TortoiseSVN - I just see a white window with no files to be changed - nore with patch.exe from the GNU Tools for Windows - black screen there with nothing happening. Can you create a "normal" SVN .diff?
Did you try with -p1 ? A quick glance suggests that should work.
hes using tortoiseSVN (as i am) and it wont accept the patch as its not made for SVN browser (thats what IRC learned me)

try using "another" program....
User avatar
neob
Chief Executive
Chief Executive
Posts: 687
Joined: 29 Dec 2009 02:56

Re: [patch] drive-through depots

Post by neob »

Image
that looks great, its gives the network a more natural look
Image
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: [patch] drive-through depots

Post by petert »

I don't think that's a picture from this patch. That's from the Bigger Depots thread (http://www.tt-forums.net/viewtopic.php?f=36&t=40577), and as he says in the description: "Bigger Depots used with the ISR set can be used to create impressive illusions..."
User avatar
neob
Chief Executive
Chief Executive
Posts: 687
Joined: 29 Dec 2009 02:56

Re: [patch] drive-through depots

Post by neob »

petert wrote:I don't think that's a picture from this patch. That's from the Bigger Depots thread (http://www.tt-forums.net/viewtopic.php?f=36&t=40577), and as he says in the description: "Bigger Depots used with the ISR set can be used to create impressive illusions..."

yep, you are right i missed that part in the second post, i was sure its an illustration.
(that what happens when you sip through most of the suggestions in wiki)

anyway i think that the drive-through depots is a very nice feature
as for the other thing, i know about the additional station tiles grf's, i just didnt noticed the depots tiles, i'll check it later.
Image
User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 708
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: [patch] drive-through depots

Post by JacobD88 »

petert wrote:"Bigger Depots used with the ISR set can be used to create impressive illusions..."
Yep that is indeed the case at the moment, the Servicing Stations Patch will eventually take-over from bigger depots (though that will stay on BaNaNaS) to allow you to build depots that function as this one looks, but there is plenty to do before i release something, so it's all a LONG way off...

1) I need to know the status of this patch from racetrack, but sadly my PM's sent last year have not been replied to for some time. I'm giving it till one year after his last post and then assuming the patch is dead so i can carry on working on Servicing Stations without having to think about how i can make them work with and not against racetracks patch
2) I need to finish the sprites to support Servicing Stations, this includes a Bigger Mono-rail Depot and a Bigger Maglev Depot as well as a few of the other tiles discussed throughout my thread... Basically there's no point in releasing a patch without the visuals to use with it
3) I need to actually get my coding knowledge up to scratch as the reason it's taking so long to make anything for release (other than family commitments) is that i am a total newbie to C++ and i am only dipping in and out of working on the patch by which time there is usually a load of trunk changes to take into consideration
4) I need to make a Joint-Depots patch as part of the work or you will have a lot of depots in one station (I know there was one once, but i think it's very dead)
5) I need to make depot-station tiles aware of where a train is located within them or i could find trains entering one "platform" and leaving another, which may also have a train on it ---> Result: Crash. As an addition i need to make non-depot tiles in a given station, unable to perform the functions of servicing stations, this will allow for dedicated service platforms in large stations without altering the function of the rest of the station
6) Servicing Stations MUST, NAY, WILL NOT render normal depots obsolete as you will need these for building trains (I haven't worked out a good way to make my depots do it, partly due to point 5), servicing-stations as the name suggest will simply allow a train passing through to be serviced, refitted, or auto-replaced on first release
7) The patch must contain all the features i planned for Servicing Stations before release, as well as provide them in a relatively stable manner... If anything is ever going to stand a chance of getting into trunk it needs to be proven as stable, i don't see a long development of, buggy, half-complete, patches doing me any favours with devs :wink:

I will also release a Service Stations NewGRF vehicle set some time after i get the patch coded, i had a taster 0-6-0 saddle tank which is released, but to maintain UKRS and now PJ1K compatibility my work on this has been extended as i need to produce sprites for two different scales and provide a parameter to choose which scale you wish to use with the set
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 1 guest