About push-pull trains

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

User avatar
White Rabbit
Tycoon
Tycoon
Posts: 1734
Joined: 22 Jun 2005 19:15

About push-pull trains

Post by White Rabbit »

I thought push-pull trains were already possible with OTTD? I can't find the thread anymore, but I read once that you could have a tank engine (such as one from the UKRS) drive backwards if you CTRL+buy it, but it doesn't work. All of my tank engines face forwards and none of them will push the train back once they've pulled them into a station. They just reverse, like usual.
Image
User avatar
Born Acorn
Tycoon
Tycoon
Posts: 7595
Joined: 10 Dec 2002 20:36
Skype: bornacorn
Location: Wrexham, Wales
Contact:

Post by Born Acorn »

CTRL+Buy probably does something else, but CTRL+Click on a tank engine when it's already built to flip it's direction.

But pushing the train backwards is TTDPatch only, I'm afraid.
Image
User avatar
White Rabbit
Tycoon
Tycoon
Posts: 1734
Joined: 22 Jun 2005 19:15

Post by White Rabbit »

Born Acorn wrote:CTRL+Buy probably does something else, but CTRL+Click on a tank engine when it's already built to flip it's direction.
Oh, I must've misread it then, thanks.
But pushing the train backwards is TTDPatch only, I'm afraid.
But I've seen it in OTTD screenshots. :(

Here: http://www.tt-forums.net//files/donding ... 10_171.png
Unless Killer 11 is lying, that coal train in the middle is pushing, not pulling.

EDIT: It's a bit buggy too. I am using r7194. The latest nightly isn't available to me because I'm running Windows.

EDIT 2: Bug report is here: http://bugs.openttd.org/task/417
Attachments
tank engine bug.PNG
tank engine bug.PNG (20.32 KiB) Viewed 7048 times
Image
User avatar
skidd13
OpenTTD Developer
OpenTTD Developer
Posts: 522
Joined: 03 Mar 2005 10:49
Location: Germany

Post by skidd13 »

AFAIK are only pull and push-pull trains allowed.
Drag a second engine to the back of the train, if you want it that way.

See the screenshot from current trunk.
Train 6 push-pull = valid
Train 7 pull = valid
Train - push = invalid
Attachments
Lutscher Transport, 8. Nov 1958.png
Lutscher Transport, 8. Nov 1958.png (53.6 KiB) Viewed 6979 times
What does that mean - the circumstances? I determine what circumstances prevail. -- Napoleon Bonaparte
---
If we cannot end now our differences, at least we can help make the world safe for diversity. -- John F. Kennedy
---
Our problems are man-made, therefore they may be solved by man. No problem of human destiny is beyond human beings. -- John F. Kennedy
User avatar
White Rabbit
Tycoon
Tycoon
Posts: 1734
Joined: 22 Jun 2005 19:15

Post by White Rabbit »

From a game engine perspective, the train is still 'pull' only. When the train departs from a terminus station, it reverses.
Attachments
This is one WHOLE train.
This is one WHOLE train.
tank engine bug.PNG (22.26 KiB) Viewed 6973 times
Image
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post by Bjarni »

about pushing trains:
I investigated this a while ago. The problem is that data like orders, train number, profits and so on is stored in the vehicle struct of the front vehicle. Replacing the front engine with another one will only work if we copy the data. Also a train is a linked list of vehicles and they only know the next unit in the train, so to get this to work, the linked list should change all the next pointers. To even think about anything like this, we need to figure out a better way to handle this and make that change without making it a big and potientially buggy hack.
Yes, I did manage to get a train to drive in reverse, but it was way too buggy to actually play with it. Also it could only turn a articulated engine around (made the tender drive in front). This broke so much else that I will not even start to list all of it :P (should be enough to say that nobody would use it for playing). Since it turned out to be bugs in the design itself, I kind of left the idea at that time as a rewrite and a huge amount of work is needed to fix this.

As for the clipping issue when turning wagons/engines:
Known issue. When I added this feature (control click to turn), I didn't think of short sprites and when it showed up, it turned out to be really tricky to solve. It's a display bug only though. Nothing internally is changed when flipping a vehicle.
Attachments
BR01 (from the DB XL set) driving in reverse. NOT possible in any released code due to the fact that it's buggy by design.
BR01 (from the DB XL set) driving in reverse. NOT possible in any released code due to the fact that it's buggy by design.
BR01_reversed.png (6.11 KiB) Viewed 6896 times
User avatar
bobingabout
Tycoon
Tycoon
Posts: 1850
Joined: 21 May 2005 15:10
Location: Hull, England

Post by bobingabout »

White Rabbit wrote:EDIT 2: Bug report is here: http://bugs.openttd.org/task/417
its now a double report, i made this 1 MONTHS ago: http://bugs.openttd.org/task/165
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.

[/url]
User avatar
White Rabbit
Tycoon
Tycoon
Posts: 1734
Joined: 22 Jun 2005 19:15

Post by White Rabbit »

Yeah, 1 months. :D
Image
User avatar
bobingabout
Tycoon
Tycoon
Posts: 1850
Joined: 21 May 2005 15:10
Location: Hull, England

Post by bobingabout »

"this 1" as in this bug, followed by "MONTHS", it was posted in may, so thats over 6 months ago.
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.

[/url]
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

bobingabout wrote:"this 1" as in this bug, followed by "MONTHS", it was posted in may, so thats over 6 months ago.
See, this is why we prefer grammatically correct english.

"It's now a double report. I made this one, MONTHS ago:"
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
Scia
Traffic Manager
Traffic Manager
Posts: 155
Joined: 02 Aug 2005 19:46
Location: The Netherlands

Post by Scia »

Isn't it possible to code a locomotive that is not visible, uses 0 pixels, has 0 hp, and has no max speed, so that this decoy locomotive stores all the info. You can then buy a second engine that pushes the train. Maybe it is a hacky suggestion, but it might work :P .

Scia
User avatar
White Rabbit
Tycoon
Tycoon
Posts: 1734
Joined: 22 Jun 2005 19:15

Post by White Rabbit »

I don't think OTTD or TTDP support 0 pixel wagons. The ETD in the US Set is the shortest wagon you can have, but I forgot just how long it is...8 pixels? 3 pixels?
Image
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Brianetta wrote:
bobingabout wrote:"this 1" as in this bug, followed by "MONTHS", it was posted in may, so thats over 6 months ago.
See, this is why we prefer grammatically correct english.

"It's now a double report. I made this one, MONTHS ago:"
Or, to remove any possible ambiguity: "I posted this MONTHS ago."
Scia wrote:Isn't it possible to code a locomotive that is not visible, uses 0 pixels, has 0 hp, and has no max speed,
Maybe, no, and yes.
1) TTDPatch requires that all vehicles except the last be a minimum of 3/8 long, which is 12 pixels in the horizontal view. OpenTTD is free to lower this limit, but if it has, there is no documentation to this effect.
2) A locomotive with 0 hp is more commonly called a "wagon". All locomotives have a minimum of 1 hp.
3) No max speed is difficult, but a max speed of 65536 kph is quite possible, and just as effective.
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
User avatar
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Post by Wolf01 »

what about rotating the graphics of the train, when a train should turn at the end of the line/station, the engine sprite is placed at the last wagon, the first wagon sprite is placed at the last-1 wagon etc, all turned back
the two problems i thought are: engine smoke and sprite length
but the idea might work, the engine is still at the first position... only the chassis is switched
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5602
Joined: 13 Sep 2004 13:21
Location: The Moon

Post by PikkaBird »

Wolf01 wrote:what about rotating the graphics of the train, when a train should turn at the end of the line/station, the engine sprite is placed at the last wagon, the first wagon sprite is placed at the last-1 wagon etc, all turned back
the two problems i thought are: engine smoke and sprite length
but the idea might work, the engine is still at the first position... only the chassis is switched
That is basically how the trick is done in the UKRS. The locomotive is still at the front, and the brakevan is still at the back, it's just the brakevan is changed to look like a locomotive, and the locomotive to look like a brakevan.

AFAIK, all that is missing to make this work in OTTD is the bit that flips when the train reverses (train variable FF bit 0).
User avatar
bobingabout
Tycoon
Tycoon
Posts: 1850
Joined: 21 May 2005 15:10
Location: Hull, England

Post by bobingabout »

AFAIK, the trick in TTDP is done by swaping the graphics of the engine and the last wagon around, hence why it requires a break van at the end.
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.

[/url]
User avatar
Born Acorn
Tycoon
Tycoon
Posts: 7595
Joined: 10 Dec 2002 20:36
Skype: bornacorn
Location: Wrexham, Wales
Contact:

Post by Born Acorn »

bobingabout wrote:AFAIK, the trick in TTDP is done by swaping the graphics of the engine and the last wagon around, hence why it requires a break van at the end.
Did you even read PikkaBird's post, which says the same thing and more, or did you just read the first post?
Image
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post by Bjarni »

swapping graphics is no good as it demand a magic vehicle in the end. A real solution would be to somehow tell that a different vehicle is in front. I think I know how to do that, but it would need investigation and a lot of work and I'm not going to do that right now. Maybe it will end up being buggy by design, hence the reason why it needs investigation. At this stage, I will not promis anything except that odds are that it will not be done this year, if at all. Also I can't help thinking if the time spend on such a task is worth it because so much else can be coded with that amount of time.
User avatar
Dave
Moderator
Moderator
Posts: 17243
Joined: 26 Dec 2005 20:19
Location: North London

Post by Dave »

Bjarni wrote:swapping graphics is no good as it demand a magic vehicle in the end.
Pikka's brakevan springs to mind.
Official TT-Dave Fan Club

Dave's Screenshot Thread! - Albion: A fictional Britain
Flickr


Why be a song when you can be a symphony? r is a...
User avatar
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Post by Wolf01 »

all non-cargo trains i've seen have a special end wagon or are dualheaded
for me is not a problem to have all trains dualheaded (the main engine and the brakevan) i'm used to put an engine in the tail because it looks good when turn back ;)
maybe with the ability to have both the standard behaviour and the push-pull behaviour if you don't want the brakevan
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 20 guests