Platform n for the nn:nn service to xxxx

General discussion about Rail Simulator that doesn't really fit in to any specific category. A good place to start if you're not sure what category it should fit in to as well.

Moderator: Moderators

Locked
User avatar
scorpion71
Well Established Forum Member
Posts: 753
Joined: Sat Oct 30, 2004 11:37 am
Location: Around and About, Here and There

Platform n for the nn:nn service to xxxx

Post by scorpion71 »

Now this isn’t specific for a MK3 update as I know there are threads about that. No, this is just something that I think would be good in RS and I’m sure can be implemented.

I have managed to include recorded station sounds at Paddington and this gives it more realism, BUT what I think would be good would be if Sounds/Announcements could interact with written Timetabled Scenarios on a specific route.

Let’s take the Paddington-Oxford route as an example.

You would need station announcement recordings for all stations along the route, and generic sounds like:-
‘The next train to arrive at’
‘Platform’
‘The Delayed’
‘Calling at’
‘Only’ etc. etc.

Then of course numbers ‘00’ to ‘59’ and numbers say 1 to 15 (the platforms)

So, you would get something like ‘The next train to arrive at’ Platform’ ‘14’ is the’ ‘15’ ‘03’ ‘service to’ ‘Reading’ ‘calling at’ ‘Reading’ ‘only’

(Of course you could record your own voice for all of the above sounds and not the real station announcements)

When all the above is included in the route and you start your scenario, you would then hear the announcements of the departure of your train and the departure/arrival of the AI trains as it interacts with the timetabled scenario that was written – this would be especially great for any future ‘trainspotting scenarios’

I’m sure this is achievable in the future once the main fixes/upgrades of the sim are sorted.

Anyway, just an idea. Thoughts?
User avatar
AndiS
Very Active Forum Member
Posts: 6207
Joined: Fri Sep 23, 2005 4:43 pm
Location: Jester's cell in ivory tower
Contact:

Re: Platform n for the nn:nn service to xxxx

Post by AndiS »

You can do something along these lines already, using signals (which do not have a shape, but play sounds, like the semaphores already do).

The problem is the restricted knowledge about the timetable. All a signal knows is the train type (i.e., the priority as selected in the scenario editor, from special train to mineral train or something). Since you do not need all 10 classes to arrange priorities, you can use two or three different passenger classes for different destinations. So, whenever a train of class 7 comes, the platform announcement "signal" "says" "train to X". And all class 8 trains go to Y, etc..

Since signals can have lots of track links, you can put link 1 to the track at platform 1, link 2 at platform 2, etc. So you have the "at platform X" bit.

Since Lua scripts can write to file, they could also read files, most likely. I never tried it, but if it works, the speaker signal could read a whole timetable, and make guesses. E.g., if the timetable contains the train categories, it would perform the announcements for all trains of each of the 10 classes in the sequence given in the timetable. Not exactly clever, but then again, the dispatcher should not make one train of a certain class overtake another one of the same class.

If the timetable contains the starting time of the scenario in the first line, then the signals could even talk about delay. The seconds since the start of the scenario are known to them, but the world time in the scenario not.

If you have several stations, and several such announcers, then you need to distinguish the information for each of them. On way is to have a single file and give the signal location of the signal concerned with each block of information in the timetable file. Or you clone the objects, and the Lua scripts controlling them and set the filename for the timetable file for each of them as a constant in the Lua source code.

There are two caveats, though:
- Setting all of this up is not for the technically uninterested.
- There is no easy way to distinguish scenarios from the perspective of the signal.

(Digression: How to give scenario information to signal.
If you want to distinguish 5 different scenarios, you set up a track somewhere hidden, and add a "scenario reporter object". This is a signal to be written. It has link0 at some track of the normal network. Links 1-4 separate the hidden track into 5 sections. Each sections receives a destination marker "scenario 1", "scenario 2", etc. Then you place an engine on the track, and at the start of each scenario, give it a stop-at instruction with the right destination marker. I.e., at the start of scenario 3, this engine goes to marker "scenario 3". Using the track links, our reporter signal observes the move, and sends a message down the normal network "this is scneario 3". Then all the announcers know that they need to act upon section 3 in the timetable file.

Unfortunately, this is not compatible with the current signals. (The details of the limitations take quite some room, if you are interested, please PM me.)

Anyway, this is how fog signals, semaphores lit at night, signal failure or blocked track in certain scenarios, and many other lovely things will work once the core is fixed.
User avatar
scorpion71
Well Established Forum Member
Posts: 753
Joined: Sat Oct 30, 2004 11:37 am
Location: Around and About, Here and There

Re: Platform n for the nn:nn service to xxxx

Post by scorpion71 »

Hi Andis,

Your theory to do this via the signals is an interesting one, I have not dabbled in lua scripting but by having a quick browse at it via wikipedia it won't take me that long to pick it up at an intermediate stage. I work in I.T. and about 70% of my work is around VB/VBA and SQL scripting, however, that's the problem! When I come home I just want to chill and get away from all that :-?

If I was retired or won the lottery I could dedicate more time into the workings of RS and indeed, give something back to the community. Due to the lack of replies to views it seems this is something I may well have to look into myself if I want it - Oh well, my next holiday is 2weeks over Xmas, I'll try and find the time to have a dabble around! :wink:
User avatar
AndiS
Very Active Forum Member
Posts: 6207
Joined: Fri Sep 23, 2005 4:43 pm
Location: Jester's cell in ivory tower
Contact:

Re: Platform n for the nn:nn service to xxxx

Post by AndiS »

Lua is not the problem. The willingness to do debugging after a day's work is. You really must be working in IT, going by your post. :lol:
Your next holiday is just about right. By then, we should have Mk3 and know whether it fixes the AI. If yes, it will give everyone a boost and there will certainly be interested takers once you got the announcement system working. If not, no one will want to spend his spare time debugging Lua code which operates on a inaccessible kernel with random behaviour. So keep the fingers crossed, and don't forget the thrombosis prevention.
User avatar
class43HS125
Well Established Forum Member
Posts: 697
Joined: Mon Dec 17, 2007 1:56 am
Location: New Zealand

Re: Platform n for the nn:nn service to xxxx

Post by class43HS125 »

hi,
I am having a look into this idea but got lost at the point in a semaphore signal script that says...

-- play sound when animation starts!
if (newState == ANIMSTATE_ANIMTOOPEN) then
Call ("ControlSound:SetParameter", "SignalProgress", 1)
elseif (newState == ANIMSTATE_ANIMTOCLOSED) then
Call ("ControlSound:SetParameter", "SignalProgress", 0)
end

Call ("ControlSound:SetParameter", "SignalProgress", 1) goes to where? I didnt see any such reference in the possible Lua calls list . I have ended up at this because I am trying to unravel how a signal gets to play a sound. Creating the sound file and associated blue print has gone from "clear as mud" to just a bit mirky :D

Ross
http://thefraserline.blogspot.com/
RW RB Challenge 1 Here and There and Back again! uktsfile 22834
RW RB Challenge 2 This Train Goes Round and Round uktsfile 25166
RW RB Challenge 3 The Windsor Branch, a challenge to far
User avatar
AndiS
Very Active Forum Member
Posts: 6207
Joined: Fri Sep 23, 2005 4:43 pm
Location: Jester's cell in ivory tower
Contact:

Re: Platform n for the nn:nn service to xxxx

Post by AndiS »

I guess you should look at Audio\RailNetwork\Signals\Semaphore.xml. I never did, but most likely, this will link to the relevant audio files (or to files which link to the audio files).

The surprising thing is that it says ControlSound and not Sound -- the name of the child object of type sound, which refers to the XML file named above is called Sound.

I must say that I never have the sound turned on, so I cannot even tell you whether it works for the default signals.

The bottom line of the Call you quote is that there must be two sound sequences, 0 and 1, and they are triggered at these occasions (ANIMSTATE_ANIMTOOPEN is when it starts opening, i.e., the arm starts moving up, ANIMSTATE_ANIMTOCLOSED likewise for closing).

So if you love digging there, I would do this.
1) Check if you are sure to hear the moving sound if a certain signal.
2) Check the XML file of that signal and under Children find the one with ChildName Sound or similar.
3) Locate the filename at BlueprintID there, reading Audio\Network\... most likely.
4) Read the referenced file and find references to the actual sounds there.
5) Find out how to make sound files - there were some posts about it, admittedly, I never read them.
6) Create a demo sound and substitute it for the default semaphore sound.
7) Hear your sound when the semaphore arm moves and cheer.

The rest is trivial ...
User avatar
scorpion71
Well Established Forum Member
Posts: 753
Joined: Sat Oct 30, 2004 11:37 am
Location: Around and About, Here and There

Re: Platform n for the nn:nn service to xxxx

Post by scorpion71 »

Hi both,

As stated in my earlier post I have not divulged into the workings of RS due to work comittments etc., but I have since had another idea that could be easier than triggering sound from signals. The digital clocks we see on the stations must easily be able to 'talk to' the scenario scripts - I've had a quick look at a couple of the lua scripting, and from what I can see so far is the sounds are indeed being called from an XML file which the LUA file is referencing (don't quote me on this!)- looking at the few files I've browsed in lua I'm very confident I can do something with the announcements, but need more study time.

I'm going to make a copy of RS onto my works laptop and have a proper browse and look further into how I can implement this at work :wink: - BUT shhhhhhhh! Don't tell the team leader! :lol:

If RS Derek or RS Adam are reading this, I'd very much appreciate any input/help as I don't want to be wasting any time looking in wrong areas etc. Any help to point in the right direction would be very much appreciated.

Here's hoping,
Scorps.
User avatar
class43HS125
Well Established Forum Member
Posts: 697
Joined: Mon Dec 17, 2007 1:56 am
Location: New Zealand

Re: Platform n for the nn:nn service to xxxx

Post by class43HS125 »

hi,
Curiosity got the better of me.................
anybody made any discoveries along this line?

Ross
NZ
http://thefraserline.blogspot.com/
RW RB Challenge 1 Here and There and Back again! uktsfile 22834
RW RB Challenge 2 This Train Goes Round and Round uktsfile 25166
RW RB Challenge 3 The Windsor Branch, a challenge to far
User avatar
scorpion71
Well Established Forum Member
Posts: 753
Joined: Sat Oct 30, 2004 11:37 am
Location: Around and About, Here and There

Re: Platform n for the nn:nn service to xxxx

Post by scorpion71 »

I've let looking into things slip a little I must admit - I was hoping to copy some files onto my works laptop and have a few sneaky moments look and divulge! - but due to workload I haven't had a chance - I guess my original plan of Xmas will have to stick
User avatar
class43HS125
Well Established Forum Member
Posts: 697
Joined: Mon Dec 17, 2007 1:56 am
Location: New Zealand

Re: Platform n for the nn:nn service to xxxx

Post by class43HS125 »

Hi,
I am trying to get a sound file to play when the train goes past.
I have set up an audio control, a sound blueprint, a sound marker, a detecting object with a track link0, using a signal blueprint, to trigger the sound file in its lua script in the "OnConsistPassing". So far so good. In RS when I place the detecting object, the sound marker is visible and when I run the game I can get debug responces from the lua script indicating what section of the code is being accessed as the train moves over the link0. I Can even get its speed, have to hold on to the little bits of progress here :wink: because the plan is that if the train is not going to stop then no sound is required. Can even get Class of Service, to use to determine what sound to play, or even what destination to display on a Passenger Information Display depending on a predefined table which would be very much route specific but thats another project.
At this point I loose the plot.......
I have looked at the semaphore signal lua to find out how that runs a sound when the signal changes and came across....

-- Play the appropriate sound when the animation starts!
if (newState == ANIMSTATE_ANIMTOOPEN) then
Call ("ControlSound:SetParameter", "SignalProgress", 1)
elseif (newState == ANIMSTATE_ANIMTOCLOSED) then
Call ("ControlSound:SetParameter", "SignalProgress", 0)
end

stripping off the project unrelated parts leaves me with..
Call ("ControlSound:SetParameter", "SignalProgress", 1)

Putting this into the script appears to achieve nothing, even with toggling the 1/0 to cause the change of state that triggers the SignalProgress controller

I can find the "SignalProgress" connection back to the sound blueprint. Can figure that the 1 / 0 is the changing condition that will cause the sound to trigger.
but what is the "ControlSound:SetParameter" ? What does it relate to? How is it accessed, if at all?
Is it simply referring to its own child and telling it to Set its self as per the SignalProgress control?

(yes. this is posted on the railsim devdoc forum, but nothing :( )
A clue or two would be much appreciated while I bash away at the brick wall :-)
Ross
NZ
http://thefraserline.blogspot.com/
RW RB Challenge 1 Here and There and Back again! uktsfile 22834
RW RB Challenge 2 This Train Goes Round and Round uktsfile 25166
RW RB Challenge 3 The Windsor Branch, a challenge to far
User avatar
AndiS
Very Active Forum Member
Posts: 6207
Joined: Fri Sep 23, 2005 4:43 pm
Location: Jester's cell in ivory tower
Contact:

Re: Platform n for the nn:nn service to xxxx

Post by AndiS »

What does 'Call ("ControlSound:SetParameter", "SignalProgress", 1)' mean?
In principle, this means "Call function SetParameter in object ControlSound with arguments SignalProgress and 1.
In practice, I am a bit confused here, because the ChildName in the XML file is Sound, not ControlSound. But at any rate, it is safe to assume that you need something like this in your XML file of your "signal".

At the end of your signal XML file, you need this:

Code: Select all

<_container>
	<cEntityContainerBlueprint>
		<Children>
			<cEntityContainerBlueprint-sChild d:id="15355136">
				<ChildName d:type="cDeltaString">Sound</ChildName>
				<BlueprintID>
					<iBlueprintLibrary-cAbsoluteBlueprintID>
						<BlueprintSetID>
							<iBlueprintLibrary-cBlueprintSetID>
								<Provider d:type="cDeltaString">Kuju</Provider>
								<Product d:type="cDeltaString">RailSimulator</Product>
							</iBlueprintLibrary-cBlueprintSetID>
						</BlueprintSetID>
						<BlueprintID d:type="cDeltaString">Audio\RailNetwork\Signals\Semaphore.xml</BlueprintID>
					</iBlueprintLibrary-cAbsoluteBlueprintID>
				</BlueprintID>
				<Matrix>
					<cHcRMatrix4x4>
						<Element/>
					</cHcRMatrix4x4>
				</Matrix>
			</cEntityContainerBlueprint-sChild>
		</Children>
	</cEntityContainerBlueprint>
</_container>
The only lines following this are:

Code: Select all

		</cSignalBlueprint>
	</Blueprint>
</cBlueprintLoader>
Then, you need your version of Audio\RailNetwork\Signals\Semaphore.xml. This is not the exported Audio Blueprint, but some intermediate file. It does nothing but point to SemaphoreAudioControl, which is a pair of files with extensions .proxyxml and .proxybin which I understand are the exported Audio Blueprint. SemaphoreAudioControl.proxyxml points to S_Signal.dav which is the actual sound wave file.

From your post I assume that you already made a Audio Blueprint for your sound and exported it.

So, from the above, I would recommend the following setup for your case:

If you have not already done so, add the _container bit I listed above.
Keep ChildName Sound, but adapt Provider, Product, BlueprintID, the latter pointing to MySound.
Copy Audio\RailNetwork\Signals\Semaphore.xml to MySound, edit it to do the obvious renaming and make sure that ProxyName is MyAudioBlueprint, where MyAudioBlueprint is the Audio Blueprint you created from the sound file. All with correct path, of course.

In your script, the second parameter ("SignalProgress") must match the ControllerName in your Audio Blueprint.

If it does not work immediately, try changing
Call ("ControlSound:SetParameter", "SignalProgress", 1)
to
Call ("Sound:SetParameter", "SignalProgress", 1)

You say, you created a sound object and placed it. I guess that would be appropriate for ambient sound, for signals you certainly don't need it. (Well, certainly I hear me saying, I never tested this, this is all guesswork ...)
Locked

Return to “[RS] General RS Discussion”