[Mod] Advanced Trains [advtrains] [2.4.3]

W3RQ01
Member
Posts: 157
Joined: Sat Nov 28, 2020 06:33
GitHub: W3RQ01
In-game: Dario23 or W3RQ01
Contact:

Re: Re: London Underground subway

by W3RQ01 » Post

yw05 wrote:
Tue Jan 10, 2023 11:47
[*] Only the locomotive can be painted.
Added the wagon
yw05 wrote:
Tue Jan 10, 2023 11:47
[*] The small area above the external display is (awkwardly) not painted. (See attachment)
I did not add that area on purpose since it's darker than the original red. I'd like to find a way to still make it darker than the rest.
yw05 wrote:
Tue Jan 10, 2023 11:47
The visual line number display mod might be useful for the external display.
Yeah and implementation for that style could be helpful
OneUnitedPower

yw05
Member
Posts: 366
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.4.1]

by yw05 » Post

56independent_actual wrote:
Tue Jan 10, 2023 18:37
yw05 wrote:
Tue Jan 10, 2023 18:32
Sending LuaATC code to trains is outside the scope of signaling and doing so from signals is particularly problematic in terms of security (as interlocking seems to be considered to be safer than LuaATC in terms of potential damage)
The idea is to say what LuaATC code to send from the aspect definition itself, with maybe a view values coming from drop-down fields.

This way, you can say, use something like atc_send_tsr(ARGV[1]). 1 is the value of the first dropdown field.
I partly understand the need of sending LuaATC code to trains from LuaATC tracks. I recall some similar discussions, although not on this forum. The main thing to consider there is that you need to send the code as plaintext (instead of functions - so that the information can be saved across server restarts)

However, sending LuaATC via signals is IMO not sensible because signals are not made for this purpose. Use LuaATC tracks.
Last edited by yw05 on Tue Jan 10, 2023 18:54, edited 1 time in total.

yw05
Member
Posts: 366
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: Re: London Underground subway

by yw05 » Post

W3RQ01 wrote:
Tue Jan 10, 2023 18:41
yw05 wrote:
Tue Jan 10, 2023 11:47
[*] The small area above the external display is (awkwardly) not painted. (See attachment)
I did not add that area on purpose since it's darker than the original red. I'd like to find a way to still make it darker than the rest.
Perhaps you could try to add a custom step function to overlay that area with a semi-transparent black texture? I have not tried that myself though.

User avatar
Blockhead
Member
Posts: 1622
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: Re: London Underground subway

by Blockhead » Post

W3RQ01 wrote:
Tue Jan 10, 2023 18:41
I did not add that area on purpose since it's darker than the original red. I'd like to find a
yw05 wrote:
Tue Jan 10, 2023 18:53
Perhaps you could try to add a custom step function to overlay that area with a semi-transparent black texture? I have not tried that myself though.
It's not necessary to do that work inside the on_step. Nor it is necessary to use special-purpose textures. Simply make it a part of the texture-string-forming code to add a texture overlay for the first layer, followed by another texture overlay with a multiply filter of semitransparent black.

So part of the set_livery function would look like so (texture names are fictional):

Code: Select all

local livtex -- livery texture
livtex = "tfl_base.png"
livtex = livtex .. "^(tfl_layer2.png^[colorize:" .. bikepaintercolour .. ")"
livtex = livtex .. "^(tfl_layer3.png^[colorize:" .. bikepaintercolour .. "^[multiply:#00000088)"
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

User avatar
56independent_actual
Member
Posts: 452
Joined: Sun May 23, 2021 16:10
IRC: independent56
In-game: 56independent
Location: Girona Province
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.1]

by 56independent_actual » Post

💥🚄
Last edited by 56independent_actual on Sun Jan 15, 2023 16:18, edited 1 time in total.
Warnig: Al my laguage ekscept English is bad, includig Hungarian (magyàränoлиски), Spanish (esпagnyoл), and Russian (рÿсскïанöл).

yw05
Member
Posts: 366
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.4.1]

by yw05 » Post

56independent_actual wrote:
Wed Jan 11, 2023 06:02
yw05 wrote:
Tue Jan 10, 2023 18:52
However, sending LuaATC via signals is IMO not sensible because signals are not made for this purpose. Use LuaATC tracks.
LuaATC acts as the driver; executing logic based on info about their train. "Do i have x carriages? Maybe i use the top number.". This works well within the paradigm of advtrains. For example, we could also have a sign based off Weather, like "5 m/s whilst raining on this mountain climb", where the mod might use the weather mod API.
That sounds closer to an XY problem. You want the train to respond in a certain way when it approaches or passes a specific signal, and LuaATC does not need to be involved in this process at all. Instead, IMO a better solution is to allow mods that provide such signals to define these callbacks. Then the main advantage is that servers (and players working on different LuaATC environments) do not have to implement these features independently.

User avatar
56independent_actual
Member
Posts: 452
Joined: Sun May 23, 2021 16:10
IRC: independent56
In-game: 56independent
Location: Girona Province
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.1]

by 56independent_actual » Post

💥🚄
Last edited by 56independent_actual on Sun Jan 15, 2023 16:18, edited 1 time in total.
Warnig: Al my laguage ekscept English is bad, includig Hungarian (magyàränoлиски), Spanish (esпagnyoл), and Russian (рÿсскïанöл).

User avatar
Blockhead
Member
Posts: 1622
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.1]

by Blockhead » Post

56independent_actual wrote:
Wed Jan 11, 2023 11:28
I'm stuck with the train table. I've tried grepping for "train" (DO NOT RECCOMEND LMAO (it broke my terminal and forced me to re-install my Bash 32 bit emulator)), "train table", "train", "train keys", "train = {" and for "self:train", but i can't seem to find any explanation of the keys and what they're used for. Not even a definition of the table.

I've had a look at assets/doc/tex for some filenames which might help. None did. Even looking on the wiki for "train table" didn't work.

Where can i find documentation for the train table?
You are looking for advtrains.trains (plural). It's indexed by train IDs, which you can show with in-game infotext by configuring advtrains_show_ids in your minetest.conf. I'm not sure there is any central documentation on the mess of fields under each train ID, since it's kind of a free-for-all from various modules. I recommend you install the QA Block mod because it's really helpful for navigating the global Lua space and figuring things out.

Oh also, when grepping somewhere you might find binary files (even though I thought grep was supposed to just print "binary file"..), you might try adding --include=*.lua to your command line.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

User avatar
56independent_actual
Member
Posts: 452
Joined: Sun May 23, 2021 16:10
IRC: independent56
In-game: 56independent
Location: Girona Province
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.1]

by 56independent_actual » Post

💥🚄
Last edited by 56independent_actual on Sun Jan 15, 2023 16:18, edited 2 times in total.
Warnig: Al my laguage ekscept English is bad, includig Hungarian (magyàränoлиски), Spanish (esпagnyoл), and Russian (рÿсскïанöл).

User avatar
LMD
Member
Posts: 1386
Joined: Sat Apr 08, 2017 08:16
GitHub: appgurueu
IRC: appguru[eu]
In-game: LMD
Location: Germany
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.1]

by LMD » Post

56independent_actual wrote:
Wed Jan 11, 2023 11:28
I've tried grepping for "train" (DO NOT RECCOMEND LMAO (it broke my terminal and forced me to re-install my Bash 32 bit emulator))
If the output of that command is too enormous to fit on your screen, use a pager like less to make it manageable. If it "broke your terminal" you probably included binary files in your grep (e.g. B3Ds which may contain "train" as text or bone names, PNGs that might contain it in metadata etc. and perhaps advtrains-internal binary formats).
My stuff: Projects - Mods - Website

User avatar
56independent_actual
Member
Posts: 452
Joined: Sun May 23, 2021 16:10
IRC: independent56
In-game: 56independent
Location: Girona Province
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.1]

by 56independent_actual » Post

💥🚄
Last edited by 56independent_actual on Sun Jan 15, 2023 16:18, edited 1 time in total.
Warnig: Al my laguage ekscept English is bad, includig Hungarian (magyàränoлиски), Spanish (esпagnyoл), and Russian (рÿсскïанöл).

User avatar
56independent_actual
Member
Posts: 452
Joined: Sun May 23, 2021 16:10
IRC: independent56
In-game: 56independent
Location: Girona Province
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.1]

by 56independent_actual » Post

💥🚄
Last edited by 56independent_actual on Sun Jan 15, 2023 16:18, edited 1 time in total.
Warnig: Al my laguage ekscept English is bad, includig Hungarian (magyàränoлиски), Spanish (esпagnyoл), and Russian (рÿсскïанöл).

User avatar
Blockhead
Member
Posts: 1622
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.1]

by Blockhead » Post

56independent_actual wrote:
Wed Jan 11, 2023 13:43

Code: Select all

-- path_node - (reserved)
-- path_cn   - Connid of the current node that points towards path[i+1]
What does "(reserved)" mean? Is it reserved for my usage? Someone else's?
I interpret it as "Reserved for potential future usage" - but never actually being used, given there's literally no other reference to it in the entire modpack. Whatever it was meant for likely ended up being unimportant.
56independent_actual wrote:
Wed Jan 11, 2023 13:43
What's a con nid? A con id? A conn id? A Conni D? A Co NNI D? What even is the id about and where do i find out what they mean?
A connection ID, which we'll get to explaining the next quote block..

You should have read the further context around your grep result (if you didn't know what file it was, add -H). The context is the connlku table, which maps different kinds of connectedness-formats of tracks to where their connections will point. The number here refers to the number of connections that need to be listed for that track-connectedness type, and is meant to be related to the number of connections that track type has. Straight tracks go from one point to another, so they have two connections; turnouts connect three points, and diamond crossings four. I added the 5 entry myself as a hack for making three-way turnouts work properly. Technically those have four connections, but of course that number is taken by crossings, and crossings are connected differently from how three-way turnouts are. I hope it's now obvious why there's no entry for the number 1.

56independent_actual wrote:
Wed Jan 11, 2023 13:43
Having a basic search with grep reveals a list

Code: Select all

 2 = straight rail; 3 = turnout, 4 = crossing, 5 = three-way turnout (5th entry is a stub)
But this only adds confustion. What's 1 for?
connlku looks up which Connection IDs to use, and then train pathing looks along the appropriate connections. The mod also has to handle rotations, of which there are four for every track node: north, south, east and west we can call them even if that's kind of inaccurate. Advtrains uses a 30° track system (only actually approximately 30°, it's actually a system of axis-aligned, 2+1, 1+1, and 1+2 deltas in position), which adds up to a total of 16 rotations. These live at the top of helpers.lua in dir_trans_tbl. These are the 16 'connection IDs' mapped to the actual coordinates they connect to. There is a helper function, advtrains.dirToCoord to translate that into coordinates.
56independent_actual wrote:
Wed Jan 11, 2023 13:43
How do i find the co-ordinate of a specified path element (which would be the most helpful), a bit like path_lookup but in reverse (take index and turn it into a pos table)?
The coordinates of a specified path element are exactly what the path table contains. Each increasing index of advtrains.trains[train_id].train.path is a set of coordinates for the next position that the train will occupy. So.. it seems like it's your brain that's in reverse and the lookup you want to do is forwards? Again I commend the QA block mod to you. Plonk a train down in a world, and inspect its path data through the QA block.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

yw05
Member
Posts: 366
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.4.1]

by yw05 » Post

Blockhead wrote:
Wed Jan 11, 2023 11:37
I recommend you install the QA Block mod because it's really helpful for navigating the global Lua space and figuring things out.
Nice mod for checking global variables.

Coincidentally, I am thinking about making a debugging mod for testing certain internals (especially signaling) of Advtrains, as WE's //lua eventually became annoying to use.
Oh also, when grepping somewhere you might find binary files (even though I thought grep was supposed to just print "binary file"..), you might try adding --include=*.lua to your command line.
As an addition, there is the git grep command that, among other things, feeds the result through a pager and also adds more coloring (the latter is especially helpful with -r and -n)

User avatar
Blockhead
Member
Posts: 1622
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.1]

by Blockhead » Post

yw05 wrote:
Wed Jan 11, 2023 16:37
Coincidentally, I am thinking about making a debugging mod for testing certain internals (especially signaling) of Advtrains, as WE's //lua eventually became annoying to use.
I'm all in favour of coding some tools to help you debug and test mods instead of doing stuff as though it's a black box, manually, and so on. I would also recommend Debug mod's /lua as it automatically shows the evaluation result instead of having to ask it to print stuff, and it has pretty printing. The dbg() mode is useful in some situations too (unfortunately it doesn't do stepping in the debugging though).

Has anyone seen this train?

I first spotted this "CS 810" train on train table server on 2023-01-06. It has a 3D-animated model, horn sampled from I think a DCC decoder pack but no attachment offset patch data. Is it a train table exclusive? I searched high and low but couldn't find it published on the interwebs.
Attachments
CS810.png
CS810.png (216.57 KiB) Viewed 4214 times
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

W3RQ01
Member
Posts: 157
Joined: Sat Nov 28, 2020 06:33
GitHub: W3RQ01
In-game: Dario23 or W3RQ01
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.1]

by W3RQ01 » Post

Blockhead wrote:
Thu Jan 12, 2023 00:08

Has anyone seen this train?

I first spotted this "CS 810" train on train table server on 2023-01-06. It has a 3D-animated model, horn sampled from I think a DCC decoder pack but no attachment offset patch data. Is it a train table exclusive? I searched high and low but couldn't find it published on the interwebs.
Nope, we should email the admin and ask...
OneUnitedPower

User avatar
56independent_actual
Member
Posts: 452
Joined: Sun May 23, 2021 16:10
IRC: independent56
In-game: 56independent
Location: Girona Province
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.1]

by 56independent_actual » Post

💥🚄
Last edited by 56independent_actual on Sun Jan 15, 2023 16:19, edited 1 time in total.
Warnig: Al my laguage ekscept English is bad, includig Hungarian (magyàränoлиски), Spanish (esпagnyoл), and Russian (рÿсскïанöл).

yw05
Member
Posts: 366
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.4.1]

by yw05 » Post

56independent_actual wrote:
Fri Jan 13, 2023 20:37
I have a question about track rotations. You see, "30 degrees" is stated as the intervals between rotations, but according to my calculations this is wrong. We have knight's move tracks, which have half the angle from a straight line then the 45 degree (diagonal) track segments. So, this should be 22.5 degrees, and not 30 degrees.
Well, the actual angle is arctan(0.5), which is about 26.5 degrees. (By the way, make sure to configure your calculator to show the result in degrees - I have heard that some people messed this up in their exams)

This is a known fact, and the models for Ks signals are rotated by 26.5 degrees (or, at least, they seem to be that way, and that is the rotation I took for the models that went into Advtrains 2.4)

My understanding is that "30 degrees" comes from rounding the angle to steps of 10 degrees and is also easier to memorize.
However, this would result in 16 and not the 12 rotations we're used to. It seems 30 degrees is 360/12, but then you can't make a 45 degree angle with 30 without doing some form of weird angles.
There are, in fact, 16 directions (listed below counterclockwise from north, in degrees)
  • 0
  • arctan(0.5)
  • 45
  • 90-arctan(0.5)
  • 90
  • 90+arctan(0.5)
  • 135
  • 180-arctan(0.5)
  • 180
  • 180+arctan(0.5)
  • 225
  • 270-arctan(0.5)
  • 270
  • 270+arctan(0.5)
  • 315
  • 360-arctan(0.5)

User avatar
56independent_actual
Member
Posts: 452
Joined: Sun May 23, 2021 16:10
IRC: independent56
In-game: 56independent
Location: Girona Province
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.1]

by 56independent_actual » Post

💥🚄
Last edited by 56independent_actual on Sun Jan 15, 2023 16:19, edited 2 times in total.
Warnig: Al my laguage ekscept English is bad, includig Hungarian (magyàränoлиски), Spanish (esпagnyoл), and Russian (рÿсскïанöл).

yw05
Member
Posts: 366
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.4.1]

by yw05 » Post

56independent_actual wrote:
Fri Jan 13, 2023 21:15
yw05 wrote:
Fri Jan 13, 2023 20:52
arctan(0.5)
Looking at the docs, arctan seems to be a wrapper for tan(x)^-1, but i don't see how this function call is relevant.

I only barely understand how tan relates to a right-angled triangle. It seems one of the function definitions is "opposite / adjacent", but i do not see how this is relevant to directions.

Why would we use arctan over, say, my 45/2 (which is a lot easier to understand)?
The catheti for this situation are the differences in the x and z directions. Please do some research on trigonometric functions if you need further explanation.

You have not shown where 45/2 comes from. It is incorrect because you (apparently and incorrectly) assumed that the angle bisector also bisects the opposite cathetus, which is not the case. This can be seen from the fact that tan is not a linear function.
There are, in fact, 16 directions
Now that makes sense now i count what exists. However, 365/16 is 22.8, much closer to 22.5 then your 26.5.
The step is not constant.
Last edited by yw05 on Fri Jan 13, 2023 21:40, edited 1 time in total.

User avatar
56independent_actual
Member
Posts: 452
Joined: Sun May 23, 2021 16:10
IRC: independent56
In-game: 56independent
Location: Girona Province
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.1]

by 56independent_actual » Post

💥🚄
Last edited by 56independent_actual on Sun Jan 15, 2023 16:19, edited 1 time in total.
Warnig: Al my laguage ekscept English is bad, includig Hungarian (magyàränoлиски), Spanish (esпagnyoл), and Russian (рÿсскïанöл).

yw05
Member
Posts: 366
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.4.1]

by yw05 » Post

56independent_actual wrote:
Fri Jan 13, 2023 21:40
You have not shown where 45/2 comes from. It is incorrect because you (apparently and incorrectly) assumed that the angle bisector also bisects the opposite cathetus, which is not the case. This can be seen from the fact that tan is not a linear function.
45/2 comes from the two cardinal tracks: 0 degrees and 90 degrees. The diagonal is half that, or 45 degrees. The knight's move from there is a further half using my system of logic for equal rotation amounts.
The "logic for equal rotation amounts" is where things break down. Again, some research on trigonometric functions should give you an idea.
So the tracks do not rotate to equal degrees?! Or am i just misreading because i'm bad at jargon outside my fields of specialisation?
Explain what you mean by "equal degrees".

As I explained earlier, there are 16 different directions for tracks. The trackworker works (more or less) by cycling through the 16 states. The step is not constant though.

User avatar
56independent_actual
Member
Posts: 452
Joined: Sun May 23, 2021 16:10
IRC: independent56
In-game: 56independent
Location: Girona Province
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.1]

by 56independent_actual » Post

💥🚄
Last edited by 56independent_actual on Sun Jan 15, 2023 16:20, edited 1 time in total.
Warnig: Al my laguage ekscept English is bad, includig Hungarian (magyàränoлиски), Spanish (esпagnyoл), and Russian (рÿсскïанöл).

yw05
Member
Posts: 366
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.4.1]

by yw05 » Post

56independent_actual wrote:
Sat Jan 14, 2023 11:40
Ever since i started making Spanish translations of the newsletter, my Spanish has improved drastically. If a native speaker was to compare the first and latest versions, they would see a clear improvement. The Spanish newsletter has resulted in the improvement of my Spanish whilst helping South Americans, Spaniards, and other people who know mainly Spanish to get introduced to the project and access knowledge once locked inside the Anglosphere\.

Of course though, i live in Catalonia, which is a place which speaks Catalan. I come from Wales, a place with a dying local language, and the last thing i want is for a local language where i live to die. It's a win-win situation. Advtrains has one more language for the newsletter to gather in more users, and i get to improve my Catalan skills.

The first version will likely be mostly taken from a dictionary, but slowly, more and more words move to my head, to read the become easier newsletter will and easier and easier, until native speakers no longer have to re-arrange words in their head.

How do you all feel about a new Catalan translation of the newsletter? In any case, it probably won't hurt you too much if i decide to spend my effort on something which does not directly benefit you (you're probably used to that, being part of a FOSS project).
I expect you to make translations only if your language skill is sufficient. Otherwise, I would suggest looking elsewhere to practice your language skills.

User avatar
56independent_actual
Member
Posts: 452
Joined: Sun May 23, 2021 16:10
IRC: independent56
In-game: 56independent
Location: Girona Province
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.1]

by 56independent_actual » Post

💥🚄
Last edited by 56independent_actual on Sun Jan 15, 2023 16:20, edited 1 time in total.
Warnig: Al my laguage ekscept English is bad, includig Hungarian (magyàränoлиски), Spanish (esпagnyoл), and Russian (рÿсскïанöл).

Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 17 guests