[Mod] Advanced Trains [advtrains] [2.4.3]

yw05
Member
Posts: 368
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

Miniontoby wrote:
Sat Dec 10, 2022 12:50
At least I would like some help with automating trains with informationboards as well and such.
Advtrains does not yet provide a standard interface for information systems. I have mostly seen people using station tracks and/or LuaATC. (Also, I only have experience with passenger services, you may need to ask Maverick2797 or Blockhead regarding the operation of freight trains). I wrote a somewhat simple display for platforms and stations, but, as with other LuaATC code I wrote, it is a huge mess, and bad design is hard to undo.

By the way, if you want to go down the path of LuaATC and also use MediaWiki for your server wiki, you can consider looking into Scribunto and Module:Adjacent stations for MediaWiki.

Some more explanation on "and such" would be interesting, but I can suggest two things in case my guesses happen to be correct:
  • If you want some idea on track layout, consider looking at satellite maps (e.g. on Google Maps) or looking on other servers for reference. (And, for other people, please keep server advertising/drama off the Advtrains thread)
  • If you want some idea on designing your public transit system, consider looking in real life or at other servers (see above). Alternatively, there are some games with the theme of designing your own transit system, and you can look at some of them as well.
I just cannot get those auto routes with 1 line and multiple trains (I cannot even get 1 train working)
Oof. Some further explanation on the problem would be helpful.

Anyway, Codesound wrote a nice interlocking guide:
Codesound wrote:
Wed Nov 24, 2021 20:40
Hi,

the Rev.3 of the tutorial is here.... hope you like it...
Blockhead wrote:
Mon Nov 22, 2021 12:44
- Terminology: You said Rule but to be consistent with advtrains the term should be Route. When I hear "Rule" I think ARS Rule like on signals and station/stop tracks

do you allow me for this tutorial this term? ;-) with the next I will use the term "instructors" (...)

https://www.0090.it/cc/index.php/s/7nLcimzbHR6MtKb

thanks for all....

bye
There are some other places you can look at:
  • The wiki has an interlocking guide. It also links to some interesting pages. Some of the information is a bit subjective (and I do not agree to some), but it is up to you to figure out how things are done.
  • The doc branch has a manual written in LaTeX, located in assets/manual/tex. You do need to have some knowledge of LaTeX though.

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

There is Blockhead's video tutorial
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:23, 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
Miniontoby
Member
Posts: 616
Joined: Fri Mar 01, 2019 19:25
GitHub: Miniontoby
IRC: Miniontoby
In-game: Miniontoby
Location: The Netherlands

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

by Miniontoby » Post

yw05:
I will see.

"Oof. Some further explanation on the problem would be helpful."

I just want to have one main line (maybe I do need to make two, but for now I want just one). But the train sort of does do the job with going to a station and then back, but it just takes a little bit too long and since I don't want people to have to wait, I want to have another train


W3RQ01:
I will look at that


56independent_actual:
I know. Thats why I kind of want it, but my LCD's are too small for all the information and idk how to correctly do it. Also at first it gave me errors because code used F table instead of S and actually at both of them it didn't really work out well, untill I used ATC block to manually set it once. (because digilines method is even more difficult and such)



To everyone:

I am just someone who loves watching trains IRL. In-game on my phone I tries making a rail with switch and after switch somewhere 1 up (because the world needed to) and up went fine for the train, but with down the train just went flying for no reason.
Working on mtctl ---- Check my mod "Doorbell" -- Stay safe

yw05
Member
Posts: 368
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

Miniontoby wrote:
Sun Dec 11, 2022 14:02
"Oof. Some further explanation on the problem would be helpful."

I just want to have one main line (maybe I do need to make two, but for now I want just one). But the train sort of does do the job with going to a station and then back, but it just takes a little bit too long and since I don't want people to have to wait, I want to have another train
Some more detail would be helpful.

I am not sure what "takes a little bit too long":
  • Trains take time to travel between stations. You can consider raising the maximum speed of trains, but be aware that this may have side effects due to restrictions set by the implementation.
  • If the train takes too much time at stations, you can shorten the time by (for example) changing this in station tracks.
In any case, consider setting up interlocking in general.
I know. Thats why I kind of want it, but my LCD's are too small for all the information
I would suggest shortening/reducing the information on the LCDs or using a longer LCD (e.g. textline displays)
idk how to correctly do it. Also at first it gave me errors because code used F table instead of S and actually at both of them it didn't really work out well, untill I used ATC block to manually set it once. (because digilines method is even more difficult and such)
Please provide more detail, as "X gives me errors" hardly helps with anything, if at all. In particular, for LuaATC, please provide
  • The LuaATC code - this does not have to be a verbatim copy of the code, but it should be sufficient to demonstrate the problem
  • The track setup, if relevant
  • The error message you got
Also, here is the LuaATC manual, in case you are looking for it: https://git.bananach.space/advtrains.gi ... /README.md

User avatar
Miniontoby
Member
Posts: 616
Joined: Fri Mar 01, 2019 19:25
GitHub: Miniontoby
IRC: Miniontoby
In-game: Miniontoby
Location: The Netherlands

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

by Miniontoby » Post

"I am not sure what "takes a little bit too long""
-> At IRL it takes like 30 minutes because they use too less trains. And if people in-game have to wait like some time, then they are going to use the rail road to walk over to the main island... I have already seen

"textline displays" -> I will look it up thx.


With the error, I was able to fix it (thats why I cannot provide details), but yeah I just had to do manual work. Also it doesn't round the number really and the ATC rails are not avaible for going up parts, sadly. Also It works with train coming from far distance, but once it is at my 1m one, it never goes up again. (this is with the rails I set up thx to the video you guys recommended. (but from the Middle station to my spawn station 60m away or so)) How to fix this?
Working on mtctl ---- Check my mod "Doorbell" -- Stay safe

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:23, 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: 368
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

Miniontoby wrote:
Sun Dec 11, 2022 16:03
"I am not sure what "takes a little bit too long""
-> At IRL it takes like 30 minutes because they use too less trains. And if people in-game have to wait like some time, then they are going to use the rail road to walk over to the main island... I have already seen
This is partly why interlocking is used - it (if done well) prevents train collisions and subsequently allows you to run multiple trains on the same line as long as the line is used below its capacity.
"textline displays" -> I will look it up thx.
A quick addition: you can combine textline displays to make wider ones and/or for tabulation. This allows creating large displays, although the edges may look weird, from what I recall.
With the error, I was able to fix it (thats why I cannot provide details), but yeah I just had to do manual work. Also it doesn't round the number really and the ATC rails are not avaible for going up parts, sadly.
For number rounding, Lua itself does not seem to provide a function to round numbers to an arbitrary precision. However, you can consider using a function like this:

Code: Select all

local function roundto(n, p) -- rounds n to p decimal places
	return math.floor(n*10^p)/10^p
end
(math.floor itself rounds a number downward, i.e. toward negative infinity, to an integer.)
Alternatively, when using string.format, you can use %d to print integers (in which case string.format rounds the number for you) or %f for floating-point numbers. In the latter case, you can specify the precision to print the number width. On my computer with LuaJIT, string.format("%d %f %.2f %.2f", 2.5, 1/3, 1/3, 0) returns the string 2 0.333333 0.33 0.00.
Also It works with train coming from far distance, but once it is at my 1m one, it never goes up again. (this is with the rails I set up thx to the video you guys recommended. (but from the Middle station to my spawn station 60m away or so)) How to fix this?
With the train information system? It seems like the code is currently quite limited, so you likely need to expand on it yourself. I wrote mine from scratch (more or less)

In any case, some example code on the wiki should seriously be used with care.
56independent_actual wrote:
Sun Dec 11, 2022 16:10
If you have too less trains, add a few more trains until you don't have too less trains for your railway line. Don't take it too far or you might get spooky ghost trains which keep signals red.
I don't recall short sections being a cause for ghost trains, at least from my experience.

Do you have a test case for this? Then it would likely be a bug.
Train safety is very important (to prevent unpaid advertising, i am not going to say i wrote some tips of questionable quality in the newsletter).
I would be interested in looking into statistics on the frequency of train-related deaths based on various factors instead of a plain summary.

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:24, 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: 368
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:
Sun Dec 11, 2022 17:06
yw05 wrote:
Sun Dec 11, 2022 16:58
I don't recall short sections being a cause for ghost trains, at least from my experience.
I said too many trains on a line might cause the error, just like how too much cold for a water pipe might burst the copper or too many pages for a book might break its spine, or too many characters for a string in a low-level language might break it.
I only see too many trains being a source of deadlock and not of ghost sections.

Regardless of that questionable metaphor, have you ever identified setting up too many trains or sections as a method of creating unoccupied track sections that are incorrectly identified by the interlocking system as being occupied?
  • If yes, please create a test case that can reproduce the problem.
  • If not, please do not bring up this topic.
I made up the figures from the middle of the mind as the Advtrains Newsletter is not the Time Magazine or BBC news.
Do not make up numbers. I do not want to repeat this again:
yw05 wrote:
Tue Oct 18, 2022 20:26
@56independent: Regarding the "newsletters", adding BS is not acceptable.
This applies to the wiki in general.

User avatar
Miniontoby
Member
Posts: 616
Joined: Fri Mar 01, 2019 19:25
GitHub: Miniontoby
IRC: Miniontoby
In-game: Miniontoby
Location: The Netherlands

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

by Miniontoby » Post

I cannot get multiple trains working on my track without them crashing into each others.

"Also it doesn't round the number really" -> this was meant as a hint to maybe adding in the math.floor to the code on the wiki, but it was only an idea.

But still, the if distance < F.tbl.distance then makes it so that it never sets it again after train passed station... idk what is the best way to fix/change/improve this...


*For the rest of the answers I just say I read them and I will see what I can do. I am not going to answer them all*


Also I am missing the default platform nodes. I just installed the extra platform nodes mod, but then still I didn't get the default ones. (Btw I installed the advtrains from source using git)
Working on mtctl ---- Check my mod "Doorbell" -- Stay safe

yw05
Member
Posts: 368
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

Miniontoby wrote:
Sun Dec 11, 2022 17:50
I cannot get multiple trains working on my track without them crashing into each others.
Ah. This is weird. Here are a few things you can try (numbered because this is IMO a good order):
  1. Do you have interlocking set up at all? If not, I would suggest going through the materials in the previous posts.
  2. Is every track section "protected" by a signal? In other words, do you have to go past a signal to move into the section? (Is the section explicitly part of a route? Select a route in the signaling formspec and click "show route") Every section should be protected by a signal in some way, at least in the driving direction. You need to set up more signals otherwise
  3. Do the signals have an influence point? You can check this by
    1. Holding Aux1 (usually the "E" key) and clicking on the signal, or
    2. Driving a train through the signal while it shows the "danger" aspect
    You should assign an influence point if you have not yet assigned one. The influence point should be set such that a train passes (or stops in front of) it before entering the protected sections.
  4. Does the interlocking system "see" the trains in the section? Click on a TCB, and then "Show track section" for the section with a train in it. Is the train listed as occupying the section (or is there any information on the route (pre)occupying a section)? If not, you need to move the train out of the section (ideally beyond the influence point of the previous signal) and then move it back in.
"Also it doesn't round the number really" -> this was meant as a hint to maybe adding in the math.floor to the code on the wiki, but it was only an idea.
IMO a lot of design choices are somewhat subjective and can depend on a few factors, which is why I listed multiple ways of rounding numbers. This can also depend on the level of precision you can/are willing to provide, so I would (partly) leave this as-is.

Regardless of that, I suppose it is up to the author of that page to update it.
But still, the if distance < F.tbl.distance then makes it so that it never sets it again after train passed station... idk what is the best way to fix/change/improve this...
Perhaps add another track to set F.tbl.distance to math.huge after the train leaves the station?

Alternatively, you can have a system to calculate an average interval of the trains and use that information to estimate the next arrival time. This does assume that the trains are more or less evenly spaced though.

Also, you likely want to use other indices if you want to expand the code beyond one station.

I should consider putting (likely a slightly reduced version of) my LuaATC code somewhere.

User avatar
Miniontoby
Member
Posts: 616
Joined: Fri Mar 01, 2019 19:25
GitHub: Miniontoby
IRC: Miniontoby
In-game: Miniontoby
Location: The Netherlands

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

by Miniontoby » Post

I will have to check the things tomorow.

Btw I think I will implement the digilines code into the env based code for now. I guess that will maybe somewhat be better
Working on mtctl ---- Check my mod "Doorbell" -- Stay safe

User avatar
Miniontoby
Member
Posts: 616
Joined: Fri Mar 01, 2019 19:25
GitHub: Miniontoby
IRC: Miniontoby
In-game: Miniontoby
Location: The Netherlands

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

by Miniontoby » Post

Uhmm the mtmapper with the netmapper doesn't really seem to do it correctly:
Just look at https://minetest.ircforever.org/netmap.svg (I cannot show it here, cause it is svg and then the img tag doesn't work that well...) But if you look you can see my path, but if you then look at the island in the middle (it looks like Italy tbh) if you zoom in far enough you see there the polylines
Working on mtctl ---- Check my mod "Doorbell" -- Stay safe

yw05
Member
Posts: 368
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

Miniontoby wrote:
Sun Dec 11, 2022 19:10
Uhmm the mtmapper with the netmapper doesn't really seem to do it correctly:
Just look at https://minetest.ircforever.org/netmap.svg (I cannot show it here, cause it is svg and then the img tag doesn't work that well...) But if you look you can see my path, but if you then look at the island in the middle (it looks like Italy tbh) if you zoom in far enough you see there the polylines
Here is a diff I figured out to make the files match up:

Code: Select all

3,4c3,4
< <svg width="1024" height="800" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-5000 -5000 10000 10000"><circle cx="0" cy="0" r="5" stroke="red" stroke-width="1"/>
< <image xlink:href="https://minetest.ircforever.org/map.png" x="-6000" y="-6000" height="12000px" width="12000px"/><!-- Restart at position -132,3,-77 -->
---
> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="672" height="752" viewBox="-528 -224 672 752"><circle cx="0" cy="0" r="5" stroke="red" stroke-width="1"/>
> <image xlink:href="https://minetest.ircforever.org/map.png" width="672px" height="752px" y="-224" x="-528"/><!-- Restart at position -132,3,-77 -->
Here are my observations regarding the matter:
  • The SVG size information (width, height, viewBox) seem to be hardcoded at a few places. This only affects the scale of the map though.
  • The netmapper assumes the center of the map image to be (x=0,z=0), while the center of your map appears to be (x=-192,z=-152). This is like what you need to change. The size of the map image is also hardcoded and needs to be changed as well.
@Blockhead: would it be sensible to use imagemagick (or a similar tool) to fetch the size of the image?

User avatar
Miniontoby
Member
Posts: 616
Joined: Fri Mar 01, 2019 19:25
GitHub: Miniontoby
IRC: Miniontoby
In-game: Miniontoby
Location: The Netherlands

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

by Miniontoby » Post

yw05 wrote:
Sun Dec 11, 2022 19:49
Miniontoby wrote:
Sun Dec 11, 2022 19:10
Uhmm the mtmapper with the netmapper doesn't really seem to do it correctly:
Just look at https://minetest.ircforever.org/netmap.svg (I cannot show it here, cause it is svg and then the img tag doesn't work that well...) But if you look you can see my path, but if you then look at the island in the middle (it looks like Italy tbh) if you zoom in far enough you see there the polylines
Here is a diff I figured out to make the files match up:

Code: Select all

3,4c3,4
< <svg width="1024" height="800" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-5000 -5000 10000 10000"><circle cx="0" cy="0" r="5" stroke="red" stroke-width="1"/>
< <image xlink:href="https://minetest.ircforever.org/map.png" x="-6000" y="-6000" height="12000px" width="12000px"/><!-- Restart at position -132,3,-77 -->
---
> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="672" height="752" viewBox="-528 -224 672 752"><circle cx="0" cy="0" r="5" stroke="red" stroke-width="1"/>
> <image xlink:href="https://minetest.ircforever.org/map.png" width="672px" height="752px" y="-224" x="-528"/><!-- Restart at position -132,3,-77 -->
Here are my observations regarding the matter:
  • The SVG size information (width, height, viewBox) seem to be hardcoded at a few places. This only affects the scale of the map though.
  • The netmapper assumes the center of the map image to be (x=0,z=0), while the center of your map appears to be (x=-192,z=-152). This is like what you need to change. The size of the map image is also hardcoded and needs to be changed as well.
@Blockhead: would it be sensible to use imagemagick (or a similar tool) to fetch the size of the image?
I just changed the code so it uses those variables and of course it works, but yeah it is static and not dynamic.

Any idea how to dynamicly do it?


Update: I got way to download and get file witdth and height and they are the 672px and 752px

Seems like this would work...

Code: Select all

        local xoff, yoff = -192,-152
        wimw, wimh = GetImageWidthHeight('temp.png')
        wimx, wimy = xoff-(wimw/2), -(yoff+(wimh/2))
Working on mtctl ---- Check my mod "Doorbell" -- Stay safe

User avatar
Miniontoby
Member
Posts: 616
Joined: Fri Mar 01, 2019 19:25
GitHub: Miniontoby
IRC: Miniontoby
In-game: Miniontoby
Location: The Netherlands

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

by Miniontoby » Post

Quick update on "Also I am missing the default platform nodes. I just installed the extra platform nodes mod, but then still I didn't get the default ones. (Btw I installed the advtrains from source using git)"

I found the problem. the advtrains mod didn't had 'default' mod as depend, meaning it didn't wait for default to register its nodes which caused an error with register_platform and that 'default:stonebrick' didn't exist
Working on mtctl ---- Check my mod "Doorbell" -- Stay safe

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

Miniontoby wrote:
Tue Dec 13, 2022 14:49
Quick update on "Also I am missing the default platform nodes. I just installed the extra platform nodes mod, but then still I didn't get the default ones. (Btw I installed the advtrains from source using git)"

I found the problem. the advtrains mod didn't had 'default' mod as depend, meaning it didn't wait for default to register its nodes which caused an error with register_platform and that 'default:stonebrick' didn't exist
What extra platforms mod have you installed?
OneUnitedPower

yw05
Member
Posts: 368
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

Miniontoby wrote:
Tue Dec 13, 2022 14:49
Quick update on "Also I am missing the default platform nodes. I just installed the extra platform nodes mod, but then still I didn't get the default ones. (Btw I installed the advtrains from source using git)"

I found the problem. the advtrains mod didn't had 'default' mod as depend, meaning it didn't wait for default to register its nodes which caused an error with register_platform and that 'default:stonebrick' didn't exist
I thought game-specific mods are run first (i.e. before Advtrains)?

I am not sure about (opt)depending on default, considering that it can also involve other games than MTG.

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:24, 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
Miniontoby
Member
Posts: 616
Joined: Fri Mar 01, 2019 19:25
GitHub: Miniontoby
IRC: Miniontoby
In-game: Miniontoby
Location: The Netherlands

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

by Miniontoby » Post

yw05 wrote:
Tue Dec 13, 2022 16:35
Miniontoby wrote:
Tue Dec 13, 2022 14:49
Quick update on "Also I am missing the default platform nodes. I just installed the extra platform nodes mod, but then still I didn't get the default ones. (Btw I installed the advtrains from source using git)"

I found the problem. the advtrains mod didn't had 'default' mod as depend, meaning it didn't wait for default to register its nodes which caused an error with register_platform and that 'default:stonebrick' didn't exist
I thought game-specific mods are run first (i.e. before Advtrains)?

I am not sure about (opt)depending on default, considering that it can also involve other games than MTG.
You will need the 'default:' blocks for the platforms to be registered... Maybe just doing it as 'optional_depend' might also help, but you will have to add a way to check if the default mod exists (even though it doesn't really matters, since it just worked without the default mod loaded...).

W3RQ01 wrote:
Tue Dec 13, 2022 16:18
Miniontoby wrote:
Tue Dec 13, 2022 14:49
Quick update on "Also I am missing the default platform nodes. I just installed the extra platform nodes mod, but then still I didn't get the default ones. (Btw I installed the advtrains from source using git)"

I found the problem. the advtrains mod didn't had 'default' mod as depend, meaning it didn't wait for default to register its nodes which caused an error with register_platform and that 'default:stonebrick' didn't exist
What extra platforms mod have you installed?
There is a mod at the same git thingy as advtrains called advtrains_platform
Working on mtctl ---- Check my mod "Doorbell" -- Stay safe

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

There is a mod at the same git thingy as advtrains called advtrains_platform
I suggest you to use my version as the one you currently have is specifically made for the LinuxForks server. Mine has more content and variety (Forum page of my repo)
OneUnitedPower

yw05
Member
Posts: 368
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

Miniontoby wrote:
Tue Dec 13, 2022 18:13
yw05 wrote:
Tue Dec 13, 2022 16:35
Miniontoby wrote:
Tue Dec 13, 2022 14:49
Quick update on "Also I am missing the default platform nodes. I just installed the extra platform nodes mod, but then still I didn't get the default ones. (Btw I installed the advtrains from source using git)"

I found the problem. the advtrains mod didn't had 'default' mod as depend, meaning it didn't wait for default to register its nodes which caused an error with register_platform and that 'default:stonebrick' didn't exist
I thought game-specific mods are run first (i.e. before Advtrains)?

I am not sure about (opt)depending on default, considering that it can also involve other games than MTG.
You will need the 'default:' blocks for the platforms to be registered.
I know, but my understanding of mod loading is that default should always be loaded before Advtrains as the former velongs to MTG (whose modules appear to be loaded before other mods)
Maybe just doing it as 'optional_depend' might also help, but you will have to add a way to check if the default mod exists (even though it doesn't really matters, since it just worked without the default mod loaded...).
As I wrote above, I was alightly concerned that non-MTG-based mods could also provide default and cause problems. However, a quick glimpse of CDB seems to show that only MTG-based games provide the default mod.

Anyway, feel free to submit a patch for this. Although gpcf/orwell's (apparent) absence is a bit concerning.

In any case, a platform registration API that detects mods would be useful.

User avatar
Blockhead
Member
Posts: 1684
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:
Tue Dec 13, 2022 16:35
I thought game-specific mods are run first (i.e. before Advtrains)?
Nope, read this thread for more details. In short, game mods are not special and aren't guaranteed to load first. In fact they are basically guaranteed to load later if there is a big chain of dependencies in the game's mods but a user installed mod with no dependencies exists.

For instance in the more complicated Mineclone2: mcl_enchanting <- mcl_nether <- mcl_core
versus mods like QA Block or Debug that are developer tools that can be used for any game.

I think we should make any advtrains module that adds recipes optionally-depend on any game-specific mod that advtrains supports, or use something like Adaption Modpack. I think that the misc_nodes.lua which is inside the core modpack should either be replaced entirely by integrating advtrains_platform into the core modpack and deleting misc_nodes.lua, OR perhaps the platform registration function can remain inside the core modpack, but with no registrations in the core modpack, only calling the regisration function from other mods.

Multi-game support is hard, but realistically, we still only support Minetest Game unless you're playing creative mode. For now I think realising our mistake and adding default back to the optional dependencies will suffice until someone makes a conscientious effort to support some other game like Mineclone2.

Miniontoby wrote:
Mon Dec 12, 2022 09:14
yw05 wrote:
Sun Dec 11, 2022 19:49
Miniontoby wrote:
Sun Dec 11, 2022 19:10
Uhmm the mtmapper with the netmapper doesn't really seem to do it correctly:
Just look at https://minetest.ircforever.org/netmap.svg (I cannot show it here, cause it is svg and then the img tag doesn't work that well...) But if you look you can see my path, but if you then look at the island in the middle (it looks like Italy tbh) if you zoom in far enough you see there the polylines
Here is a diff I figured out to make the files match up:

Code: Select all

3,4c3,4
< <svg width="1024" height="800" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-5000 -5000 10000 10000"><circle cx="0" cy="0" r="5" stroke="red" stroke-width="1"/>
< <image xlink:href="https://minetest.ircforever.org/map.png" x="-6000" y="-6000" height="12000px" width="12000px"/><!-- Restart at position -132,3,-77 -->
---
> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="672" height="752" viewBox="-528 -224 672 752"><circle cx="0" cy="0" r="5" stroke="red" stroke-width="1"/>
> <image xlink:href="https://minetest.ircforever.org/map.png" width="672px" height="752px" y="-224" x="-528"/><!-- Restart at position -132,3,-77 -->
Here are my observations regarding the matter:
  • The SVG size information (width, height, viewBox) seem to be hardcoded at a few places. This only affects the scale of the map though.
  • The netmapper assumes the center of the map image to be (x=0,z=0), while the center of your map appears to be (x=-192,z=-152). This is like what you need to change. The size of the map image is also hardcoded and needs to be changed as well.
@Blockhead: would it be sensible to use imagemagick (or a similar tool) to fetch the size of the image?
I just changed the code so it uses those variables and of course it works, but yeah it is static and not dynamic.

Any idea how to dynamicly do it?


Update: I got way to download and get file witdth and height and they are the 672px and 752px

Seems like this would work...

Code: Select all

        local xoff, yoff = -192,-152
        wimw, wimh = GetImageWidthHeight('temp.png')
        wimx, wimy = xoff-(wimw/2), -(yoff+(wimh/2))
Netmapper is a mess currently, with my version (which adds TCB and station drawing) not rebased on upstream to support serialize lib, and obviously netmapper also needs more options like manually defining the boundary or at least a more sensible default for the boundary size because stuff can end up off the viewport or really tiny and so on. However it's done though, please fix it by modifying the Lua source code directly to do its job properly instead of hacking around stuff with external shell scripts and other nonsense.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

User avatar
Miniontoby
Member
Posts: 616
Joined: Fri Mar 01, 2019 19:25
GitHub: Miniontoby
IRC: Miniontoby
In-game: Miniontoby
Location: The Netherlands

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

by Miniontoby » Post

W3RQ01 wrote:
Tue Dec 13, 2022 19:03
There is a mod at the same git thingy as advtrains called advtrains_platform
I suggest you to use my version as the one you currently have is specifically made for the LinuxForks server. Mine has more content and variety (Forum page of my repo)
I don't want to use that mod, becuase I don't need extra platforms, but the thing is that I tried that mod because I thought it might had been also split into a different mod...
But I am fine rn.



For Blockhead:

I will try to modify it and make it work. I will also make a PR with the working code once I got it working, since this is just on github.

Also which branch is the best to work on and the most updated?
Working on mtctl ---- Check my mod "Doorbell" -- Stay safe

Post Reply

Who is online

Users browsing this forum: LMD and 42 guests