Trains overtaking each other

  • If you're asking a question make sure to set the thread type to be a question!

lucky

¯\_(ツ)_/¯
May 25, 2009
583
145
I didn't immediately notice it, because you have to leave the map running for long enough (which I didn't often do as I tested if for one run to try and make things work); I have 3 func_tracktrains, one for the train and one for each carriage.

The problem, is that after a while, the carriages overtake the train:

(The carriages do start off overlapping each other because I havn't gotten the starting paths adjusted yet)


The last track path teleports back to the first one again, there is one large 90 degree bend in the track.


Each func_tracktrain is a different size... the *train* being smallest [504] by about 80 units, and one of the carriages [587] is also smaller than the other one [602] by maybe 10 units.
The carriages (as far as I can tell) after 30 minutes do not change position relative to each other, they do both however go in front of the *train*.
 
Last edited:

lucky

¯\_(ツ)_/¯
May 25, 2009
583
145
I made all the func_tracktrains the same size, and they still overtake
 

Forthex

L2: Junior Member
Aug 2, 2008
80
12
Each func_tracktrain of the engine and carriages keyvalues should be completely identical in every way (expect for name and first path_track). Just make sure the absolute middle of each func_tracktrain is in the absolute middle of its child (the engine or carriage), and adjust the func_tracktrain's height above track accordingly.
 

lucky

¯\_(ツ)_/¯
May 25, 2009
583
145
All the keyvalues are okay.

The starting path_track is as close to the middle of the func_tracktrains as I can now, to start them off right. The lengths and widths are the same(which is the only thing I can see mattering in them taking over each other?).
 

re1wind

aa
Aug 12, 2009
644
588
The carriages do start off overlapping each other because I haven't gotten the starting paths adjusted yet
That's probably part of the problem.
I assume that you're using the payload caparea output to move all three of the track_trains? If your two carriages use the same path_track loop as the payload/train, and start from a path track behind the main train, wouldn't that imply that they both move faster, but at the same speed, than the main train to get to the control point? the two carriages move at the same distance apart from each other, which is what they should be doing, but because when the cap area is "captured", they have to be at the control point path_track due to payload logic. Hence, if the carriages start behind the main train, they will move faster than it.

The quickest way of solving it would be to create a duplicate path_track system for all your carriages, adjusted so that the distance they have to move from start to control point is the same as the train. You'd only need one of these for the carriages, though as you could use a time delay to start the 2nd carriage. I *think*.
 
Last edited:

lucky

¯\_(ツ)_/¯
May 25, 2009
583
145
Uhhh.. I didn't use anything from any payloads. It is a normal train that moves at a constant speed.


Edit: also their starting position in relation to each other should not matter, since they should stay that distance from each other throughout, overlapped the same amount the whole time. Instead they are moving in front of the engine.
 
Last edited:

re1wind

aa
Aug 12, 2009
644
588
Ah, i see. I assumed it was, my bad then. :)

Something you could test is to see when the carriages start taking over the train. while following the path, while being teleported, while turning in the 90° arc, etc. That should help you give yourself some information as to where the problem is.

Another solution, and the simplest one that would take 5 min to do, is to stop all trains when they teleport to the start and then start them again through some scripting. This sounds like the better solution as whatever is causing the problem cannot become worse through several round trips.

i.e. have the starting path, the one with the flag "teleport to THIS path", have and onPass trigger that stop all three trains. The last train then has an output:
onstop -> logic_timer -> random time -> start train -> start carriage after x seconds -> start carriage2 after Y seconds.
Or if i'm imagining that output, just have a math counter that gets an input from the starting path and triggers the logic_timer when all three trains have triggered the onPass output of the path_track.

That way you overcome the problem, you get use random timer to send the train out which will add a bit of flavour and diversity to your map. All without actually knowing what was causing the problem! :]
 

lucky

¯\_(ツ)_/¯
May 25, 2009
583
145
The overtaking is very gradual, but noticeable after you leave it and come back (as you can see from the screenshot).

I shall try out a number of things (so many things have gone wrong making this train >.< )

The problem with starting them again is that I would need to be able for the output to set where it starts from. I can only seem to make it carry on, which means it would do the same, just having a bit of a pause. Thus this would mean I have to work out the exact timings to start them off again to be the right distance apart from each other.. which I really can't see myself being able to do (as it is impossible to tell ingame how many units they have moved).

I have so far managed to make it stay the same distance. The path is however, a number of different things. No curve, no change in height (it was by about 8 units before on one path), and ALSO the engine starts off at a different point. I am trying to make it work with the curve now.
 

lucky

¯\_(ツ)_/¯
May 25, 2009
583
145
The problem I have now is that the engine starts behind the cars :s

This is what i have for the setup

start3 -> start2 -> start1 >TELEPORTto> track1 ->track2 etc >TELEPORTto> track1
car2 car1 engine


Yet when they go on the track the engine is starting behind the cars


Before, the engine's start was at track1
 

re1wind

aa
Aug 12, 2009
644
588
This is roughly how i would solve your problem in pseudo hammer I/O language with descriptions.

*all trains start at path_1 (the one with the flag "teleport to THIS path"), with initial speed set to 0 (stopped)
math counter set to 0, trigger value set at 3
Logic_timer set to random time between 2 and 10 seconds (not required, but adds randomness to map)

Logic_auto ->start car1 -> start car 2 (time delay x) -> start car 3 (2x time delay x)
*train moves around path_track system*

path_1 has some outputs:
EDIT: actually, in retrospect, this section would be more complicated, as there's nothing stopping the the path_track from stopping car3 when car1 moves past it. Too tired to specifically figure this section out, but it shouldn't be that difficult, as there are many ways of implementing it.

Edit2: My brain is telling me that 2 math counters and 2 (toggle-able via previous math counters) disabled logic_relays should be capable of tackling this, but i highly doubt that. I vaguely remember something like that that valve coped with in hl2/ep1, and had to resort to user triggers...

onPass -> stop car1 & increment math_counter
onPass -> stop car2 & increment math counter
onPass -> stop car3 & increment math counter
//Note: These won't fire when the map loads because the trains haven't "passed" the paths yet.

Math counter is triggered:
math counter -> logic_timer -> onTimer -> start car 1 -> start car 2 (time delay x) -> start car 3 (2x time delay x)

Done. The only variable that needs tweaking now is your general time delay x which you can guestimate in hammer by taking the func_tracktrain's length and it's speed, dividing the speed by length, and getting a time in seconds for how long it takes one fun_tracktrain to move the distance of it's length. you can add a tenth of a second here to give the cars some distance between each other.

It's all pseudo hammer I/O but should give you a very clear idea of how to solve your problem. Network usage is negligible, and you can safely use the names to properly setup your trains, especially if they'll add a very interesting visual spectacle. Don't forget the sounds and the particle smoke stack! :D
 
Last edited:

lucky

¯\_(ツ)_/¯
May 25, 2009
583
145
Hmmm actually that would probably work, they won't necessarily be exactly the same as when they spawned, but every other time after that it will keep the same!
I was being silly the first time around when I was thinking about this, I have to admit.

Credit to you for sorting my head out!


As for what I believe to be the main problem: the curve in the track. I don't know why it is doing this, but I am 99% sure that making it turn is screwing it up.
 

re1wind

aa
Aug 12, 2009
644
588
Glad i could help, as i'm planning something much more complicated using multiple path tracksby taking advantage of the alternatepath input, random timers, and multiple train cars. So far i've only managed to get a working Prototype test map as the actual map i want to implement it into is currently under heavy reconstruction.

edit: yeah, take a look at the map, learn from it, spot any mistakes, see how you can improve upon it. :)