[Mod] Advanced Trains [advtrains] [2.4.3]

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

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

by orwell » Post

papou30 wrote:Just a note to thank you pheonixfire and orwell for the time you have dedicated me because now everything works very well. You really friendly and attentive. Once again a very big thank you.
You`re welcome. Have fun!
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

wziard
Member
Posts: 127
Joined: Mon Oct 29, 2018 19:12

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

by wziard » Post

Awesome train mod.

I have a strange bug however: in my server I get messages like these:
2018-10-29 21:30:34: WARNING[Server]: ServerEnv: Trying to store id = 0 statically but block (19,0,-5) already contains 2171 objects.

- the -5 sometimes is -4.
- When I teleport to that location, there's nothing visibly there.
- the 2171 keeps going up. I can't really put a finger on it, but I think it goes up each time I quit the server and restart it. During a run it stays constant (for a while at least)

if I use a debugger to see what the 2171 stored objects contain I get an endless list of this:

<snip>
{type = 7 '\a', pos = {X = 3180, Y = 90, Z = -672}, data = "\001\000\023advtrains:discouple\000\000\000\tDISCOUPLE\000\n", '\000' <repeats 15 times>}, {type = 7 '\a', pos = {X
= 3180, Y = 90, Z = -672}, data = "\001\000\023advtrains:discouple\000\000\000\tDISCOUPLE\000\n", '\000' <repeats 15 times>}, {type = 7 '\a', pos = {X = 3180, Y = 90, Z = -672}, data = "\001\000\023advtrai
ns:discouple\000\000\000\tDISCOUPLE\000\n", '\000' <repeats 15 times>}, {type = 7 '\a', pos = {X = 3180, Y = 90, Z = -672}, data = "\001\000\023advtrains:discouple\000\000\000\tDISCOUPLE\000\n", '\000' <re
peats 15 times>}, {type = 7 '\a', pos = {X = 3180, Y = 90, Z = -672}, data = "\001\000\023advtrains:discouple\000\000\000\tDISCOUPLE\000\n", '\000' <repeats 15 times>},
<snip>

Does anybody have any ideas how to debug? I'm not (yet) really fluent in lua, and especially not in the interaction between the minetest engine and lua in a debugging situation.

For now the server keeps running as if nothing's wrong, but I suspect it will become a problem eventually?

gpcf
Member
Posts: 382
Joined: Fri May 27, 2016 10:48
GitHub: gpcf
In-game: gabriel

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

by gpcf » Post

I put your bug into our bug tracker:
https://bugs.linux-forks.de/advtrains/73.html

It seems that the discouple entities do not get destroyed when the blocks get unloaded. I think this can be fixed by setting some entity property that was created specifically for advtrains, that forbids the server from saving the entities statically.

User avatar
BuckarooBanzay
Member
Posts: 435
Joined: Tue Apr 24, 2018 05:58
GitHub: BuckarooBanzay
IRC: BuckarooBanzai
In-game: BuckarooBanzai

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

by BuckarooBanzay » Post

Can someone provide some example code for the lua-automation.
As far as i understand there is an initialization-code and a piece of code that gets executed if a train drives over the lua-track.
My goal is to build a two-way track with multiple trains on it and the "normal" atc-rail is just too simple for that.

Thanks, and great work by the way :)
¯\_(ツ)_/¯ Not active here anymore, contact me on the minetest discord, irc, lemmy or github (for programming issues)

wziard
Member
Posts: 127
Joined: Mon Oct 29, 2018 19:12

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

by wziard » Post

gpcf wrote: It seems that the discouple entities do not get destroyed when the blocks get unloaded. I think this can be fixed by setting some entity property that was created specifically for advtrains, that forbids the server from saving the entities statically.

I *think* I saw something like that in the C++ code. I'll have a look myself as well and report my findings in the bug tracker.

Thanks

edit:
I found it. I'm a bit busy right now and I didn't really understand how to add something to that bug tracker so I'll post my (extremely simple) patch here:

diff --git a/advtrains/couple.lua b/advtrains/couple.lua
index 7e99571..6d5428b 100644
--- a/advtrains/couple.lua
+++ b/advtrains/couple.lua
@@ -18,7 +18,7 @@ minetest.register_entity("advtrains:discouple", {
collisionbox = {-0.3,-0.3,-0.3, 0.3,0.3,0.3},
visual_size = {x=0.7, y=0.7},
initial_sprite_basepos = {x=0, y=0},
-
+ static_save = false,
is_discouple=true,
on_activate=function(self, staticdata)
if staticdata=="DISCOUPLE" then

gpcf
Member
Posts: 382
Joined: Fri May 27, 2016 10:48
GitHub: gpcf
In-game: gabriel

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

by gpcf » Post

wizard: just send an e-mail to 73@bugs.linux-forks.de. I will see if I can test your patch soon and merge it into advtrains.

gpcf
Member
Posts: 382
Joined: Fri May 27, 2016 10:48
GitHub: gpcf
In-game: gabriel

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

by gpcf » Post

Orwell has fixed it for the tss branch (see https://git.bananach.space/advtrains.gi ... 819988539f). The master branch is legacy, it should be considered deprecated.

wziard
Member
Posts: 127
Joined: Mon Oct 29, 2018 19:12

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

by wziard » Post

It would be nice if this was stated in the Readme. For me a s a complete noob that is not obvious :-)

I'll send the patch for the main branch. though testing the patch is probably more work than manually adding
static_save = false
in couple.lua

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

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

by orwell » Post

Thanks, and welcome in the community, wizard.
I just forgot the static_save property in the couples. And it is true that I do only backport important changes to "master" anymore. I will make the current "tss" branch the new main branch soon.
This is indeed somthing I should also put on master.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

Dan2018
Member
Posts: 26
Joined: Mon Mar 12, 2018 15:07

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

by Dan2018 » Post

This mod looks amazing.

Before i stick it on our server. Could you let me know if theres a way to protect the trains on multiplayer servers?
Last time i stuck something on without protection it caused chaos.

Many thanks

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

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

by orwell » Post

Currently, trains you place should be protected from others, however, this is somewhat broken. It is one of the big ToDos I just couldnt adress yet because of limited time.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

Dan2018
Member
Posts: 26
Joined: Mon Mar 12, 2018 15:07

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

by Dan2018 » Post

ok ta,

WIll wait a little bit longer.

User avatar
BuckarooBanzay
Member
Posts: 435
Joined: Tue Apr 24, 2018 05:58
GitHub: BuckarooBanzay
IRC: BuckarooBanzai
In-game: BuckarooBanzai

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

by BuckarooBanzay » Post

Is there a procedure i have to follow to update to the tss branch?
I switched from the latest master to the tss and now my trains are killing me when accelerating and take me with them without me being near them :P (it was funny at first but did get annoying with time..)

Anyways: cool mod, keep up the good work
¯\_(ツ)_/¯ Not active here anymore, contact me on the minetest discord, irc, lemmy or github (for programming issues)

gpcf
Member
Posts: 382
Joined: Fri May 27, 2016 10:48
GitHub: gpcf
In-game: gabriel

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

by gpcf » Post

@orwell: maybe the pickup radius was increased?

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

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

by orwell » Post

BuckarooBanzay wrote:Is there a procedure i have to follow to update to the tss branch?
I switched from the latest master to the tss and now my trains are killing me when accelerating and take me with them without me being near them :P (it was funny at first but did get annoying with time..)

Anyways: cool mod, keep up the good work
This is nothing you did wrong, but is rather caused by a bug that existed previously that has now been resolved. The trains you now get teleported to are the ones you flew out of somewhen before.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
BuckarooBanzay
Member
Posts: 435
Joined: Tue Apr 24, 2018 05:58
GitHub: BuckarooBanzay
IRC: BuckarooBanzai
In-game: BuckarooBanzai

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

by BuckarooBanzay » Post

orwell wrote:
BuckarooBanzay wrote:Is there a procedure i have to follow to update to the tss branch?
I switched from the latest master to the tss and now my trains are killing me when accelerating and take me with them without me being near them :P (it was funny at first but did get annoying with time..)

Anyways: cool mod, keep up the good work
This is nothing you did wrong, but is rather caused by a bug that existed previously that has now been resolved. The trains you now get teleported to are the ones you flew out of somewhen before.
Thanks for the reply, i still get killed when i drive too fast :O
https://imgur.com/a/RnpOSEd
Image
Except if i use the admin-account with higher privs.
Versions:
  • advtrains: tss branch
  • minetest: 0.4.17.1




EDIT: it seems the value for the train-id does get assigned nil: wagons.lua, line 649

Code: Select all

advtrains.player_to_train_mapping[clicker:get_player_name()]=self.train_id
Last edited by BuckarooBanzay on Wed Nov 07, 2018 21:13, edited 1 time in total.
¯\_(ツ)_/¯ Not active here anymore, contact me on the minetest discord, irc, lemmy or github (for programming issues)

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

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

by orwell » Post

:/ one more item to investigate on.
Added to bugtracker
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

python_megapixel
New member
Posts: 1
Joined: Tue Nov 13, 2018 14:23
In-game: python_megapixel

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

by python_megapixel » Post

I read the guide to the interlocking system - seems simple enough, except even though I play in creative mode I can't find the markers for the end of a track sector in the inventory...

papou30
Member
Posts: 11
Joined: Thu Oct 18, 2018 10:31
GitHub: papou30
In-game: papou30

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

by papou30 » Post

Hello, a little problem with the "detailed steam engine" When driving this machine the sound is impeccable but as soon as you go down the sound remains until disconnecting the server!
Last edited by papou30 on Sun Dec 09, 2018 22:03, edited 1 time in total.

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

The ominous TSS branch and the interlocking system

by orwell » Post

The ominous TSS branch and the interlocking system
Hello people,

I post this to clean the confusion over terms like "tss branch" and "interlocking system":

About half a year ago, I started reimplementing large parts of some internal logic of advtrains. The version control system (git) allows to create separate branches that do not affect the "stable" main version ("master branch") and can be independently developed. Back then, I created such a branch, named "tss" (short for "track section signalling", see after)
That rewrite was done some months ago, and I started with the original goal of the whole operation, which was implementing an interlocking system (search the internet for what that is, or see http://advtrains.bleipb.de/interlocking) on top of this new "tss branch". But I didn't want to "merge" my rewrite back into the stable "master" branch because it was possible that there were bugs I was unaware of, and wanted it to prove working. On the "master" branch, only important bugfixes were still made.

The interlocking system has progressed pretty far in the last months, and during this time it seems like I've eliminated all critical bugs in the core logic that have shown up. Therefore, I will declare the "tss" stable and make it the new "master" branch somewhen around the new year.

However, you can already do this step now if you don't want to wait. But before "upgrade" advtrains to "tss", I recommend you to make a backup of all worlds you use advtrains in and don't wish to be broken, because:
1. Once you switch to "tss", you cannot go back*
2. It might be possible that some things get lost or even the whole world gets corrupt during the upgrade.
3. I should note that the "add-on" mods that are linked in the main post are probably not compatible to TSS
EDIT: it should work, except for any storage wagons. First try with extensions, if it crashes, disable the extensions.


To do this, follow these steps:
If you've installed using git:
1. back up your world(s)
2. $ git checkout tss
If not:
1. back up your world(s)
2. delete old "advtrains" folder
3. https://git.bananach.space/advtrains.git/log/?h=tss
4. Select top entry in list
5. select one of the download formats
6. save, unpack, as you would install any other modpack.

Temporarily does not work, see here viewtopic.php?f=11&t=14726&start=1125#p339307

Please report any bugs, inconveniences, data losses or weird behaviors you encounter at https://www.linux-forks.de/advtrains/ (or here)! You will be helping me a lot.

Small note in between: the difference between "safety" and "security"
Safety means a system is secured against failure caused by itself or some component inside the system (for a railway, this would be the tracks, vehicles and the train driver)
Security means a system is secured against external disturbances, components outside of the system (for our mod, this would be malicious players randomly decoupling wagons or throwing sand onto tracks)

What follows is an incomplete list of the most important changes that happened in "tss":
- Completely rewritten path logic:
-- inofficial internal "API" for path update callbacks
-- reverse lookup of positions to train path indices
-> This simplified a lot of code and probably eliminated some minor bugs that existed before, especially the buggy coupling behavior

- Fix yaw/looking direction behavior
-> Trains now finally appear in the direction they were placed

- Reworked security
-> Things now actually work
-> There are no longer "couple locks" because this only confused players.

- Track sections
-> Trains can occupy certain track sections, which can be used in combination with the latter features

- Signals and "LZB"
-- There are some new signals and a unified API for "signal aspects" (things that a signal tells to a train driver)
-- By setting an "Influence Point", the obeyance of those aspects is enforced automatically using a system similar to ETCS, LZB and the like (but without technical equipment, because the whole mod is a simulation and all parameters are known at any time)

- Train (and shunt) routes
-- Trains can be guided along secured paths to prevent collisions or accidents, where all turnouts are locked and cannot be reversed

- Speed restrictions
-- Both signals and special signs can set up speed restrictions for trains
-> all of them work using the Signal API and the aforementioned "Influence Points"

If I forgot something you've noticed, tell me.
I look forward to hear feedback from you.
- orwell

* There is a possibility to downgrade, but this might still result in data loss or might not work at all:
1. revert back to "master" (don't start world)
2. go into world directory, open the file "advtrains" with a text editor
3. Using the "Find" function (Ctrl-F), locate "version"
4. change value there to 1
5. save file, close, start world.
Last edited by orwell on Sat Jan 05, 2019 13:01, edited 4 times in total.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

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

by orwell » Post

And here are some pictures of the new things in the interlocking system:
Spoiler
german-style shunt signals:
Image

Speed restriction (the unit is actually m/s, alias number of +'es in the driver stand)
Image

That red sign means that shunt moves are not allowed to proceed (this would endanger the main line here):
Image
In Germany, the sign looks this way: https://www.bilder-hochladen.net/files/ ... y-5989.jpg

On this, you need to know that the Influence Point of the speed sign is set behind the one of the main signal, because the signal aspect of the main signal is interpreted as "proceed at maximum speed" and would clear the restriction.
Image
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

Mikola
Member
Posts: 16
Joined: Fri Nov 24, 2017 18:01
GitHub: Mikola314
In-game: mikola

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

by Mikola » Post

It looks very exciting, but without full instructions it is very difficult to understand how this should work.
Please make detailed full instructions with screenshots on the arrangement, tuning and using signals_ks, interlocking, line_automation and luaautomation.
Earlier you gave a link to the manual:
http://advtrains.bleipb.de/interlocking/
Is this guide still relevant?

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

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

by orwell » Post

Yep, although it does not cover everything.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

Dan2018
Member
Posts: 26
Joined: Mon Mar 12, 2018 15:07

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

by Dan2018 » Post

Just trying out AT on the server. Few questions

On startup we get the message
"Undeclared global variable "id" accessed at ..\advtrains\advtrains\trainlogic.lua:111"

Also normal users dont seem to be able to attach wagons. Given train_operator but they dont attach.

Is there a train_admin priv now? Read in documentation but doesnt seem to exist.

Is there away to stop people loosing their stuff when hit by a train? Have the server setup to keep their items but with trains they loose it all.

Running minetest 0.4.17

Thanks

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

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

by orwell » Post

To add-on/extension developers:
If you're adding wagons with an inventory, you need to update the get_inventory_formspec() function as follows:

Code: Select all

	get_inventory_formspec = function(self, pname, invname)
		return "size[8,11]"..
			"list["..invname..";box;0,0;8,3;]"..
			"list[current_player;main;0,5;8,4;]"..
			"listring[]"
	end,
Else, it won't be compatible with the TSS branch
This change is also being respected by current master branch, so it then supports both branches.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 8 guests