Ideas for Speed-Based Signalling

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

richk67
Tycoon
Tycoon
Posts: 2363
Joined: 05 Jun 2003 16:21
Location: Up North
Contact:

Post by richk67 »

MeusH wrote:This can be made without signals. Just a visual mark to note there is a limit. It can be on signal tile, too.

Simply, tile would need to store information about the speed. If speed != 0, show the marker and send trains to the proper lanes. If speed == 0, there is no marker and any train may cross it.

With extended or new map array it would be possible. With current... Hmm... Some free space needs to be found.
Well, the free space (and to me most logical space) to use in the current map array is one of the three unused signal types (101,110,111). It also has the advantage that the pathfinder is already looking at this variable to do its path calculations - I would not have to reinvent the wheel to make the speed limit have an effect.
OTTD NewGRF_ports. Add an airport design via newgrf.Superceded by Yexo's NewGrf Airports 2
Want to organise your trains? Try Routemarkers.
--- ==== --- === --- === ---
Firework Photography
User avatar
Korenn
Tycoon
Tycoon
Posts: 1735
Joined: 26 Mar 2004 01:27
Location: Netherlands
Contact:

Post by Korenn »

I'm interested in how you're going to store the speed information in those three unused values, since you want the user to input their own speed limit amounts.

Looks to me like finding new space somewhere is inevitable.
richk67
Tycoon
Tycoon
Posts: 2363
Joined: 05 Jun 2003 16:21
Location: Up North
Contact:

Post by richk67 »

Korenn wrote:I'm interested in how you're going to store the speed information in those three unused values, since you want the user to input their own speed limit amounts.

Looks to me like finding new space somewhere is inevitable.
In an earlier reply, I stated I would use a stack to store the Location & Speed. Once a signal is indicated in the map array, the pathfinder can look up the location in the stack to obtain the speed. This avoids having to repeatedly search the stack - it only checks when it already knows there is a value to check.
OTTD NewGRF_ports. Add an airport design via newgrf.Superceded by Yexo's NewGrf Airports 2
Want to organise your trains? Try Routemarkers.
--- ==== --- === --- === ---
Firework Photography
Jango
Traffic Manager
Traffic Manager
Posts: 189
Joined: 28 Aug 2004 12:13

Post by Jango »

richk67 wrote:
Moriarty wrote:You'd have to re-sign your entire network.
Unless someone was going mad with them (and thats their fault), then I would not expect to see more than a handful of these signs on a network.

You only really need it at the start of a section of track you want to control the speeds.
No, I do think Moriaty's right. You don't want to add a restriction in there, and then blame it on the user. If you were programming, you'd want to abstract away the detail, and I don't see why that shouldn't be the case here. I'd want the detail (actual speed) abstracted away from each placing and the option to set what that detail should be elsewhere. This could be a great improvement, but only if it's done properly.
richk67 wrote:
Moriarty wrote:Thus there would really have to be 2 (maybe 3) signs like this:
Slow trains only;
(Normal speed Trains;)
Express Only.
Yes, it simplifies board placement, but the downsides are big. This unfortunately would require some sort of analysis of the train consist every time it gets changed, comparison with the available engines, storage of what sort of train each one is, etc. Much easier to just work off the max train speed. (Not engine speed - wagon speed limits will slow a fast train.)
Why not have an additional GUI pane to set what each of Slow, Normal and Express should apply to.
You could improve things even further by allowing these things to be overridden at signal level, in which case it really WOULD be the fault of the user if they had to go round changing them all on the invention of a new loco.
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

The best way is to let user input the value like wants.
If we limit the speed to 512 units/hour, we would need 9 bytes to store this value.

Using 8 bytes or less would be possible, too. However, only even numbers would be possible (256*2=512), so even if users types 111km/h, OpenTTD will save it as 56, then calculate as 112. But we don't want that, do we?

This would be easy for user because tile would be marked only if the value is greater than 0.

Clicking on the tile with speed restriction, or creating the speed restrictor would open small dialog box, just like when making a sign (the speed restriction window would be smaller).

The speed restriction can be represented by a sign, like a road sign. It can be also displayed as number, if user turns the option on (it would be labeled like a waypoint or a station).


What do you think about that? It's easy til the point of finding these 9 bytes.
Sacro
Tycoon
Tycoon
Posts: 1145
Joined: 18 Jun 2005 21:08
Location: Here
Contact:

Post by Sacro »

Meush: Brilliant idea :),

Though about the slow medium and fast idea. are you meaning a GUI where you state which consists go down which line? Thats an interesting idea, and does make sense.

Moriarty: you wouldnt have to sign your whole network, I personally would only use it on main routes, where there's different speeds of trains travelling down.

I think this will be brilliant with elrails!
We Am De Best

Host of ThroughTheTube site
richk67
Tycoon
Tycoon
Posts: 2363
Joined: 05 Jun 2003 16:21
Location: Up North
Contact:

Post by richk67 »

MeusH wrote:The best way is to let user input the value like wants.
If we limit the speed to 512 units/hour, we would need 9 bytes to store this value.

Clicking on the tile with speed restriction, or creating the speed restrictor would open small dialog box, just like when making a sign (the speed restriction window would be smaller).

The speed restriction can be represented by a sign, like a road sign. It can be also displayed as number, if user turns the option on (it would be labeled like a waypoint or a station).

What do you think about that? It's easy til the point of finding these 9 bytes.
I only really need 1 bit in the map array - is the square a speed restriction? y/n? Then when I know it is one, I can do a brute force search down the list of speed restrictions to find that one. This will reduce the overhead. Of course, the minimum would be to have the speed held in the MapArray, but the space just isnt there, and my method is more future-friendly.

I think the best way is if I create this as a patch next week (my holiday), and people try it. If its too awkward to use, then it gets modified, but I'd rather try my way first (none of the alternatives are as simple to code... it is *difficult* to decide where Slow/Med/Fast falls, and setting 3 global vars is cruder than having a sign on the track... which is visually obvious).
OTTD NewGRF_ports. Add an airport design via newgrf.Superceded by Yexo's NewGrf Airports 2
Want to organise your trains? Try Routemarkers.
--- ==== --- === --- === ---
Firework Photography
Sebastiaan
Engineer
Engineer
Posts: 110
Joined: 20 Jun 2005 19:22
Location: Leuven, Belgium

Post by Sebastiaan »

I must say i basically like the idea. However, i think Moriarty is right by pointing out that readjusting speed limits would be a nightmare.

As an example: even when only using it on mainlines which have 4 tracks minimum, that would mean about 100 signs on a 2048x2048 map. And that, every time those trains/carriage speeds change.

There has been suggested a nice solution which limits us to 3 speeds. I could certainly live with that. For those who can't, how about this:

let the user specify his desired speed limits and add a change dialog in which he can have listed all his currently specified limits (as they are stored somewhere on run through the list could fill this dialog). Then he could, for every limit he specified, enter the new value and have all of them updated with one click. :)

I think this would allow both flexibility and ease of use. What do you think?
I hope I estimated the programmatical difficulties right.
richk67
Tycoon
Tycoon
Posts: 2363
Joined: 05 Jun 2003 16:21
Location: Up North
Contact:

Post by richk67 »

Sebastiaan wrote:There has been suggested a nice solution which limits us to 3 speeds.
And here it is (minus nice graphics).

I have reused other signal types as I dont know much about creating graphics. Hopefully, some fine person will help supply a Slow, Medium and Fast sign. (Smiles hopefully at MeusH ;) )

Just to explain the screen capture: Train 1 is an express at 100mph, and is the ONLY train that selects the Fast track (currently set for trains with a minimum speed of 90mph).

Train 2 is a medium speed train, and prefers the medium track. Train 3 is a slow freight and prefers the slow track ( for trains with a maximum speed of 55mph).

I say "prefer", because if their preferred track has a red light *at the point of decision*, then it will choose another track. So no train should get blocked by the presence of a speed sign.

All of these trains share orders. The selection between tracks is totally automatic.

I will post a patch in a new thread later today. I still need to create the Configure Patches gui part to let the speed limits be set in the config.
Attachments
Working demo of the Speed Signs feature.
Working demo of the Speed Signs feature.
Drunningbury Transport, 21st Jan 1967.png (99.55 KiB) Viewed 472 times
OTTD NewGRF_ports. Add an airport design via newgrf.Superceded by Yexo's NewGrf Airports 2
Want to organise your trains? Try Routemarkers.
--- ==== --- === --- === ---
Firework Photography
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 22 guests