TrainCarts
TrainCarts Development has moved to SpigotMC.
You can get the new versions at the following URL:
https://www.spigotmc.org/resources/traincarts.39592/
This page is no longer being actively monitored, please seek for support on SpigotMC.
Plugin: TrainCarts - Linked Minecarts, sign-redstone systems, easy to use and realistic
Version: v1.73.0
Build: 1.7.2 R0.1/R0.2
Incompatible with: RailCraft
Description
This plugin looks for suitable Minecarts and links them together if possible. When two Minecarts are being "linked", the Minecarts will act as one single moving train.
Once carts are successfully linked, an effect is played and their velocity is shared in combination with an individual factor for each Minecart, which is used to remain a steady gap between carts. This gap is adjustable, the force at which this happens as well.
End result: a train! You can move it, make a roller-coaster out of it, split it in half, watch trains collide, whatever you want to do with trains. :)
As for 1.21, it is also possible to safely exit your train by setting an exit offset with a (sideways) push factor for the train. This feature is disabled by default. (only affects dropped items). If you want to display arrival times on signs (see redstone circuit part) you need SignLink, see the downloads on the bottom of the page.
As for 1.35 you can set train properties to make 'special' trains, or to 'finalize' a train

Links
For configuration, permissions and how-to's, see the Wikipedia page (it is rather long):
Note that I would prefer having comments, bug reports and others in the main Bukkit page, since I visit that site the most. :)
Addons
Special Addons for TrainCarts
Features
- Link minecarts using collision: no commands needed to make a train
- Move trains as easily as you would with single Minecarts
- Store trains to file for persistence during reloads and server restarts
- Use sign-redstone circuits for subway systems, complete railroads and much more
- Station to gracefully stop and launch trains
- Spawn
- Teleport
- Property setters
- Tag systems to switch certain tracks based on tags on the train
- Destination systems to make your train travel to far-away lands all on it's own
- Supports Minecart Mania's features
- Infinite minecart speeds are possible
- Push-away: Push mobs, players and items away from your trains to keep them running
- Everything is configurable, if something proves not to be, I will make it that way
FAQ
When players are near, trains reach their destinations. With no one near, they don't. What do I do?
By default trains do not keep chunks loaded, and they will unload once they move into unloaded chunks. To make trains keep the chunk area (and themselves) around them loaded, set the 'keepchunksloaded' property to True. This can be done using the /train keepchunksloaded true command, using a property sign or by changing it to true in the DefaultTrainProperties.yml file. For more information about train properties, see here.
Why not boats?!?!
Incompatibilities
If you have another plugin that performs similar Minecart replacement techniques, it is likely that TrainCarts will not function or function poorly. For the 'chunk persistence' part of this plugin, other plugins that unload chunks without firing events result in this feature failing. Minebackup is known for having this problem.
Metrics
This plugin sends server count statistics to MCStats.org. You can (globally) opt out in the PluginMetrics/config.yml file.







-
View User Profile
-
Send Message
Posted Dec 28, 2012With the Dev-Build:
Plugin Train Carts Blocks v1.05 has failed to register events for class com.bergerkiller.bukkit.tcb.TCBListener because com/bergerkiller/bukkit/tc/events/MemberBlockChangeEvent does not exist.
And: http://pastebin.com/TyPLifwK
I have CB 1.4.5 R1.0
-
View User Profile
-
Send Message
Posted Dec 27, 2012Ok will try it out as soon as I get on a proper computer to transfer the new version to our server and restart. Meanwhile :could you tell me how destinations.dat has changed? Or, I can always look from your code... I need the new structure for my own code which prints out the graph.
-
View User Profile
-
Send Message
Posted Dec 27, 2012@Etsija I did want to implement it, but 1.4.5-version is getting a bit too much delayed this way. Anyhow, I fixed up the path finding, you can find it in the development builds zip file. Please do try it out and tell me whether all is working fine. I had no lag at all on your test world, and I could still use all of my pathfinding-demo areas, so I suspect it is fixed. It does need some proper validation, because I'm not sure how your world works ;)
Thing to note: delete the destinations.dat file first, or you get an error on startup (well, only for loading that file). The format has changed.
-
View User Profile
-
Send Message
Posted Dec 27, 2012bergerkiller, I *think* what you are using in practise (by saying "simple A*", and by your description) is a random, non-heuristic search. That is very non-optimal, compared to what could be used with the info you have:
Then why not trying the last algorithm in this page: http://ai-depot.com/Tutorial/PathFinding-Optimal.html
which combines so called "Branch and Bound" and "Dynamical Programming" techniques into one algorithm, which, in addition to using only the path metrics, also uses the euclidean distances from the current node to the destination node, as part of eliminating nodes from further investigation. I think the conclusion in the pages I linked seems to be it is by far the most optimal in terms of the different paths into destination to consider. Judging from the pseudocode, it is not at all difficult to implement, either.
-
View User Profile
-
Send Message
Posted Dec 27, 2012@Etsija @leagris The current system is the most basic of all, and conforms the several steps:
Exploring
Every switcher and destination sign becomes a named node. Between each node a connection is made. This connection describes the direction to switch to to take that connection, the destination node and the block distance of the connection. Once a node is created, it is scheduled for exploring in the PathProvider task, which basically traces down all the 4 cardinal directions to find out other nodes and to build the neighbours.
Path finding
Simple A*: Recursively go from node to node and obtain the (root) connection that gets to the destination the fastest. I can use a different method (not sure what the name is), that is to 'spread outwards'. I think this method is a lot better, be it only because it eliminates the use of recursion. And Java hates recursive method calling.
Now, previously the above path finding logic was included in the exploration part. Unfortunately, creating all these connections is too slow for more than 100 nodes, so it had to be removed. Right now I'm just going to do a recursive check every time a minecart travels over it, possibly buffering the results to save processing time.
-
View User Profile
-
Send Message
Posted Dec 27, 2012@leagris
Interesting ideas - I'm just thinking implementing the pathfinding with actively communicating nodes with protocols does sound at first like an overkill (although I do know they are extremely efficient in computer communication and networks). Actually, I think the last algorithms of the pages I linked sound like nearly optimal ones for the purposes of TrainCarts: namely these http://ai-depot.com/Tutorial/PathFinding-Optimal.html
To me it seems these could be implemented fast, for a trial at least! And, I think the computational complexity of them is actually so small that the algorithms could make it possible to do the pathfinding "on the fly" - that is, once the whole graph is calculated and stored. I think bergerkiller still has some technical issues there, since it seems to take incredibly long to add a node to the graph.
-
View User Profile
-
Send Message
Posted Dec 27, 2012@Etsija
Nice read indeed.
Well, I searched a bit and there are loads of approaches into routing. The most hyped ones involves ant trails.
It is all good and very enlightening to think/read or study this as a complex problem of its own.
But, back to this TrainCarts plugin and goals: you and I just expect trains to reach known destinations through known nodes (switchers).
Thus here are my views on the actual problem as a an IT girl:
Correlating a minecarts network to a computers network, may help apply known efficient and documented solutions to our problem here.
Known switchers and destinations are like known hosts and routers. Rails are the physical medium by which minecarts (packets) travels through the network between hosts and routers.
Applying this to TrainCarts would require each point to point links to be recorded and attached to interfaces at destinations and switchers. This part is already or mostly implemented somehow in TC.
Sorry for being so vague and incompetent at actually implementing this into TC. Though, I guess, using autonomous nodes communicating and discovering routes through a known protocol could be a better approach in terms of performances, rather than a sequential or recursive build up tree walking algorithm.
-
View User Profile
-
Send Message
Posted Dec 27, 2012And both /train reroute and /train reroute lazy crash my test server on the first intersection?
EDIT: Also I find this extremely good reading! http://ai-depot.com/Tutorial/PathFinding.html
-
View User Profile
-
Send Message
Posted Dec 27, 2012@Etsija 1.) Yes, on your test world it does. But it's not the path finding itself crashing the server, it's the adding of a single connection from one node to the other that does. It's an implementation problem.
2.) Will be partof 1.4.5
3.) Needs the development version (1.4.5) of BKCommonLib, also found on the jenkins host, and in the development builds download.
4.) There is /train reroute to literally start re-calculating everything. Using /train reroute lazy it will just clear the nodes, and starts generating nodes once a cart needs it.
I know of that alghortihm, I use the same type of system for 'direct' neighbouring. I added node-to-node connection storage to lower the processing time on finding out where to switch to when a cart asks for this. Unfortunately, this storage is running out of control, and for 100 nodes there are 100^2 connections stored.
-
View User Profile
-
Send Message
Posted Dec 27, 2012Some more thoughts on this: your plugin uses Dijkstra, does it not? http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm#CITEREFFredmanTarjan1984
Because, I don't think Dijkstra even in its basic form needs to store all reachable paths from all nodes; just the neighbour ones. In its basic form, it is O(V^2) in complexity, but it does have a modification where its complexity is driven by V*log(V) only. So you might want to inspect it. Just a thought.
-
View User Profile
-
Send Message
Posted Dec 27, 2012@bergerkiller: OK I'm on Christmas vacation atm so cannot actually test the changes you've made, but could you answer some small questions:
Meanwhile: I hve studied your pathfinding algorithm, and yeah, it IS REALLY computing inefficient in that it stores also all the distant nodes a current node can reach. That is WAY too excessive for a succesfull pathfinding operation. Our software expert did come up with some specific pathfinding algorithms which seem to be linear only in complexity increase. I can dig these up for your reference.
-
View User Profile
-
Send Message
Posted Dec 26, 2012I wanted to really improve the path finding some more, but I found that the current system is really REALLY slow. At some point, it takes well over 4 minutes to insert a SINGLE node in the path grid...because it has to set up over a million additional connections between all and everything. This just won't do, and it gets exponentially (literally) worse the more nodes there are.
I will have to re-think my current design and come up with an A* path finding system that doesn't store all connections to all other nodes for all nodes, because it causes an exponentially increasing processing time AND memory usage.
I might have to write up some very smart alghortihm that updates all nodes at once, in a linked way, but no guarantees. You can find the latest 1.4.5 build in the development builds.
Yeah...and this excludes the time to actually build that path...
-
View User Profile
-
Send Message
Posted Dec 26, 2012@bergerkiller
Updating is not the only thing i do ;)
-
View User Profile
-
Send Message
Posted Dec 26, 2012Things to note: the 1.4.6 version by lenis still has some old bugs, because it excludes some of the changes I've done here. These include fixing the memory leak with trains that have keepchunksloaded enabled, where it doesn't unload chunks.
I'll first be putting the path finding into a tick task to prevent server freezes for big maps, then I'll do some additional testing, and THEN a proper 1.4.6 build can be made.
@leagris Were you using the latest 1.4.5 version before, or not? Because it could very well be that it was fixed during the update spree I did this week and last week.
-
View User Profile
-
Send Message
Posted Dec 26, 2012@lenis0012
Ahd wow, the bug with lost properties after server restart seems gone.
-
View User Profile
-
Send Message
Posted Dec 26, 2012@lenis0012
Works like a charm so far, no errors at al.
-
View User Profile
-
Send Message
Posted Dec 26, 2012Oh damn sorry guys, completely forgot to update the link i had coppied.
I also updated MyWorlds, BKCommonLib, NoLagg and SignLinks
i forgot to change the link, updated link Enjoy ^_^
working 1.4.6 link for TrainCarts: https://dl.dropbox.com/u/67122021/plugins/TrainCarts/TrainCarts.jar
-
View User Profile
-
Send Message
Posted Dec 26, 2012@leagris
Same here, till I replaced his link with:
https://dl.dropbox.com/u/67122021/plugins/TrainCarts/TrainCarts.jar
And it works in 1.4.6.
-
View User Profile
-
Send Message
Posted Dec 26, 2012@lenis0012
I felt so excited for a minute. But Santa is a myth… I laughed at your big toes, I'll try not to cry as long in despair ;) Sorry, and blesses to you.
Maybe, I should follow some Myworld thread, and someone like you will post a 1.4.6 build for Traincarts there.
-
View User Profile
-
Send Message
Posted Dec 26, 2012@lenis0012
Errr, you do know this is not MyWorlds plugin? Kinda harsh lol.