Animated Level Crossings???
Moderator: Moderators
-
CaptScarlet
- Very Active Forum Member
- Posts: 3673
- Joined: Fri Nov 17, 2006 11:29 am
- Location: The Netherlands
Re: Animated Level Crossings???
AndiS, this may be a dumb question but how would this script handle say on a single line a train coming in the opposite direction and or after passing the link to deactivate the crossing then reversing to go through it again ?
John
John
- AndiS
- Very Active Forum Member
- Posts: 6207
- Joined: Fri Sep 23, 2005 4:43 pm
- Location: Jester's cell in ivory tower
- Contact:
Re: Animated Level Crossings???
John, not so dumb actually. The compromise solution I worked out is this:
If a train head passes a link approaching the crossing, its length is added to the "occupation counter". If the gates are open, they start closing.
If a train end passes a link running away from the crossing, its length is subtracted from that counter. If the counter becomes zero, the gates are opened.
The direction of the train relative to the link does not matter at all. The odd numbered links know that they point away from the crossing, so from the outside, all links work just the same.
These rules cover the case where you reverse and go back over the same link from which you came, and the case where two trains pass the crossing more or less at the same time, so that the gate stays closed until the second one is gone.
The bad news are that it may happen that the gates are in the process to open when another train reaches a link. In this case, I boldly start the closing animation (or warning, if existing), which will not be visually pleasing. It might be possible to jump into the right position of the opposite animation if the opening and closing animation are of a know and equal length. I did not implement nor test this because the animation I used (of the shunting disk) is very short. When someone will have constructed a gate with a slow closing animation, I will see how to optimise its appearance in such weird cases.
There would be much more potential for improvement of the animation timing, such as completing a full cycle before switching, but that requires more intelligent placement of "alarming points" first, which again touches on the issue of intelligent signal aspect display, which is an open wound anyway. E.g., imaging a crossing at the end of the station. You would want to close it after the train arrived, but surely, the starter must not clear before the gate is closed. Not like I have no ideas for that, too, but I must restrict myself to stepwise proceeding or nothing gets released.
If a train head passes a link approaching the crossing, its length is added to the "occupation counter". If the gates are open, they start closing.
If a train end passes a link running away from the crossing, its length is subtracted from that counter. If the counter becomes zero, the gates are opened.
The direction of the train relative to the link does not matter at all. The odd numbered links know that they point away from the crossing, so from the outside, all links work just the same.
These rules cover the case where you reverse and go back over the same link from which you came, and the case where two trains pass the crossing more or less at the same time, so that the gate stays closed until the second one is gone.
The bad news are that it may happen that the gates are in the process to open when another train reaches a link. In this case, I boldly start the closing animation (or warning, if existing), which will not be visually pleasing. It might be possible to jump into the right position of the opposite animation if the opening and closing animation are of a know and equal length. I did not implement nor test this because the animation I used (of the shunting disk) is very short. When someone will have constructed a gate with a slow closing animation, I will see how to optimise its appearance in such weird cases.
There would be much more potential for improvement of the animation timing, such as completing a full cycle before switching, but that requires more intelligent placement of "alarming points" first, which again touches on the issue of intelligent signal aspect display, which is an open wound anyway. E.g., imaging a crossing at the end of the station. You would want to close it after the train arrived, but surely, the starter must not clear before the gate is closed. Not like I have no ideas for that, too, but I must restrict myself to stepwise proceeding or nothing gets released.
- karma99
- Very Active Forum Member
- Posts: 2329
- Joined: Wed Oct 17, 2007 8:21 pm
- Location: Portsmouth, UK
Re: Animated Level Crossings???
Nice work Andi, the script seems to work well. Thank you for it
Got nothing more than a swinging rectangle at the moment, but concept is great so just need to pretty it up. Watch this space.
Got nothing more than a swinging rectangle at the moment, but concept is great so just need to pretty it up. Watch this space.
- Reppo
- Established Forum Member
- Posts: 308
- Joined: Sun Oct 14, 2007 5:38 pm
- Location: Santiago de Chile
Re: Animated Level Crossings???
Amazing work Andi, your script is working perfectly, I have started with my chilean level crossing too.
thank you very much.
thank you very much.

The man who doesn't follow his vocation betrays himself and condemns himself to unhappiness.
- AndiS
- Very Active Forum Member
- Posts: 6207
- Joined: Fri Sep 23, 2005 4:43 pm
- Location: Jester's cell in ivory tower
- Contact:
Re: Animated Level Crossings???
When you are done with the modelling, be sure to get the latest version here.
I made a few corrections since the initial upload which only Pete received. Now I added a readme file with detailed instructions and re-uploaded it under a new filename at the above link.
I made a few corrections since the initial upload which only Pete received. Now I added a readme file with detailed instructions and re-uploaded it under a new filename at the above link.
Re: Animated Level Crossings???
hi
thanks for your work andi. maybe we found our core programmer
anyway, thanks to all people who worked hard to fix this problem.
greetz
Rail-X
thanks for your work andi. maybe we found our core programmer
anyway, thanks to all people who worked hard to fix this problem.
greetz
Rail-X
-
Trainguy76
- Very Active Forum Member
- Posts: 2053
- Joined: Mon May 25, 2009 3:28 pm
- Location: Dreamland, USA.
- Contact:
Re: Animated Level Crossings???
One thing to note in this,
How do you animate level crossing near stations?
How do you animate level crossing near stations?
- AndiS
- Very Active Forum Member
- Posts: 6207
- Joined: Fri Sep 23, 2005 4:43 pm
- Location: Jester's cell in ivory tower
- Contact:
Re: Animated Level Crossings???
Near the station, you run into the usual problems that this game does not cater for direct mapping of prototypical procedures (as in: someone has a timetable and controls signals and crossings accordingly).
Also you run into the problem that they use different procedures in different places on the globe.
Roughly speaking, the situation is like this:
If there is sufficient overlap/safety margin between the starter signal at the platform and the crossing, then all is fine, you put the crossing's link just behind the starter signal, or between the starter signal and the end of the platform. Anyway, the crossing will start closing when the train starts moving and since it will be slow, timing will be ok.
If you want the gates to close before the train starts in the above setup, you are a bit out of luck, since signals currently don't know when departure time arrived. You could, of course, introduce some special signal object which times the stay of the train and after a minute makes the gates close. If you love that, it can be done. But some trains stop for longer and some for shorter. And making through trains stop for a minute is not a good idea (or close the gate 1 minutes after they passed).
Of course, I could make a link delay the closing only for a certain train type, or only if speed exceeds a certain threshold (which itself is difficult to define then).
If you want the gates to close before the train stops at the station, because the distance between the stopping point and the gates is too small (insufficient safety margin), you just put the links further down the line. It is quite prototypical that if the train stays there for an extra time, people at the crossing get angry.
If you want the gates to close as the train arrives and open again, because the train stays at the station for a long period, but the safety margin is not sufficient, so you must close the gates only to have the overlap behind the signal secured, then you need another custom link.
Normally, the gate keeper knows the speed of the train and the departure time and bases his actions on that. To model this, I could design links that you place pretty far from the gates and which delay the closing based on the speed of the train. However, this requires some computation on the side of the route builder, and some more setting of parameters, so I was not so sure of the demand for this. Also, such distant links increase the chance that they end up in a station layout which causes some more trouble. And of course, the timing would only work for rather constant train speeds.
If your only problem is that you have 4 station tracks and 2 route tracks, so you need 4 links on one side and 2 on the other, I could make another version of the script which arranges the links differently and you say in the header of the scripts how many links are on one side.
The current version assumes more or less plain track, with the same number of tracks on each side. You could cross over from one to the other, or stop at the gate and return back to where you came from, but you need the same number of tracks on both sides. This is just for simplicity of link placement.
The normal case is that I invent something supercomplex and no one can use it. This time, we did it the other way round, so as demand increases, I will ramp up complexity until people shout "No more!".
Also you run into the problem that they use different procedures in different places on the globe.
Roughly speaking, the situation is like this:
If there is sufficient overlap/safety margin between the starter signal at the platform and the crossing, then all is fine, you put the crossing's link just behind the starter signal, or between the starter signal and the end of the platform. Anyway, the crossing will start closing when the train starts moving and since it will be slow, timing will be ok.
If you want the gates to close before the train starts in the above setup, you are a bit out of luck, since signals currently don't know when departure time arrived. You could, of course, introduce some special signal object which times the stay of the train and after a minute makes the gates close. If you love that, it can be done. But some trains stop for longer and some for shorter. And making through trains stop for a minute is not a good idea (or close the gate 1 minutes after they passed).
Of course, I could make a link delay the closing only for a certain train type, or only if speed exceeds a certain threshold (which itself is difficult to define then).
If you want the gates to close before the train stops at the station, because the distance between the stopping point and the gates is too small (insufficient safety margin), you just put the links further down the line. It is quite prototypical that if the train stays there for an extra time, people at the crossing get angry.
If you want the gates to close as the train arrives and open again, because the train stays at the station for a long period, but the safety margin is not sufficient, so you must close the gates only to have the overlap behind the signal secured, then you need another custom link.
Normally, the gate keeper knows the speed of the train and the departure time and bases his actions on that. To model this, I could design links that you place pretty far from the gates and which delay the closing based on the speed of the train. However, this requires some computation on the side of the route builder, and some more setting of parameters, so I was not so sure of the demand for this. Also, such distant links increase the chance that they end up in a station layout which causes some more trouble. And of course, the timing would only work for rather constant train speeds.
If your only problem is that you have 4 station tracks and 2 route tracks, so you need 4 links on one side and 2 on the other, I could make another version of the script which arranges the links differently and you say in the header of the scripts how many links are on one side.
The current version assumes more or less plain track, with the same number of tracks on each side. You could cross over from one to the other, or stop at the gate and return back to where you came from, but you need the same number of tracks on both sides. This is just for simplicity of link placement.
The normal case is that I invent something supercomplex and no one can use it. This time, we did it the other way round, so as demand increases, I will ramp up complexity until people shout "No more!".
- nelson
- Well Established Forum Member
- Posts: 904
- Joined: Sun Jul 07, 2002 8:56 pm
- Location: Tractor country, Suffolk
- Contact:
Re: Animated Level Crossings???
Thanks for this Andis, if you can do this why not RS? Perhaps they should employ you and we'll get the fixes we need,
Regards
Dave
Regards
Dave
- AndiS
- Very Active Forum Member
- Posts: 6207
- Joined: Fri Sep 23, 2005 4:43 pm
- Location: Jester's cell in ivory tower
- Contact:
Re: Animated Level Crossings???
I prefer them to work on the core and users create content. Anyone can create something. Not everyone can programme and not everyone can work out complex animations, or create nice models, etc etc, but with teamwork, everything becomes possible.nelson wrote:if you can do this why not RS? Perhaps they should employ you and we'll get the fixes we need,
Without teamwork there were no crossings for two years. With teamwork, it was 2 days for me and 2 for Pete (and another one for the docu and packaging, I guess).
Sorry for ranting the same song for 4 years.
And thanks for the compliment anyway.
-
jaapsloot
- Been on the forums for a while
- Posts: 193
- Joined: Fri Mar 21, 2008 6:39 pm
- Location: Enschede, The Netherlands
- Contact:
Re: Animated Level Crossings???
Would you be able to do something with my level crossing source files?
Jaap
Jaap
-
Railworks7053
- Getting the hang of things now
- Posts: 41
- Joined: Wed Sep 02, 2009 1:45 pm
- Location: 87G
Re: Animated Level Crossings???
Many thanks for the crossings, will have to go and replace the default ones now.
Good stuff.
Chris.
Good stuff.
Chris.
RailFail, the nadir of train simulation.
- AndiS
- Very Active Forum Member
- Posts: 6207
- Joined: Fri Sep 23, 2005 4:43 pm
- Location: Jester's cell in ivory tower
- Contact:
Re: Animated Level Crossings???
Hi Jaap,jaapsloot wrote:Would you be able to do something with my level crossing source files?
Jaap
actually, I would be happy if you could integrate my script with your crossing yourself. I wrote a detailed description how to do it from the point where you already have the animated model exported into IGS and IA files. (If you have problems with the animation, you need to ask someone who knows your modelling programme.)
Description and script in their latest version are currently stored at http://andis.ukts.googlepages.com/Anima ... Gates3.zip - feel free to integrate them into what you want.
Of course, I am always happy to help understand the integration process but I am not a modeller and I want the integration to be simple enough to be done by every modeller himself in an hour or so. Of course, first time you have to read some 2 pages or so, but second time, it is just routine.
Thank you for your understanding,
Andi
- Reppo
- Established Forum Member
- Posts: 308
- Joined: Sun Oct 14, 2007 5:38 pm
- Location: Santiago de Chile
Re: Animated Level Crossings???
Hi!
The script works perfectly.
Currently I am working in my own crossings with bars.
Chilean crossings, of course.
http://www.youtube.com/watch?v=Aw79FRuR8pU
Thanks to Andi again.
The script works perfectly.
Currently I am working in my own crossings with bars.
Chilean crossings, of course.
http://www.youtube.com/watch?v=Aw79FRuR8pU
Thanks to Andi again.

The man who doesn't follow his vocation betrays himself and condemns himself to unhappiness.
