"Lua Scripting for Train Simulator: An Overview"

General discussion about Train Simulator, your thoughts, questions, news and views!

Moderator: Moderators

User avatar
crumplezone
Very Active Forum Member
Posts: 2276
Joined: Sat Mar 27, 2010 7:53 pm

Re: "Lua Scripting for Train Simulator: An Overview"

Post by crumplezone »

Well if anyone interested in Lua then the following can help:

http://lua-users.org/wiki/TutorialDirectory - generalised Lua tutorials and other useful information.
http://www.lua.org/docs.html - Lua reference documentation and covers books you can purchase.

TS related stuff:

https://docs.google.com/document/d/19gn ... edit?pli=1 - google doc linked earlier in thread.

http://www.railsimdownloads.com/wiki/tiki-index.php - Rail simulator dev documentation which is still revelant in certain areas, it could do with a general spruce up.

Lua is part of what is needed but as rightfully said you also need to learn what the blueprints do which quite frankly isn't particularly documentated very well either. It is worthwhile looking into the blueprints to see what files references where as the .bin files run most of what works in the simulator to date, the lua scripting tends to work off this to a certain degree to but you need to end up understand why the blueprint does this or that before other bits.

I wouldn't say its super hard to learn what the blueprints do mind, I figured out the fair bit of the sound blueprints and how they interact with each other and what the sound system is actually doing prior to being brought on as a tester with SSS. Can't say I know everything but you can learn abit by just fiddling with things and as long as you backup you can trial and error.

It would be nice to have some documentation on what blueprints are doing sometimes and how it interacts with the sim. A example being was with how the priority system works on sound, it runs on a scaled priority system of 1-10 but there is little information on weather or not 1 means lower priority or 1 means highest priority, I eventually found it out myself but it would have saved alot of time of the documentation had been available in the first place. Also back prior to openAL sound being added to TSXX there was zero information on how many sounds could be set to the highest priority before the sounds would start to kill each other off. It was important to know such information prior to openAL as the priority system dictated how sounds would play and it was why for a time steam locos suffered silent bob syndrome.

Quite frankly at this point unless they have folks who are working at DTG who worked with Kuju I really don't think DTG know as much as they would like to, they even admitted they have lost the ability to read the error files which TS2014 produces.

I would agree its not going to be the holy grail people will be expecting but I cannot equally agree that the current pool of 3rd party developers know everything either. DTG and when they were RSC probably did give out information in various forms over the years but to say they gave everything out would be somewhat folly.

But playing devil advocate, 3rd party developers have always introduced new features to rolling stock when DTG/RSC haven't and its always been 3rd party who were quite frankly more advanced and its the general comments I get from devs I've been able to chat with. So ultimately there actually might not be a whole lot DTG will be able to give folks, scenario scripting might give some much needed information but in the end run there might be not much else for the loco side considering what 3rd party developers have been able to achieve. One could say the DVT by waggonz is a good example, DTG really didn't have a clue how to do a DVT and its only really been after the class 90 and its DVT has come out that DTG seemed to have got the clue and released the 225 set.

Anyhow thats my opinion on things, the links above should help to a certain degree with lua and what is currently available to devs and if there is more from DTG or other devs have it but don't want to show it then thats up to them.
User avatar
rfletcher72
Very Active Forum Member
Posts: 8643
Joined: Sat Apr 28, 2007 10:59 pm
Location: The Steel City
Contact:

Re: "Lua Scripting for Train Simulator: An Overview"

Post by rfletcher72 »

DG have had the ability to simulate a DVT for a while now, since around the time the rear power cars on the HST's stopped being silent :wink: ,

Regards,
Richard
User avatar
Irishrailguy
Very Active Forum Member
Posts: 1338
Joined: Sun Mar 21, 2010 8:58 pm
Location: Dublin, Ireland

Re: "Lua Scripting for Train Simulator: An Overview"

Post by Irishrailguy »

rfletcher72 wrote:DG have had the ability to simulate a DVT for a while now, since around the time the rear power cars on the HST's stopped being silent :wink: ,

Regards,
As far as I'm aware that was just them upgrading the game so that some control's values were sent down the consist and set equally on all other power units in the consist. You can do that with any top 'n tailed train now anyway, stick a 47 at the end of your rake and it's throttle will adjust to match what you're applying.

And didn't Dave and Chris do a far better job with their DVT than what DTG have provided so far? It's a good point being made by crumplezone that the benchmark has nearly always been made by 3rd party content. So there can't really be much that we're missing from the docs if the community can produce a level of quality unseen by most DTG content. Although I do consider that DTG is a time-constrained company with employees and targets, not enthusiasts that want the highest detail level regardless of the commitment required.

Kev
gptech
Very Active Forum Member
Posts: 19585
Joined: Fri Oct 10, 2008 5:48 pm
Location: Wakefield, West Yorkshire

Re: "Lua Scripting for Train Simulator: An Overview"

Post by gptech »

Irishrailguy wrote:With regards to what Gary said, there can be devs who allude to the ability to do something via scripting and deliberately hold back, but aside from ego there are many reasons why they won't just throw code out to the subject....
In any case Gary, I don't think it's fair to say that those who can use Lua on this forum are being elitist about their skill set. It's not as easy as throwing code up for someone because they want to do something with TS
Fair points, but nobody is (as yet) asking for anybody to knock together a complicated chunk of scripting to do XYZ, but rather some 'starting point' at which to begin learning. The start of the thread was a call for others to respond to the RSC article expressing that we'd like the documentation to be made available; if it's too complicated for many then they'll walk away but those with a little more 'staying power' will use it as the first rung. I doubt anybody contributing to this thread is expecting to read the docs and then script a complete in cab signalling system before bed time, but they'd relish the opportunity to learn a bit more about how this thing works.
MaikG wrote:Best example that a code snippet doesn't work stays in the post of jalmar about the weather event chain. It helps nothing to have a code snippet. You need to understand the technices behind. So for the weather event chain you have to know how the chains and the weather itself works in TS. All extended functionality in TS is not only in LUA code, but also in blueprints and so on.
So that would be the next request for documents, tips, advice.

Thanks for those links crumplezone,
crumplezone wrote:Quite frankly at this point unless they have folks who are working at DTG who worked with Kuju I really don't think DTG know as much as they would like to, they even admitted they have lost the ability to read the error files which TS2014 produces
I'm sure Derek posted in here a long, long time ago that they brought in guys from Kuju when really low level stuff needed doing and I've thought for a long time that RSC don't (or at least didn't at the time) have the coding skills 'in-house'.
Locked

Return to “[TS] General Discussion”