[Server] LinuxForks (Lots of trains)
- 56independent_actual
- Member
- Posts: 452
- Joined: Sun May 23, 2021 16:10
- IRC: independent56
- In-game: 56independent
- Location: Girona Province
- Contact:
Re: [Server] LinuxForks (Lots of trains)
💥
Last edited by 56independent_actual on Sun Jan 15, 2023 15:56, edited 1 time in total.
Warnig: Al my laguage ekscept English is bad, includig Hungarian (magyàränoлиски), Spanish (esпagnyoл), and Russian (рÿсскïанöл).
-
- Member
- Posts: 15
- Joined: Sat Apr 02, 2022 15:12
- GitHub: Froggo8311
- In-game: Froggo
- Contact:
Re: [Server] LinuxForks (Lots of trains)
I don't believe anyone should be forced to give an example of such a topic, but I think that if you were to think of such a way something like this could occurr, you would come to the realization on your own.56independent_actual wrote: ↑Sun Apr 17, 2022 18:19I mean a general, hypothetical example, not calling me out on what i've already done.
- 56independent_actual
- Member
- Posts: 452
- Joined: Sun May 23, 2021 16:10
- IRC: independent56
- In-game: 56independent
- Location: Girona Province
- Contact:
Re: [Server] LinuxForks (Lots of trains)
💥
Last edited by 56independent_actual on Sun Jan 15, 2023 15:56, edited 2 times in total.
Warnig: Al my laguage ekscept English is bad, includig Hungarian (magyàränoлиски), Spanish (esпagnyoл), and Russian (рÿсскïанöл).
-
- Member
- Posts: 128
- Joined: Sun Aug 05, 2018 12:37
- In-game: Maverick2797
- Location: Poking about here and there...
Re: [Server] LinuxForks (Lots of trains)
As far as I know this has never actually been enforced, as most projects involving such stations end up being run by the server/state rail operators anyway. I could be wrong though, as the projects I've worked on have been mostly freight-based.56independent_actual wrote: ↑Sun Jun 26, 2022 11:43"Station access fees: 0MG - 1500 MG depending on station size"
I haven't fully read the older subway env code but this is how I'd imagine it works:how did the LuaATC interlocking work in the spawn subway? I know it changed signals, but how did it know that a train arrived and left?
- While Train A is at Station1 an interrupt clock regularly checks whether the train is still there. If the interrupt fires and the train has gone then it sets the signal at the previous station to green, allowing Train B to proceed from Station2.
- When Train B departs Station 2 it sets the signal it was just stopped at to Red to prevent tailgating trains following.
- This is repeated at each station, with allowances for reversing at termini etc.
After the initial explosion of growth when the server was young the main focus of the railways seem to have moved away from shorter subways that operate mainly in the main Spawn/Origin etc area to longer mainline railways that connect distant towns/cities, much like IRL railways do.How much is the rail network growing now? Has it completely frozen, only growing to consume new settlements?
The number you have called is not available during a solar eclipse. This message will self destruct in ten seconds in protest... [BEEP]
- 56independent_actual
- Member
- Posts: 452
- Joined: Sun May 23, 2021 16:10
- IRC: independent56
- In-game: 56independent
- Location: Girona Province
- Contact:
Re: [Server] LinuxForks (Lots of trains)
💥
- Attachments
-
- AmMetro.billboard.png (236.29 KiB) Viewed 2645 times
Last edited by 56independent_actual on Sun Jan 15, 2023 15:56, edited 1 time in total.
Warnig: Al my laguage ekscept English is bad, includig Hungarian (magyàränoлиски), Spanish (esпagnyoл), and Russian (рÿсскïанöл).
-
- Member
- Posts: 128
- Joined: Sun Aug 05, 2018 12:37
- In-game: Maverick2797
- Location: Poking about here and there...
Re: [Server] LinuxForks (Lots of trains)
Except that mesecons and digilines don't work in unloaded areas...56independent_actual wrote: ↑Sun Jun 26, 2022 12:48How i'd design it is that a detector track at the entry of each section alerts a LuaATC controller (using a mesecon-digilines converter) of a train entering, and then the LuaATC controller sets the signal to red until the detector at the next section's detector turns on and then off. This requires a LuaATC for each section.
But i am also thinking of an even simpler setup of detector rails close together all attached to the same signal with a NOT gate
The number you have called is not available during a solar eclipse. This message will self destruct in ten seconds in protest... [BEEP]
- 56independent_actual
- Member
- Posts: 452
- Joined: Sun May 23, 2021 16:10
- IRC: independent56
- In-game: 56independent
- Location: Girona Province
- Contact:
Re: [Server] LinuxForks (Lots of trains)
💥
Last edited by 56independent_actual on Sun Jan 15, 2023 15:56, edited 1 time in total.
Warnig: Al my laguage ekscept English is bad, includig Hungarian (magyàränoлиски), Spanish (esпagnyoл), and Russian (рÿсскïанöл).
- 56independent_actual
- Member
- Posts: 452
- Joined: Sun May 23, 2021 16:10
- IRC: independent56
- In-game: 56independent
- Location: Girona Province
- Contact:
Re: [Server] LinuxForks (Lots of trains)
💥
Last edited by 56independent_actual on Sun Jan 15, 2023 15:57, edited 3 times in total.
Warnig: Al my laguage ekscept English is bad, includig Hungarian (magyàränoлиски), Spanish (esпagnyoл), and Russian (рÿсскïанöл).
-
- Member
- Posts: 128
- Joined: Sun Aug 05, 2018 12:37
- In-game: Maverick2797
- Location: Poking about here and there...
Re: [Server] LinuxForks (Lots of trains)
"May I humbly request" or "Can someone please" sounds a hell of a lot less entitled and whining than "You should do this for the greater good." No one is entitled to such information, not even the people who play on the server. It has been given freely by someone who volunteered it after taking the time and effort to collect it. As you've been told before: don't presume to be entitled to information solely because it exists. Rejection can be disappointing.Why can't you do this for the better good of the greater Minetest community?
Last edited by Maverick2797 on Mon Jun 27, 2022 08:15, edited 1 time in total.
The number you have called is not available during a solar eclipse. This message will self destruct in ten seconds in protest... [BEEP]
- 56independent_actual
- Member
- Posts: 452
- Joined: Sun May 23, 2021 16:10
- IRC: independent56
- In-game: 56independent
- Location: Girona Province
- Contact:
Re: [Server] LinuxForks (Lots of trains)
💥
Last edited by 56independent_actual on Sun Jan 15, 2023 15:57, edited 7 times in total.
Warnig: Al my laguage ekscept English is bad, includig Hungarian (magyàränoлиски), Spanish (esпagnyoл), and Russian (рÿсскïанöл).
- Blockhead
- Member
- Posts: 1678
- Joined: Wed Jul 17, 2019 10:14
- GitHub: Montandalar
- IRC: Blockhead256
- In-game: Blockhead Blockhead256
- Location: Land Down Under
- Contact:
Re: [Server] LinuxForks (Lots of trains)
LuaATC for Subway
I've actually wanted to make a video about the subway code just because I think it's of historical interest but also as an example of how to make an interlocking system out of just LuaATC. Consider this like a partial script dump for that video.
The subway code is something like (A?)GPL'd (not sure if 2 or 3), written by orwell. It's a form of interlocking that predates what we call "TSS Interlocking". It used still in some corners of what we now call Spawn Subway (previously often just 'the subway'); or it was for some time after TSS interlocking was deployed, I haven't been paying keen attention. It was also previously used on South Forest Subway which is just one line, but that system was reworked into an interlocked one 2019. It was also used on the Mountain Railway from Euler Street Station up Mt Gabriel, nominally 'line 10', but that system has been out of service for years now since the TSS update.
The current code is as follows (it's not all properly indented, much of it may have been edited in-game. It probably started back in 2017, but has barely changed since 2019 due to maturity, stability and decreasing relevance.
Basic Operation
The guts of it is in the stn_union function which is an interesting read.
The basic operating is like you guessed. A train waits for a while before departing for the next station by closing the doors. Before leaving it checks for a green signal in a loop. It polls the signal state at random interval of 5-8 seconds, and if it gets stuck it will set the train text first to say it's waiting for preceding/oncoming train, and if that happens too many times it will say the line is out of order. When the train gets the green, it then leaves for the next station. Pre-braking with ATC tracks usually has to be applied, or at least it used to - I think advtrains may treat LuaATC tracks as LZB checkpoints now, I'm not sure exactly but station overruns seem to have decreased. If the train overruns the station, it stops the train and sets the train text to a "BrakeFail" message with the date and time. When the train arrives at the next station, it sets the signal for the previous station of the previous station back to green. The departure speed is configurable or set to maximum by default.
Returns/dead ends
Other than basic functionality there are a few different stop types under F.stn_*.
When the train gets the green, it can set/reset one turnout, this used for end of line stations when the train reverses. There is another variation but where there's no passenger stop at the end, so it's an immediate turnaround. Those are stn_return and stn_return_nohalt. In both cases the reversed train needs to have a stn_return_free after passing the turnout to set the turnout back to the right state for the next train, as well as give it the green signal.
Crossing signals and Union Stations
The other advanced function is the 'osig' or 'crossing signal' and 'union station'. Where two subway lines meet and share tracks, there is a priority and a yielding line leading into this 'union' station. The driver of the train on the priority line sees only one signal, and the yielding line sees two. Trains on the priority line set a red signal at the yielding line's station as well as the previous station on their own line, then clear both of those signals when they depart the union station. Trains on the yielding line wait for two green signals before they can depart.
The priority line doesn't have absolute priority, it just gets checked first. This really tricky bit about 'osigs' happens around lines 263-270. I'm not certain of the following explantation, it would be worth testing.. but I have inspected the code for a while now: When a train arrives at the yielding station to find it red, it adds itself to the S.union_waiting[signal_name] table entry by calling F.union_wait. This registers its intent to enter the junction, and avoids the problem of the priority line blocking all yielding line traffic. First a note on variable names: I think its prev2 is meant to be the osig from the yielding. prev1 and prev2 should be understood as the previous signal at station #1 (the priority station) and station #2 (the yielding station), not the previous station and the station before that; also the prev1 and prev2 must be consistent and not swap the priority and yielding stations, which means you should not use a conditional in the station track code. Anyway, when a train leaves the union station it will set both signals behind it to green by default. However, if a priority train leaves and the yielding line is waiting, the priority line gets blocked; vice versa - if a yielding train leaves and the priority line is waiting, the yielding line gets blocked. Looking at it from another perspective again: If a train assigned to one line leaves a union station, the only way it will set any red signal behind is if the a train on the other line is waiting for priority.
osigs cover joining lines; splitting lines are easier. The station code is wrapped in an if statement according to the train's Line Number, and the usual F.stn function can be used. There are two signals just like the yielding station, except their meaning indicates route and not two boxes that have to both be ticked.
Interlocking boundaries
That is it for LuaATC-only equipped stations. Interesting things happen at the boundaries where a line is part-LuaATC with subway env, and part-TSS-interlocking, and less excitingly at TSS interlocked stations with LuaATC instead of station/stop tracks.
F.stn_ilk is a lot like the station/stop track or F.stn_union. It uses the passive component API call "get_aspect" to poll the signal, and if the section is blocked updates the user that the section is blocked. It relies on ARS to set the signal, though setting signals can be done with set_route and then you can disable ARS; the reworked South Forest Subway used this approach which was useful before the update in later advtrains that disabled ARS while a train is stopped by a station/stop track. It may exist because it predates the station/stop track or to include more functionality; you don't see it in many places.
F.stn_ilkentry calls F.stn_ilk then sets the previous signal green, allowing any LuaATC-operating train behind to proceed, while the first train leaves the interlocked area. This is kind of technically unsafe since the second train could rear-end the first, but only if for some bizarre reason the first train fails to clear the influence point of the interlocking signal before the second train arrives, which probably means something went horribly wrong like the tracks getting griefed.
Criticism of the Subway env code
While the subway code comes with some nice features like the automatic out of order messages or waiting for train messages, some of its code is only necessary due to unreliability. For instance, the BrakeFail messages are unnecessary for an interlocked line because LZB always ensures near-perfect braking curves. Other cumbersome things are baked into the code as well, such as having to list the previous, current and next stations in the LuaATC, and having to name your signals with the passive component naming tool according to a strict naming scheme so LuaATC can find them. Also, the crossing signal/union station system is obviously quite cumbersome compared to TSS signals that just check the section state.
Using a mix of TSS interlocking and LuaATC-based interlocking creates its own problems with complexity at the boundaries, which stn_ilk* display clearly. Some boundaries were left in due to lack of time to convert the whole line, and lack of trust in TSS being reliable in the early days. In practice, both systems have had reliability issues: LuaATC code when people fiddle with the trains or the braking curve goes horribly wrong, and interlocking with malformed sections and sometimes ghost trains.
Netmapper
The netmapper idea is nice, but gabriel is too busy to do much else than play right now, call back again later in a few months.
Seriously, but also with somewhat tongue in cheek
Best wishes in future...
I've actually wanted to make a video about the subway code just because I think it's of historical interest but also as an example of how to make an interlocking system out of just LuaATC. Consider this like a partial script dump for that video.
The subway code is something like (A?)GPL'd (not sure if 2 or 3), written by orwell. It's a form of interlocking that predates what we call "TSS Interlocking". It used still in some corners of what we now call Spawn Subway (previously often just 'the subway'); or it was for some time after TSS interlocking was deployed, I haven't been paying keen attention. It was also previously used on South Forest Subway which is just one line, but that system was reworked into an interlocked one 2019. It was also used on the Mountain Railway from Euler Street Station up Mt Gabriel, nominally 'line 10', but that system has been out of service for years now since the TSS update.
The current code is as follows (it's not all properly indented, much of it may have been edited in-game. It probably started back in 2017, but has barely changed since 2019 due to maturity, stability and decreasing relevance.
Code: Select all
-- 'subway' environment --
--F.stn_union=function(line1, prev1, prev2, this, next, doors, dps, osig, ret_sw, ret_st, nohalt, waittime)
F.stationnames={
Ewb="Edenwood Beach",
Ban="Bananame",
ctr="Coulomb Street Triangle",
Cht="Churchill Street",
Bbe="Birch Bay East",
Bap="Turtle Rock",
Icm="Ice Mountain",
Eft="BHS10",
Apl="Apple Plains",
Pal="Palm Bay",
Slh="Smacker's Land of Hope and Glory",
Lks="Leekston",
Ta1="Testing Area 1",
Ta2="Testing Area 2",
Ahr="AHRAZHUL's Station",
Ahz="Large Beach",
Wim="Windy Mountains",
Dam="Szymon's Dam",
Wva="Windy Mountains Valley 1",
Wvb="Windy Mountains Valley 2",
Wvc="Windy Mountains Valley 3",
App="Apple Grove",
Dem="Desert Mountain",
Dev="Desert View (OCP)",
Lvc="Levenshtein Canyon",
Gho="Green Hope",
Snb="Snake Bend",
Adb="Adorno Boulevard",
Duf="Duff Road",
Wat="Something in the water",
Ram="Ramanujan Street",
Per="Perelman Street",
Trp="Trump Park",
Sfs="South Forest Station",
Lok="Jude Milhon Street",
Bam="Bamboo Hills",
Sfa="unnamed",
Gcl="Green Cliffs",
Dri="Dry Island",
Ged="Green Edge",
Ghb="Green Hill Beach",
Acm="Acacia Mountains",
Ghm="Greenhat Mountain",
Pna="Pence Avenue",
Dbl="Dubulti",
Sws="Schwarzschildt Street",
Mnk="Minkowsky Street",
Rgs="Robert Gardon Street",
Ehl="Ehlodex",
Lus="Lusin Street",
Lin="Lesnoi Industrial Area",
Boz="Booze Grove",
Mrh="Mirzakhani Street",
Plt="Planetarium",
Mcf="McFly Street",
Tha="Theodor Adorno Street",
Oni="Onionland",
Ora="Orange Lake",
Uaa="Eiffel Street",
Leo="Leonhard Street",
Bby="Birch Bay",
Stb="Stone Beach",
Jis="Jungle Island",
Ice="Eternal Ice",
Bnt="Pierre Berton Street",
Osa="Origin Sands",
OBa="Cartesian Square",
OOr="School",
OSc="ARA",
ONb="Intel ME Stairs",
OIs="SCSI Connector Mess",
OSm="Origin Sands (Plaza de la Republica)",
ioa="Cow Bridge",
iob="Babbage Road",
Wcs="Watson-Crick Street",
Rru="Rockefeller Runway",
Ewd="Edenwood",
Chu="Marcuse Street Station",
Erd="Erdos Street",
Uni="Museum",
Mar="Felfa's Market (Bracket Road)",
Wac="Watson-Crick",
OLv="Market",
Irk="Ice Rink",
Sbr="Suburb",
Unv="University",
Arc="Archangel",
Dar="Darwin Road",
Hmi="Half-Mile Island",
Zoo="Zoo",
Bea="Beach",
Yos="Yoshi Island",
Krs="Kernighan&Ritchie Street",
Rkb="Robert Koch Boulevard",
Rsi="Riverside",
Swr="Swimming Rabbit Street",
Wbb="Banana Forest",
Ori="Origin",
Snl="Snowland",
Sys="Ship Rock",
Rfo="Redwood forest",
Moj="Mom Junction",
Wfr="Wolf Rock",
Spa="Shanielle Park",
Thh="Treehouse Hotel",
Stn="Main station",
WB1="Riverside",
WB2="Banana Forest",
WB3="Eiffel Street",
WB4="Buckminster Fuller Street",
WB5="White Beaches",
Shn="Shanielle City",
Jus="Tom Lehrer Street",
Fre="Frege Street",
Min="MinerLand",
Vlc="Volcano Cliffs",
Mio="Minio",
Wpy="Water Pyramid",
Cat="Cathedral",
Dca="Desert Canyon",
Spn="Spawn",
Brn="Ministry of Transport (bernhardd)",
Kav="Knuth Avenue",
Lvf="Library",
Fms="John Horton Conway Street",
Mnt="Mountain",
Mnv="Mountain Valley",
Mnn="Mountain View",
Max="Maxwell Street",
Snp="Snowy Peak",
Scl="ScottishLion's City",
Lza="Laza's City",
Bld="BlackDog",
Hts="Hotel Shanielle",
Fmn="Euler Street",
Gpl="Market",
Jun="Jungle",
Jng="Franklin Road",
Uic="Coulomb Street",
Grs="Gram-Schmidt Street",
Lih="Lighthouse",
Rea="Reactor",
Hhs="Henderson-Hasselbalch Street",
Ack="Ackermann Avenue",
Lis="Lone Island",
Pyr="Pytagoras Road",
Nha="North Harbour",
STn="Technic Station",
SPo="Post Office",
SSw="Spawn, westbound",
SSe="Spawn, eastbound",
SPa="Papyrus Farm",
STo="Tourist Info",
SMi="Public Mine",
MR1="Euler Street",
MSt="Main Station (Spawn)",
MOr="Marcuse Street Station (Origin)",
}
--[[
Signal names:
F.stn(<previous>, <this>, <next>
<door side>, <Depart speed (maximum if omitted)>
Halt here and continue when signal is green.
no halt:
F.stn_nohalt=function(prev, this, next, dps, osig)
F.stn_return(<previous>, <this>, <next>,
<door side>, <Switch to set>, <State to set switch to (st/cr)>,
<Depart speed (maximum if omitted)>
Halt here. Set the switch to desired state and return when signal is green. Does not free previous section!
F.stn_return_free=function(<Signal at previous station>, <Switch>, <State>)
To be called after train left the switch of a stn_return station. Sets the switch back to incoming trains and sets signal to green.
]]
--Warning: Expects line to be a string!
local linet={
["1"] = {W="Palm Bay", E="Windy Mountains"},
["2"] = {N="Szymon's Dam", S="Onionland"},
["3"] = {S="Bananame", N="Large Beach"},
["4"] = {E="Schwarzschildt Street", W="Ice Mountain"},
["5"] = {W="Lighthouse", E="Leekston"},
["7"] = {N="Birch Bay East", S="Planetarium"},
}
F.lineterm = function(line, terminal)
if linet[line] and linet[line][terminal] then return linet[line][terminal] end
return terminal
end
F.lineset = function(line, terminal)
if event.train then
atc_set_text_outside("Line "..line.." - "..F.lineterm(line, terminal))
S.line[atc_id] = line
set_line(tonumber(line))
end
end
F.rant=function()
return math.random(5,8)
end
F.stnname=function(cap)
return F.stationnames[string.sub(cap, 1, 3)] or "?"
end
F.stn=function(prev, this, next, doors, dps, osig)
F.stn_union(nil, prev, nil, this, next, doors, dps, osig)
end
F.stn_return=function(prev, this, next, doors, switch, state, dps, osig, waittime)
F.stn_union(nil, prev, nil, this, next, doors, dps, osig, switch, state, false, waittime)
end
F.stn_return_nohalt=function(prev, this, next, switch, state, dps)
F.stn_union(nil, prev, nil, this, next, "C", dps, osig, switch, state, true)
end
F.stn_return_free=function(prev, switch, state)
if event.train then
setstate(prev, "green")
setstate(switch, state)
end
end
F.stn_nohalt=function(prev, this, next, dps, osig)
F.stn_union(nil, prev, nil, this, next, "C", dps, osig, nil, nil, true)
end
F.union_wait=function(sect)
S.union_waiting[sect] = not depart
end
F.stn_union=function(line1, prev1, prev2, this, next, doors, dps, osig, ret_sw, ret_st, nohalt, waittime)
if not atc_id then
atc_send("B0")
error("Train has disappeared!")
end
if not atc_arrow then
atc_send("B0")
error("Train passed in wrong direction!")
end
depart=false
if event.train then
setstate(prev1, "red")
if prev2 then setstate(prev2, "red") end
atc_send("B0O"..doors)
if atc_speed and atc_speed > 10 then
local dt = os.date()
atc_set_text_outside("BrakeFail speed="..atc_speed.." when="..dt.year.."-"..dt.month.."-"..dt.day.." "..dt.hour..":"..dt.min..":"..dt.sec)
error("Train "..atc_id.." has passed rail at speed of "..atc_speed)
end
if not nohalt then
interrupt(waittime or (ret_sw and 20 or 7), "ready")
atc_set_text_inside(F.stnname(this))
end
end
if (event.int and event.message=="ready") or (event.train and nohalt) then
if getstate(this)=="green" and (not osig or getstate(osig)=="green") then
if ret_sw then
atc_send("OCD1B0WRS"..(dps or "M"))
setstate(ret_sw, ret_st)
else
atc_send("OCD1S"..(dps or "M"))
setstate(prev1, "green")
if line1 then --this call did not come from F.stn, do union stuff
setstate(prev2, "green")
if S.line[atc_id]==line1 then
if S.union_waiting[prev2] then setstate(prev1, "red") end
else
if S.union_waiting[prev1] then setstate(prev2, "red") end
end
end
end
setstate(this, "red")
atc_set_text_inside("Next stop: "..F.stnname(next))
depart=true
nodepartc=nil
else
interrupt(F.rant(), "ready")
nodepartc=nodepartc and nodepartc+1 or 0
if nodepartc>=10 then
atc_set_text_inside(F.stnname(this).."\nLine out of order!")
else
if (not osig or getstate(osig)=="green") then
atc_set_text_inside(F.stnname(this).."\nWaiting for preceding train...")
else
atc_set_text_inside(F.stnname(this).."\nWaiting for oncoming train...")
end
end
end
end
end
F.pre=function(signal)
if getstate(signal) == "red" then
atc_send("B4")
end
end
F.uiclog = function ()
return
end
--L197
F.stat=function(line, init)
--statistics
-- init
if init then
reftrain = atc_id
a_tbt = 30
a_tbtmax = 30
a_rtt = 500
a_not = 0
c_not = 0
c_tbtmax = 0
time_lt = os.time()
time_rt=os.time()
end
if not a_tbtmax then a_tbtmax = 30 end
if not c_tbtmax then c_tbtmax = 0 end
--real code
if event.train then
local time = os.time()
c_not = c_not + 1
a_tbt = (a_tbt + (time - time_lt)) / 2
c_tbtmax = math.max(c_tbtmax, (time - time_lt))
if atc_id == reftrain then
a_rtt = (a_rtt*0.2 + (time - time_rt)*0.8)
a_not = c_not
c_not = 0
a_tbtmax = (a_tbtmax + c_tbtmax) / 2
c_tbtmax = 0
end
digiline_send("stats", "Stat: "..line..
" NoT:"..a_not.."("..c_not..")"..
" TbT:"..math.floor(a_tbt).."("..(time-time_lt)..")"..
" Tmx:"..math.floor(a_tbtmax).."("..c_tbtmax..")"..
" R:"..math.floor(a_rtt).."("..(time - time_rt)..")"
)
time_lt = time
if atc_id == reftrain then
time_rt = time
end
end
end
local function aspect_is_free(asp)
if type(asp.main) == "table" then
return asp.main.free
else
return asp.main ~= 0
end
end
-- 21.1.19, the rise of tss
F.stn_ilk=function(prev, this, next, doors, dps)
depart = false
if event.train then
atc_send("B0 W O"..doors)
atc_set_text_inside(F.stnname(this))
interrupt(7, "ready")
elseif event.int then
local asp = get_aspect(this)
if not asp then
atc_set_text_inside(F.stnname(this).."\nNo aspect for "..this)
else
if aspect_is_free(asp) then
atc_set_text_inside("Next stop:\n"..F.stnname(next))
atc_send("OC D1 S"..(dps or "M"))
depart = true
return
else
atc_set_text_inside(F.stnname(this).."\nSection ahead is blocked...")
end
end
interrupt(7, "ready")
end
end
F.stn_ilkentry=function(prev, this, next, doors, dps)
F.stn_ilk(prev, this, next, doors, dps)
if depart then setstate(prev, "green") end
end
The guts of it is in the stn_union function which is an interesting read.
The basic operating is like you guessed. A train waits for a while before departing for the next station by closing the doors. Before leaving it checks for a green signal in a loop. It polls the signal state at random interval of 5-8 seconds, and if it gets stuck it will set the train text first to say it's waiting for preceding/oncoming train, and if that happens too many times it will say the line is out of order. When the train gets the green, it then leaves for the next station. Pre-braking with ATC tracks usually has to be applied, or at least it used to - I think advtrains may treat LuaATC tracks as LZB checkpoints now, I'm not sure exactly but station overruns seem to have decreased. If the train overruns the station, it stops the train and sets the train text to a "BrakeFail" message with the date and time. When the train arrives at the next station, it sets the signal for the previous station of the previous station back to green. The departure speed is configurable or set to maximum by default.
Returns/dead ends
Other than basic functionality there are a few different stop types under F.stn_*.
When the train gets the green, it can set/reset one turnout, this used for end of line stations when the train reverses. There is another variation but where there's no passenger stop at the end, so it's an immediate turnaround. Those are stn_return and stn_return_nohalt. In both cases the reversed train needs to have a stn_return_free after passing the turnout to set the turnout back to the right state for the next train, as well as give it the green signal.
Crossing signals and Union Stations
The other advanced function is the 'osig' or 'crossing signal' and 'union station'. Where two subway lines meet and share tracks, there is a priority and a yielding line leading into this 'union' station. The driver of the train on the priority line sees only one signal, and the yielding line sees two. Trains on the priority line set a red signal at the yielding line's station as well as the previous station on their own line, then clear both of those signals when they depart the union station. Trains on the yielding line wait for two green signals before they can depart.
The priority line doesn't have absolute priority, it just gets checked first. This really tricky bit about 'osigs' happens around lines 263-270. I'm not certain of the following explantation, it would be worth testing.. but I have inspected the code for a while now: When a train arrives at the yielding station to find it red, it adds itself to the S.union_waiting[signal_name] table entry by calling F.union_wait. This registers its intent to enter the junction, and avoids the problem of the priority line blocking all yielding line traffic. First a note on variable names: I think its prev2 is meant to be the osig from the yielding. prev1 and prev2 should be understood as the previous signal at station #1 (the priority station) and station #2 (the yielding station), not the previous station and the station before that; also the prev1 and prev2 must be consistent and not swap the priority and yielding stations, which means you should not use a conditional in the station track code. Anyway, when a train leaves the union station it will set both signals behind it to green by default. However, if a priority train leaves and the yielding line is waiting, the priority line gets blocked; vice versa - if a yielding train leaves and the priority line is waiting, the yielding line gets blocked. Looking at it from another perspective again: If a train assigned to one line leaves a union station, the only way it will set any red signal behind is if the a train on the other line is waiting for priority.
osigs cover joining lines; splitting lines are easier. The station code is wrapped in an if statement according to the train's Line Number, and the usual F.stn function can be used. There are two signals just like the yielding station, except their meaning indicates route and not two boxes that have to both be ticked.
Interlocking boundaries
That is it for LuaATC-only equipped stations. Interesting things happen at the boundaries where a line is part-LuaATC with subway env, and part-TSS-interlocking, and less excitingly at TSS interlocked stations with LuaATC instead of station/stop tracks.
F.stn_ilk is a lot like the station/stop track or F.stn_union. It uses the passive component API call "get_aspect" to poll the signal, and if the section is blocked updates the user that the section is blocked. It relies on ARS to set the signal, though setting signals can be done with set_route and then you can disable ARS; the reworked South Forest Subway used this approach which was useful before the update in later advtrains that disabled ARS while a train is stopped by a station/stop track. It may exist because it predates the station/stop track or to include more functionality; you don't see it in many places.
F.stn_ilkentry calls F.stn_ilk then sets the previous signal green, allowing any LuaATC-operating train behind to proceed, while the first train leaves the interlocked area. This is kind of technically unsafe since the second train could rear-end the first, but only if for some bizarre reason the first train fails to clear the influence point of the interlocking signal before the second train arrives, which probably means something went horribly wrong like the tracks getting griefed.
Criticism of the Subway env code
While the subway code comes with some nice features like the automatic out of order messages or waiting for train messages, some of its code is only necessary due to unreliability. For instance, the BrakeFail messages are unnecessary for an interlocked line because LZB always ensures near-perfect braking curves. Other cumbersome things are baked into the code as well, such as having to list the previous, current and next stations in the LuaATC, and having to name your signals with the passive component naming tool according to a strict naming scheme so LuaATC can find them. Also, the crossing signal/union station system is obviously quite cumbersome compared to TSS signals that just check the section state.
Using a mix of TSS interlocking and LuaATC-based interlocking creates its own problems with complexity at the boundaries, which stn_ilk* display clearly. Some boundaries were left in due to lack of time to convert the whole line, and lack of trust in TSS being reliable in the early days. In practice, both systems have had reliability issues: LuaATC code when people fiddle with the trains or the braking curve goes horribly wrong, and interlocking with malformed sections and sometimes ghost trains.
Netmapper
The netmapper idea is nice, but gabriel is too busy to do much else than play right now, call back again later in a few months.
Seriously, but also with somewhat tongue in cheek
Best wishes in future...
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂
- 56independent_actual
- Member
- Posts: 452
- Joined: Sun May 23, 2021 16:10
- IRC: independent56
- In-game: 56independent
- Location: Girona Province
- Contact:
Re: [Server] LinuxForks (Lots of trains)
💥
Last edited by 56independent_actual on Sun Jan 15, 2023 15:57, edited 1 time in total.
Warnig: Al my laguage ekscept English is bad, includig Hungarian (magyàränoлиски), Spanish (esпagnyoл), and Russian (рÿсскïанöл).
- orwell
- Member
- Posts: 958
- Joined: Wed Jun 24, 2015 18:45
- GitHub: orwell96
- IRC: orwell96_mt
- In-game: orwell
- Location: Raxacoricofallapatorius
Re: [Server] LinuxForks (Lots of trains)
I've never put down a license statement, so here it is. GPLv3 or later - (c) 2017-2021 orwell96 and contributors. I hope all people who edited something in agree with this.
What you write is mainly correct, but I'd like to add, clarify and correct a few things.
The code around S.union_waiting is not there to establish kind of a "priority", but rather to ensure that trains at a line union are alternating. It works as follows:
Let's say Line 1 - coming from Station A - and Line 2 - coming from station B - merge at a station C. A train of line 1 is about to depart from station C.
In the non-union case, the code would now set the signal at the previous station green. Now at the union there are two "previous signals" prev1 and prev1. What happens now is:
- If there is a train of the other line (Line 2) waiting at B, then only the signal at station B is cleared. This makes sure that only the Line 2 train can follow the Line 1 train, and no Line 1 train can squeeze in between. (it doesn't matter whether there is a Line 1 train at all...)
- If there is no Line 2 train waiting, both signals are cleared. This prevents a deadlock if Line 2 is out of order.
There was a priority system somewhen prior, but this worked with osigs (see below).
The osig has a different purpose. Generally speaking it is one additional signal that needs to be green for the train to proceed, in addition to the "next block free" signal. The stn functions do not touch it otherwise, so this needs to be done by additional code in the station rails:
Code: Select all
F.stn(...)
if depart then
setstate("Stn4WOs","red")
end
The other purpose is single-track lines. This kind of setup is (was?) heavily used in the Spawn Mountain railway. There, everytime a train enters a single-track section, it sets the two osigs guarding the section to red. When it arrives at the next station, it sets the two osigs guarding the section to green again, so an oncoming train can enter the section. Spawn Mountain Railway even has one very special station where the trains reverse and go uphill or downhill via a crossover - which is even more challenging since the crossover needs to be guarded as well and took me some time to figure out :).
The mentioned junction priority was just that if a priority line arrived at the station before the junction, it would set an osig for the non-priority line.
Hope this makes things clearer...
-
- New member
- Posts: 1
- Joined: Tue Jul 05, 2022 17:00
- In-game: platina nutmegriot
- Contact:
Re: [Server] LinuxForks (Lots of trains)
Hi! I'd love to join the server, but I keep getting an error saying "Access denied. Reason: Invalid password". I've tried multiple names and nothing seems to be working. Are they taken, or is there another step to register?
- 56independent_actual
- Member
- Posts: 452
- Joined: Sun May 23, 2021 16:10
- IRC: independent56
- In-game: 56independent
- Location: Girona Province
- Contact:
Re: [Server] LinuxForks (Lots of trains)
💥
Last edited by 56independent_actual on Sun Jan 15, 2023 15:57, edited 2 times in total.
Warnig: Al my laguage ekscept English is bad, includig Hungarian (magyàränoлиски), Spanish (esпagnyoл), and Russian (рÿсскïанöл).
-
- Member
- Posts: 128
- Joined: Sun Aug 05, 2018 12:37
- In-game: Maverick2797
- Location: Poking about here and there...
Re: [Server] LinuxForks (Lots of trains)
Before anyone gets offended, 56independent was refering to themself here...56independent_actual wrote: ↑Tue Jul 05, 2022 21:09Due to a chaos-causing gay autist who did not understand how to speak with other people in a neurotypical way, the server has blocked off access to new players. For now, if you want a similar playing experience, go to Tunnler's Abyss, which also has a large rail network with a large community to support it.nutmegriot wrote: ↑Tue Jul 05, 2022 19:07Hi! I'd love to join the server, but I keep getting an error saying "Access denied. Reason: Invalid password". I've tried multiple names and nothing seems to be working. Are they taken, or is there another step to register?
@nutmegriot yes sadly due to a lot of recent drama involving harrassment and a doxing incident (not just the chaos refered to above) afaik the server is closed to new players for the time being with a master password. The harrasment got bad enough that posts on this forum thread were deleted by the mods.
IMO the "incorrect password" error message is really misleading when there's a master password set. It implies that the user account already exists, rather than a new one is being created. Perhaps a MT bug?
The number you have called is not available during a solar eclipse. This message will self destruct in ten seconds in protest... [BEEP]
Re: [Server] LinuxForks (Lots of trains)
Joined this server years ago and was thinking about playing on it again. I have migrated computers a couple of times sense then and didn't bother to save or write down my username or password for this server and I have just now noticed that it doesn't allow new accounts. While I was trying to find a way of recalling my username I do also remember writing a page on the wiki which I no longer can access likewise due to it now being private. The page was for a bike path I built that went north to south in a straight line next to the following locations I can see on the online map: just west of Bamboo Bay Village, directly south of Unnamed Lake LBB1, and connected to the S17 rail route. Could someone with access tell me what username I used based of that or otherwise provide some way of accessing the server again? Thanks.
- Blockhead
- Member
- Posts: 1678
- Joined: Wed Jul 17, 2019 10:14
- GitHub: Montandalar
- IRC: Blockhead256
- In-game: Blockhead Blockhead256
- Location: Land Down Under
- Contact:
Re: [Server] LinuxForks (Lots of trains)
Username is eliza. I hope you remember your password :)
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂
-
- Member
- Posts: 38
- Joined: Sat Jun 06, 2020 00:21
- GitHub: Emojigit
Re: [Server] LinuxForks (Lots of trains)
Trainzzzzzzzz!
Have a look at my mod >> https://content.minetest.net/users/Emojiminetest <<
Re: [Server] LinuxForks (Lots of trains)
I swear I wrote my password for LF down, but near as I can tell I must have done the old accidental select/overwrite flub because it's just not there anymore. (I know it involved a Frank Zappa reference, but all the ones I can think of didn't do the trick, lol)
So, who do I PM to get my password reset?
So, who do I PM to get my password reset?
Lead dev of Exile, git repo: https://codeberg.org/Mantar/Exile
-
- Member
- Posts: 128
- Joined: Sun Aug 05, 2018 12:37
- In-game: Maverick2797
- Location: Poking about here and there...
Re: [Server] LinuxForks (Lots of trains)
@gpcfMantar wrote: ↑Thu Oct 13, 2022 03:58I swear I wrote my password for LF down, but near as I can tell I must have done the old accidental select/overwrite flub because it's just not there anymore. (I know it involved a Frank Zappa reference, but all the ones I can think of didn't do the trick, lol)
So, who do I PM to get my password reset?
The number you have called is not available during a solar eclipse. This message will self destruct in ten seconds in protest... [BEEP]
- 56independent_actual
- Member
- Posts: 452
- Joined: Sun May 23, 2021 16:10
- IRC: independent56
- In-game: 56independent
- Location: Girona Province
- Contact:
Re: [Server] LinuxForks (Lots of trains)
💥
Last edited by 56independent_actual on Sun Jan 15, 2023 15:58, edited 2 times in total.
Warnig: Al my laguage ekscept English is bad, includig Hungarian (magyàränoлиски), Spanish (esпagnyoл), and Russian (рÿсскïанöл).
- Festus1965
- Member
- Posts: 4181
- Joined: Sun Jan 03, 2016 11:58
- GitHub: Festus1965
- In-game: Festus1965 Thomas Thailand Explorer
- Location: Thailand ChiangMai
- Contact:
Re: [Server] LinuxForks (Lots of trains)
... so the policy might have to be bound in the page of56independent_actual wrote: ↑Sat Dec 03, 2022 10:32My server might end up in Spain so i've been looking at privacy policies so i don't go to prison as soon as it is sent online.
I'd like to inform you that forcing people to login to see the privacy policy and disclaimers might be a violation of GDPR as users are deprived of the right to see what their data is used for freely.
* register ?
* or getting an own page with menu at start the client to look them ?
the most problem is for people the IP address - so don't use ban mods that store full 4 octets.
Last edited by Festus1965 on Sun Dec 04, 2022 01:21, edited 1 time in total.
Human has no future (climate change)
If urgend, you find me in Roblox (as CNXThomas)
If urgend, you find me in Roblox (as CNXThomas)
- rubenwardy
- Moderator
- Posts: 6978
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
Re: [Server] LinuxForks (Lots of trains)
GDPR only applies to organisations, not individual hosts. All you really need to do is have a privacy policy and allow deleting personal data (which Minetest doesn't have much of, mainly chat messages)
Ianal
Ianal
Who is online
Users browsing this forum: No registered users and 14 guests