Page 45 of 50

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

PostPosted: Wed Oct 24, 2018 13:05
by orwell
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!

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

PostPosted: Mon Oct 29, 2018 20:36
by wziard
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?

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

PostPosted: Tue Oct 30, 2018 07:11
by gpcf
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.

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

PostPosted: Tue Oct 30, 2018 08:30
by BuckarooBanzay
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 :)

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

PostPosted: Tue Oct 30, 2018 08:41
by wziard
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

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

PostPosted: Tue Oct 30, 2018 09:09
by gpcf
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.

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

PostPosted: Tue Oct 30, 2018 18:03
by gpcf
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.

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

PostPosted: Fri Nov 02, 2018 06:52
by wziard
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

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

PostPosted: Sat Nov 03, 2018 12:05
by orwell
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.

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

PostPosted: Mon Nov 05, 2018 12:25
by Dan2018
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

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

PostPosted: Mon Nov 05, 2018 12:44
by orwell
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.

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

PostPosted: Mon Nov 05, 2018 14:12
by Dan2018
ok ta,

WIll wait a little bit longer.

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

PostPosted: Wed Nov 07, 2018 10:54
by BuckarooBanzay
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

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

PostPosted: Wed Nov 07, 2018 13:41
by gpcf
@orwell: maybe the pickup radius was increased?

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

PostPosted: Wed Nov 07, 2018 14:35
by orwell
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.

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

PostPosted: Wed Nov 07, 2018 16:59
by BuckarooBanzay
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

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

PostPosted: Wed Nov 07, 2018 18:37
by orwell
:/ one more item to investigate on.
Added to bugtracker

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

PostPosted: Sat Nov 17, 2018 20:04
by python_megapixel
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...

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

PostPosted: Thu Nov 22, 2018 16:09
by papou30
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!

The ominous TSS branch and the interlocking system

PostPosted: Sat Dec 08, 2018 18:13
by orwell
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.

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

PostPosted: Sat Dec 08, 2018 18:22
by orwell
And here are some pictures of the new things in the interlocking system:
+ Spoiler

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

PostPosted: Sun Dec 09, 2018 20:57
by Mikola
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?

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

PostPosted: Sun Dec 09, 2018 22:39
by orwell
Yep, although it does not cover everything.

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

PostPosted: Mon Dec 10, 2018 12:00
by Dan2018
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

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

PostPosted: Mon Dec 10, 2018 22:21
by orwell
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.