BVE WorldWide
Would you like to react to this message? Create an account in a few clicks or log in to continue.

How do you have a working track follower to the route?

+3
mrknowitall
S520
Tadek40
7 posters

Go down

How do you have a working track follower to the route? Empty How do you have a working track follower to the route?

Post by Tadek40 Sun Dec 03, 2017 12:57 pm

Hi all. This is my first post. I have a problem. I wan to having on the Polish route track follower. Reading all threads related to this and I did it. I created the file needed to make Husarz luzak.animated and typed in accordance with the instructions.
[Object]
position = -4,0,0
States = PKP\Siemens ES64U4 Taurus\ext_view\ES64U4.B3D
StateFunction = if[value + delta > 20, -1,0]
TrackFollowerFunction = if[value == 0, value + 1000, if[trackdistance > -200,if[value < 0, value, value - 10 * delta], value]]
Launch in Openbve Poc_Os.RW and I can not see this train anywhere. And I do not know what this track follower has to be typed in the route file or whether to go in the folder to give the route. 
I do not know what to do to make the track follower work. Help me. Sad Cheers.

Tadek40

Posts : 2
Join date : 2017-12-03
Age : 20
Location : Poland :)

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by leezer3 Sun Dec 03, 2017 7:06 pm

That looks approximately right.

I assume you've placed your object in the world?
It needs to be placed as a .freeobj command, and won't just appear Smile

Other than that, the following sequence should happen:

  • Your object is first loaded by the renderer (e.g. If you place the object at 1,000m and have a viewing distance of 500m, it will first be loaded when the player reaches 500m)
  • It is moved 1000m along the line
  • It should then move back towards the player
  • After 20s, it'll vanish


A couple of basic things to check:

  • This only works in openBVE, not Route Viewer.
  • You've definitely got your object path right (No errors in the log file)

leezer3

Posts : 1978
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by Tadek40 Sun Dec 03, 2017 7:59 pm

I have worked a little and the effect is satisfying. Thank you Wink

Tadek40

Posts : 2
Join date : 2017-12-03
Age : 20
Location : Poland :)

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by mrknowitall Sun Aug 11, 2019 3:41 pm

Code:
Position = 8.5,0,0
StateFunction = if[value + delta > 100, -1,0]
TrackFollowerFunction = if[value == 0, value + 250, if[trackdistance > -150,if[value < 0, value, value - 10 * delta], value]]



this code works fine in terms of an approaching train into a station, but how would i add the correct code for the train to progressively slow down? rather than an immediate stop from 15mph or so.
mrknowitall
mrknowitall

Posts : 824
Join date : 2011-07-09
Age : 32
Location : W. Yorkshire

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by leezer3 Mon Aug 12, 2019 11:25 am

Short answer is not easily Razz

TrackFollowingObjects (essentially a lightweight AI train) are a little more suited to this, but are a somewhat more recent addition:
https://openbve-project.net/documentation_hugo/en/routes/xml/trackfollowingobject.html

leezer3

Posts : 1978
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by mrknowitall Mon Aug 12, 2019 12:11 pm

leezer3 wrote:Short answer is not easily Razz

TrackFollowingObjects (essentially a lightweight AI train) are a little more suited to this, but are a somewhat more recent addition:
https://openbve-project.net/documentation_hugo/en/routes/xml/trackfollowingobject.html


From the link provided, would that mean i dont use the .animated file and switch to a XML instead?
mrknowitall
mrknowitall

Posts : 824
Join date : 2011-07-09
Age : 32
Location : W. Yorkshire

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by S520 Mon Aug 12, 2019 9:44 pm

No.
Specify the train folder with the Train attribute in XML.
The train folder contains train.dat, sound.cfg and extensions.cfg like a normal train.

Please see the thread below for a concrete sample.
https://bveworldwide.forumotion.com/t1770-openbve-1-6-0-train-coupling-full-animation-demo-of-tohoku-shinkansen-at-morioka-series-e5-and-e6-using-the-trackfollowingobject
S520
S520

Posts : 113
Join date : 2018-08-24
Location : Japan

https://github.com/s520

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by mrknowitall Mon Aug 12, 2019 9:46 pm

S520 wrote:No.
Specify the train folder with the Train attribute in XML.
The train folder contains train.dat, sound.cfg and extensions.cfg like a normal train.

Please see the thread below for a concrete sample.
https://bveworldwide.forumotion.com/t1770-openbve-1-6-0-train-coupling-full-animation-demo-of-tohoku-shinkansen-at-morioka-series-e5-and-e6-using-the-





Your concrete example doesn’t show code only a video, can you spare the time to dum it down so that new developers as such can understand it? I haven’t really dabbled with XML before and cannot find a detailed explanation of what goes where etc.
mrknowitall
mrknowitall

Posts : 824
Join date : 2011-07-09
Age : 32
Location : W. Yorkshire

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by S520 Mon Aug 12, 2019 9:51 pm

I'm sorry.
I did n’t review the posts well.
Did you see the page shown by leezer3?
Specific examples can be found in the Basic Principles section.
S520
S520

Posts : 113
Join date : 2018-08-24
Location : Japan

https://github.com/s520

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by mrknowitall Mon Aug 12, 2019 9:53 pm

Yeah I did but I presumed that was for a .animated file? Are we still talking about animated files or XML like keeper states above?
mrknowitall
mrknowitall

Posts : 824
Join date : 2011-07-09
Age : 32
Location : W. Yorkshire

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by S520 Mon Aug 12, 2019 9:55 pm

.animated is referenced from extensions.cfg.
S520
S520

Posts : 113
Join date : 2018-08-24
Location : Japan

https://github.com/s520

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by S520 Mon Aug 12, 2019 9:57 pm

If you wish, have my friend provide a concrete sample, what do you do?
S520
S520

Posts : 113
Join date : 2018-08-24
Location : Japan

https://github.com/s520

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by mrknowitall Tue Aug 13, 2019 8:31 am

S520 wrote:If you wish, have my friend provide a concrete sample, what do you do?


The code I placed above enables a train to approach the starting point of a route and stop at a platform. But it goes from 5mph to 0mph without slowing down first. I see in your video your trains stops gradually. I’m wishing to know the code or learn what code goes where in relation to the animated file. And an explanation of the XML file, as to date, I have not had any experience with XML files so unsure where to place them or how to relate to them in a route file etc.
mrknowitall
mrknowitall

Posts : 824
Join date : 2011-07-09
Age : 32
Location : W. Yorkshire

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by S520 Tue Aug 13, 2019 10:33 am

I asked my friend to post a sample on the forum.
It seems that it takes several days to post for translation.
This is open to the Japanese community.

Well, before that, I want to answer your questions as much as possible.
First, the previous video uses a different file than the document example.
The following is an example of file placement.

Code:
Railway---route---ExampleRoute-+-ExampleRoute.csv
                                                           |
                                                           +-Example.xml
                                                           |
                                                           +-ExampleTrain-+-train.dat
                                                                                         |
                                                                                         +-extensions.cfg
                                                                                         |
                                                                                         +-sound.cfg
                                                                                         |
                                                                                         +-Example.animated

The syntax for specifying XML from a route file is as follows:
Code:
Route.TfoXml("Relative path to the xml file")

Finally thanks for your interest in this feature.
I am very happy as a developer.
S520
S520

Posts : 113
Join date : 2018-08-24
Location : Japan

https://github.com/s520

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by leezer3 Tue Aug 13, 2019 11:24 am

First, thanks to S520 for this feature Smile

I'm not sure if I'll confuse things further or not, but let's start.....

A TrackFollowingObject is essentially a lightweight AI train, which may run on any rail defined in a route.
This feature is controlled by an XML file.

The first thing we need to do is to create our XML file, which defines how the object behaves.
Let's take the example from the page linked above:
Code:
<?xml version="1.0" encoding="utf-8"?>
<openBVE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <TrackFollowingObject>
    <Definition>
      <!--Time when the object appears[hh.mmss]-->
      <AppearanceTime>00.0100</AppearanceTime>
      <!--In-game distance of the starting point at which the object appears[m]-->
      <AppearanceStartPosition>50</AppearanceStartPosition>
      <!--In-game distance of the end point at which the object appears[m]-->
      <AppearanceEndPosition>100</AppearanceEndPosition>
      <!--The duration for which the object appears[hh.mmss]-->
      <LeaveTime>00.0500</LeaveTime>
    </Definition>
    <Train>
      <!--Relative path of Train folder-->
      <Directory>TrainDirectory</Directory>
    </Train>
    <Stops>
      <!--Start-->
      <Stop>
        <!--Deceleration[km/h/s]-->
        <Decelerate>0.0</Decelerate>
        <!--In-game distance of stop position[m]-->
        <StopPosition>200</StopPosition>
        <!--Door that open at this point-->
        <Doors>1</Doors>
        <!--Time to keep stopping[hh.mmss]-->
        <StopTime>00.0020</StopTime>
        <!--Acceleration[km/h/s]-->
        <Accelerate>1.71</Accelerate>
        <!--Speed after acceleration[km/h]-->
        <TargetSpeed>30</TargetSpeed>
        <!--Progress direction [1: forward, -1: backward]-->
        <Direction>1</Direction>
        <!--Traveling track-->
        <Rail>2</Rail>
      </Stop>
      <!--Maximum speed change-->
      <Stop>
        <Decelerate>0</Decelerate>
        <StopPosition>400</StopPosition>
        <StopTime>00.0000</StopTime>
        <Accelerate>0</Accelerate>
        <TargetSpeed>60</TargetSpeed>
        <Direction>1</Direction>
        <Rail>2</Rail>
      </Stop>
      <!--Return-->
      <Stop>
        <Decelerate>1.71</Decelerate>
        <StopPosition>1000</StopPosition>
        <Doors>B</Doors>
        <StopTime>00.0010</StopTime>
        <Accelerate>1.71</Accelerate>
        <TargetSpeed>30</TargetSpeed>
        <Direction>-1</Direction>
        <Rail>1</Rail>
      </Stop>
      <!--Goal-->
      <Stop>
        <Decelerate>1.71</Decelerate>
        <StopPosition>200</StopPosition>
        <Doors>R</Doors>
        <StopTime>00.0030</StopTime>
        <Accelerate>0</Accelerate>
        <TargetSpeed>0</TargetSpeed>
        <Direction>1</Direction>
        <Rail>1</Rail>
      </Stop>
    </Stops>
  </TrackFollowingObject>
</openBVE>

Working downwards, we first have the definition of when the object should appear:
Code:
<Definition>
      <!--Time when the object appears[hh.mmss]-->
      <AppearanceTime>00.0100</AppearanceTime>
      <!--In-game distance of the starting point at which the object appears[m]-->
      <AppearanceStartPosition>50</AppearanceStartPosition>
      <!--In-game distance of the end point at which the object appears[m]-->
      <AppearanceEndPosition>100</AppearanceEndPosition>
      <!--The duration for which the object appears[hh.mmss]-->
      <LeaveTime>00.0500</LeaveTime>
</Definition>

This should be relatively self-explanatory- The object should appear at 1 minute past midnight, if our camera position is between 50m and 100m. It will then be visible for 5 minutes before disappearing.

Our second definition is that of the train folder:
Code:
<Train>
      <!--Relative path of Train folder-->
      <Directory>TrainDirectory</Directory>
</Train>

It will search both the OpenBVE train folder, and the Object folder if the train does not exist there. Again, relatively self-explanatory.

The final section defines a set of steps to control what the train actually does:
Code:
<Stops>
      <!--Start-->
      <Stop>
        <!--Deceleration[km/h/s]-->
        <Decelerate>0.0</Decelerate>
        <!--In-game distance of stop position[m]-->
        <StopPosition>200</StopPosition>
        <!--Door that open at this point-->
        <Doors>1</Doors>
        <!--Time to keep stopping[hh.mmss]-->
        <StopTime>00.0020</StopTime>
        <!--Acceleration[km/h/s]-->
        <Accelerate>1.71</Accelerate>
        <!--Speed after acceleration[km/h]-->
        <TargetSpeed>30</TargetSpeed>
        <!--Progress direction [1: forward, -1: backward]-->
        <Direction>1</Direction>
        <!--Traveling track-->
        <Rail>2</Rail>
      </Stop>
      <!--Maximum speed change-->
      <Stop>
        <Decelerate>0</Decelerate>
        <StopPosition>400</StopPosition>
        <StopTime>00.0000</StopTime>
        <Accelerate>0</Accelerate>
        <TargetSpeed>60</TargetSpeed>
        <Direction>1</Direction>
        <Rail>2</Rail>
      </Stop>
      <!--Return-->
      <Stop>
        <Decelerate>1.71</Decelerate>
        <StopPosition>1000</StopPosition>
        <Doors>B</Doors>
        <StopTime>00.0010</StopTime>
        <Accelerate>1.71</Accelerate>
        <TargetSpeed>30</TargetSpeed>
        <Direction>-1</Direction>
        <Rail>1</Rail>
      </Stop>
      <!--Goal-->
      <Stop>
        <Decelerate>1.71</Decelerate>
        <StopPosition>200</StopPosition>
        <Doors>R</Doors>
        <StopTime>00.0030</StopTime>
        <Accelerate>0</Accelerate>
        <TargetSpeed>0</TargetSpeed>
        <Direction>1</Direction>
        <Rail>1</Rail>
      </Stop>
</Stops>

This is a little more complex, but still hopefully relatively easy to follow.
There are a total of 4 {Stop} sections in this part.
Each one represents on action for the object to perform.

Let's take the first:
Code:
<Stop>
        <!--Deceleration[km/h/s]-->
        <Decelerate>0.0</Decelerate>
        <!--In-game distance of stop position[m]-->
        <StopPosition>200</StopPosition>
        <!--Door that open at this point-->
        <Doors>1</Doors>
        <!--Time to keep stopping[hh.mmss]-->
        <StopTime>00.0020</StopTime>
        <!--Acceleration[km/h/s]-->
        <Accelerate>1.71</Accelerate>
        <!--Speed after acceleration[km/h]-->
        <TargetSpeed>30</TargetSpeed>
        <!--Progress direction [1: forward, -1: backward]-->
        <Direction>1</Direction>
        <!--Traveling track-->
        <Rail>2</Rail>
</Stop>

As this is the first instruction, the absolute track position where the object first appears is controlled here:
{StopPosition}200{/StopPosition}
In subsequent {Stop} sections, this then controls the target destination for the AI to move to.

You'll note the {Decelerate}0.0{/Decelerate} value above this- This means that our AI will start stopped, as opposed to in motion.

{Doors}1{/Doors}  is easy, and just controls the side the doors will open. (And will therefore be displayed on the train objects via the animated file)

Next is {StopTime}00.0020{/StopTime} and again, this is straightforward, defining the time to remain stopped (20s).


The final part of this instruction controls the behaviour of the AI *after* it has stopped.

{Accelerate}1.71{/Accelerate} - This controls how fast the AI will accelerate in km/h/s

{TargetSpeed}30{/TargetSpeed} - The target speed for the AI to reach is 30km/h, after which it will stop accelerating. (Note: If a subsequent instruction is hit, the train will not necessarily get to this speed)

{Direction}1{/Direction} - Easy, we're going forwards Razz

{Rail}2{/Rail} - Again easy, we're running on Rail 2.



The subsequent {Stop} sections just add additional waypoints for the AI to follow.
When the last waypoint is reached, it'll continue following the instructions in this until it is removed by the {LeaveTime} in the first section.


NOTE:
I've had to replace the < & > with curly braces in the text here to stop the forum software eating them....

leezer3

Posts : 1978
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by Midnight Express Ginga81 Wed Aug 14, 2019 6:06 am

This is a sample TFO route data for OpenBVE1.6.0.
It needs to run for my Tohoku-Shinkansen's Object and route(for object check).
Please read readme.txt.
My route is created by UTF-8.
Please do not use WINZIP, use 7-zip.
https://www.7-zip.org/

This demo is parallel dual lines, the opposite side's TFO train moves from final station to begining station.
stopping and door operation, and finally, back to the final station.
I wrote how to create several stations and stop at each station, and how to change to the rails.
Please read XML file's comment.
Attachments
How do you have a working track follower to the route? Attachment
TFO_train_passing_each_other_Demo.zip You don't have permission to download attachments.(36 Kb) Downloaded 35 times

Midnight Express Ginga81

Posts : 154
Join date : 2016-09-25

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by S520 Wed Aug 14, 2019 1:33 pm

Dear Mr. mrknowitall,
My friend Ginga81 prepared a sample of TFO.
Please try the sample.
S520
S520

Posts : 113
Join date : 2018-08-24
Location : Japan

https://github.com/s520

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by mrknowitall Wed Aug 14, 2019 2:19 pm

S520 wrote:Dear Mr. mrknowitall,
My friend Ginga81 prepared a sample of TFO.
Please try the sample.


As soon as I get home I will, thankyou! Smile
mrknowitall
mrknowitall

Posts : 824
Join date : 2011-07-09
Age : 32
Location : W. Yorkshire

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by Phonteus Nevolius Sun Jan 19, 2020 11:16 am

Chris, in your previus post you said about the {directory} entry:

It will search both the OpenBVE train folder, and the Object folder if the train does not exist there. Again, relatively self-explanatory.

In my experience OpenBVE couldn't find the AI trains in the Object folder, and it crashed. Neither could it find them if they were in the root of the Object folder nor if they were in a subdirectory.

This seems to be true for any recent OpenBVE version.
Phonteus Nevolius
Phonteus Nevolius

Posts : 120
Join date : 2017-10-05
Location : Hungary

https://phonteusnevolius.wordpress.com

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by leezer3 Sun Jan 19, 2020 7:58 pm

You're entirely right.

Updated it to match the documentation, and fixed the crashing.....

There will be another version 'soon' to squeeze a bit more performance out of the new renderer, hopefully get the old renderer back to where it was (on my list to look at this week) and deal with a few more miscellaneous bits and pieces.

leezer3

Posts : 1978
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by kwchan Fri Feb 14, 2020 2:40 pm

Midnight Express Ginga81 wrote:This is a sample TFO route data for OpenBVE1.6.0.
It needs to run for my Tohoku-Shinkansen's Object and route(for object check).
Please read readme.txt.
My route is created by UTF-8.
Please do not use WINZIP, use 7-zip.
https://www.7-zip.org/

This demo is parallel dual lines, the opposite side's TFO train moves from final station to begining station.
stopping and door operation, and finally, back to the final station.
I wrote how to create several stations and stop at each station, and how to change to the rails.
Please read XML file's comment.
When I start this route, the openBVE programme (version v1.7.1.0)cannot run.

kwchan

Posts : 3
Join date : 2012-08-04

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by Phonteus Nevolius Fri Feb 14, 2020 11:09 pm

OpenBVE 1.7.1.0 crashes if it cannot find the XML based TFO trains. In that version of OpenBVE they must be in the Train folder and they must be linked from there in the .xml files (meaning simply inputting the directory names, without anything else from the folder structure).

NB: Newer development versions of OpenBVE can find XML based TFO trains in other places as well.
Phonteus Nevolius
Phonteus Nevolius

Posts : 120
Join date : 2017-10-05
Location : Hungary

https://phonteusnevolius.wordpress.com

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by Midnight Express Ginga81 Sat Feb 15, 2020 3:32 pm

Hello, mr.kwchan.
What way were you install Series-E6 and TFO demo route?

I can't recognize what happened your error by your question.
Please upload errorlog. 
How to:
Please push OpenBVE's mainmenu, at left under's button 'Report Problem'.
Press 'Report Problem' button.
OpenBVE create a .zip file.
Upload zip file.

Midnight Express Ginga81

Posts : 154
Join date : 2016-09-25

Back to top Go down

How do you have a working track follower to the route? Empty Re: How do you have a working track follower to the route?

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum