[patch] Polyline track building tool

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
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

[patch] Polyline track building tool

Post by adf88 » 19 Oct 2011 12:00

***UPDATED***

The patch adds new rail building tool called "polyline". It allows to build rail lines more quickly and more precisely.
polyline_track_tool_v11b_ottd_r27726.zip
All-in-one patch against OpenTTD r27726.
(24.19 KiB) Downloaded 182 times
polyline_track_tool_v11b_ottd_r27726-mq.zip
[ALTERNATIVE] Patch queue.
(42.2 KiB) Downloaded 91 times
Usage:
  • To open polyline tool click or CTRL-click on the new button in the rail toolbar or use hotkeys (CTRL+A, CTRL+SHIFT+A)
  • Click on a tile to start placing a line.
  • Click once to build a line, click another time to build another line connected to previous one.
  • Double-click to build an ending line.
  • To lock direction of the line, press and hold left mouse button (drag-drop).
poly2.png
poly2.png (156.58 KiB) Viewed 15614 times
Detailed description on how the tool works:
  • Every time you build a track/tunnel/bridge/station (no matted which tool you use) it's end is remembered. While the "polyline" tool is opened a line is highlighted from the point that was remembered (the end of the previous track) toward cursor.
  • Pushing left mouse button down locks direction so you can change only length of the line. Releasing button builds highlighted line. After a line is built the tool keeps opened and you can build next line connected to the previous one by clicking another time.
  • White highlight is a track that will be placed if you click. Blue highlight is a guideline.
  • Moving backward is possible by using remove mode (hold CTRL), when you remove a piece of track next highlight will start from the end of the removed line.
  • Clicking on the polyline button opens the tool in non-snapping mode (new line) or closes the tool if it was already opened.
  • Ctrl-clicking on the polyline button opens the tool in snapping mode or switch between snapping and non-snapping modes if the tool was already opened.
  • Ctrl+A hotkey activates polyline tool in snapping mode or closes the tool if snapping mode was already active.
  • Ctrl+Shift+A hotkey activates polyline tool in non-snapping mode or closes the tool if non-snapping mode was already active.
Compatibility:
  • The patch can be used to play on unpatched servers.
  • Savegames made with patched OpenTTD can be opened with unpatched OpenTTD.
Extras:
Last edited by adf88 on 27 Apr 2017 06:12, edited 62 times in total.
:] don't worry, be happy and checkout my patches

User avatar
Leanden
Tycoon
Tycoon
Posts: 2620
Joined: 19 Mar 2009 19:25
Location: Kent

Re: [patch] Polyline track building tool

Post by Leanden » 19 Oct 2011 13:40

Do you have image which can demonstrate what you mean by Polyline building?
Image

User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: [patch] Polyline track building tool

Post by adf88 » 19 Oct 2011 13:53

I would have to make a video...
In short: one click is one line (one straight rail track), fallowing line starts where the previous line ended. You don't have to drag-drop to build a track. Just click,click,click and you built 3 track connected each other.
Last edited by adf88 on 19 Oct 2011 13:57, edited 1 time in total.
:] don't worry, be happy and checkout my patches

User avatar
Leanden
Tycoon
Tycoon
Posts: 2620
Joined: 19 Mar 2009 19:25
Location: Kent

Re: [patch] Polyline track building tool

Post by Leanden » 19 Oct 2011 13:56

Ah, so basically, you click once to indicate the start point, then the track drags with the mouse until you reach the end point and click again. Much like how Autorail dragging works now but without having to hold down the mouse button? (I assume meaning you could use the right mouse button to scroll across the screen?)
Image

User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: [patch] Polyline track building tool

Post by adf88 » 21 Oct 2011 14:34

:] don't worry, be happy and checkout my patches

xmirakulix
Engineer
Engineer
Posts: 36
Joined: 06 Jan 2010 18:06

Re: [patch] Polyline track building tool

Post by xmirakulix » 29 Oct 2011 13:31

Just gave it a try, and I really like it.
It comes in handy, when you're building log tracks that don't consist of only straight tracks (e.g. when building across hills without terraforming)

One feature I'm missing though is, if one could "end" the sequence and start building a new polyline, maybe by right- or double-clicking the last piece of the "ending" line.

User avatar
Emperor Jake
Tycoon
Tycoon
Posts: 3085
Joined: 24 Apr 2007 09:37
Location: Straya

Re: [patch] Polyline track building tool

Post by Emperor Jake » 30 Oct 2011 05:26

This is very similar to a suggestion I made some time ago... Thank you, I must try it out :D
--Stuff I made (or helped make)--
ImageImageImageImage

--My Award-Winning Screenshots and Videos--

User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: [patch] Polyline track building tool

Post by adf88 » 30 Oct 2011 12:20

Patch updated.
Refined rules about direction and length choice. Better hotkey handling. No blinking tooltip bug.
xmirakulix wrote:One feature I'm missing though is, if one could "end" the sequence and start building a new polyline, maybe by right- or double-clicking the last piece of the "ending" line.
Right click is for map scrolling. Double-click is problematic to handle. Just hit 'A' button to enter regular mode, place the first line and hit CTRL+A to switch back to "polyline" mode and place fallowing lines (it is possible after recent update).
:] don't worry, be happy and checkout my patches

User avatar
FooBar
Tycoon
Tycoon
Posts: 6559
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: [patch] Polyline track building tool

Post by FooBar » 30 Oct 2011 12:55

adf88 wrote:Double-click is problematic to handle.
Maybe you can borrow something from other doubleclick functions elsewhere in the game.

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

Re: [patch] Polyline track building tool

Post by Eddi » 30 Oct 2011 15:16

i don't remember any double click functionality elsewhere in the game.
You might not exactly be interested in Ferion, but if you are, have fun :)

Yexo
Tycoon
Tycoon
Posts: 3653
Joined: 20 Dec 2007 12:49

Re: [patch] Polyline track building tool

Post by Yexo » 30 Oct 2011 15:18

A few lists react to double-click, but not so much.

User avatar
FooBar
Tycoon
Tycoon
Posts: 6559
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: [patch] Polyline track building tool

Post by FooBar » 30 Oct 2011 15:25

Eddi wrote:i don't remember any double click functionality elsewhere in the game.
Here's a non-exhaustive overview:

- load game (doubleclick on savegame name)
- add newgrf to active list
- remove newgrf from active list
- purchase vehicle
- refit to

These are indeed all doubleclicks in list thingies and not somewhere on the map. I don't know if that complicates the matter further, but doubleclicks are certainly possible.

User avatar
Korenn
Tycoon
Tycoon
Posts: 1628
Joined: 26 Mar 2004 01:27
Location: Netherlands, Enschede
Contact:

Re: [patch] Polyline track building tool

Post by Korenn » 31 Oct 2011 00:26

FooBar wrote: - purchase vehicle
- refit to

These are indeed all doubleclicks in list thingies and not somewhere on the map. I don't know if that complicates the matter further, but doubleclicks are certainly possible.
wait, those exist? stupid non-documented features... That saves a lot of time.
Creator of the Openttd Challenge Spinoff, Town Demand patch
The path to riches, a report on playing on a daylength server on ultra hard mode.

User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: [patch] Polyline track building tool

Post by adf88 » 31 Oct 2011 10:51

I didn't say that it is impossible or even hard to put a hook on double-clicks. Actually it's extremely easy. The game nicely detects double-clicks, all I have to do is to pass an extra value to HandleVieportClicked saying whether the click was single or double.

The problem is to define how the tool should behave. The idea of finishing a polyline discords with the idea of starting a polyline. We are not defining directly where a polyline starts, it's always connected with previously built track/bridge/tunnel. That's a feature, it allows to build a railway continuously e.g. we place a piece of track, then do some terraforming, then build a tunnel and place next piece of track and so on. So basically we are not defining the start point of a polyline at all, it's (almost) always defined. This is consistent with not defining the end of a polyline because an end point, if defined, means no start point for next polyline. In other words - there was no start points or end points, there were only middle points.

Anyway, I updated the patch so a double-click finishes current polyline and clears any start points. Maybe it's a better way...
I also refined the rule about track length.
:] don't worry, be happy and checkout my patches

User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: [patch] Polyline track building tool

Post by HackaLittleBit » 01 Nov 2011 12:54

Nice feature adf88.

I tried it and I like it very much.
The double click works smooth.
Maybe this feature should be standard behavior for
cr.png
cr.png (13.54 KiB) Viewed 20373 times
'auto rail mode'?
That would make the patch more simple (no extra graphics) and
nm.png
nm.png (34.45 KiB) Viewed 20373 times
'original rail construction' behaves like before.
My only doubt is that rail building becomes really easy (and fun :) ) now. Is that not cheating?
Maybe 10% extra cost?

Thanks

User avatar
Leanden
Tycoon
Tycoon
Posts: 2620
Joined: 19 Mar 2009 19:25
Location: Kent

Re: [patch] Polyline track building tool

Post by Leanden » 01 Nov 2011 14:16

Why is it cheating or worthy of being more expensive. All you are doing is hastening the building of the railway by making fewer clicks, You are still performing all the actions yourself, you just dont have to do the silly click and drag of before.

If the rail was being designed for you with a pathfinder or something that would be different.
Image

User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: [patch] Polyline track building tool

Post by HackaLittleBit » 01 Nov 2011 14:25

Leanden wrote:Why is it cheating
Time == Money. :wink:

User avatar
Leanden
Tycoon
Tycoon
Posts: 2620
Joined: 19 Mar 2009 19:25
Location: Kent

Re: [patch] Polyline track building tool

Post by Leanden » 01 Nov 2011 15:58

Pause the game and build while paused generates the same effect timewise. Also not a cheat.
Image

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

Re: [patch] Polyline track building tool

Post by Eddi » 01 Nov 2011 16:41

Leanden wrote:Also not a cheat.
it used to be.
You might not exactly be interested in Ferion, but if you are, have fun :)

User avatar
Leanden
Tycoon
Tycoon
Posts: 2620
Joined: 19 Mar 2009 19:25
Location: Kent

Re: [patch] Polyline track building tool

Post by Leanden » 01 Nov 2011 17:25

Eddi wrote:
Leanden wrote:Also not a cheat.
it used to be.
But the fact that it used to be and now isnt is surely an argument that being able to build quicker outside the active calender of the game isnt an issue if you dont want it to be.
Image

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 5 guests