This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
soccerboy5411's profile picture

FTB CC Railcraft Switching

Started by soccerboy5411, 05 January 2013 - 07:38 AM
soccerboy5411 #1
Posted 05 January 2013 - 08:38 AM
So due to the incessant nagging of my roommate I have begun work on a multiple-destination-one-rail system. I use the computer to pick a destination and send a wireless redstone signal to switch the track.


The WR signal triggers a rs latch attached to a nor gate. This triggers the controller which is attached to a switch. To reset the switch I placed a detector track that resets the rs latch.




This is just a proof of concept at the moment. There are some bugs that need to be worked out in the menu code, and the the track layout doesn't account for carts moving in the opposite direction.
sjkeegs #2
Posted 05 January 2013 - 09:08 AM
I've been learning Railcraft lately, and have been thinking about building a world with a connected and controlled rail system. I hadn't thought about controlling it with anything other than the railcraft signals… but now I'm imagining stations with train arrival boards, and automatic routing of multiple trains using detector rails, of course with a screen show where all the trains are at the moment.
Cranium #3
Posted 05 January 2013 - 11:24 AM
My failed foray into computercraft was what hooked me. I started out trying to control tracks with ComputerCraft in a tekkit server. And now, I might have to try making one again.
soccerboy5411 #4
Posted 05 January 2013 - 11:37 AM
I've been learning Railcraft lately, and have been thinking about building a world with a connected and controlled rail system. I hadn't thought about controlling it with anything other than the railcraft signals… but now I'm imagining stations with train arrival boards, and automatic routing of multiple trains using detector rails, of course with a screen show where all the trains are at the moment.

There are ways to still do that..albeit more complicated. If you have MiscPeripherals you can use the Rail Reader Peripheral to automatically send rs signals to switch tracks.

My failed foray into computercraft was what hooked me. I started out trying to control tracks with ComputerCraft in a tekkit server. And now, I might have to try making one again.

Someone on the railcraft forum was talking about it, and I thought 'porque no los dos'. I am trying to incorporate most/all the mods in the DW20 pack
bbqroast #5
Posted 12 January 2013 - 08:51 AM
I wrote an algorithm (pseudo code, but I imagine it wouldn't be to hard to implement in LUA) to map out the quickest route through a series of dots connected by lines (it would count the varying length of the lines). Swap dots for CC controlled railway stations and lines for railways (and the length of them for travel times) and you have a working mesh type rail network. It would be pretty cool, with all the computers talking to each other. Ideally, a central server would hold a binder of all the routes. A "client" computer determins the best route using the algorithm (fetching an array of dots and spokes from the server) and sends it to the server. The server would then notify the controlling computers for each dot the cart will pass.

This would ideally use chunkloading, relay stations, railcraft and my Cart Manager mod/plugin (lets you get the ID of a cart, so the hubs can identify said cart).
soccerboy5411 #6
Posted 12 January 2013 - 04:19 PM
I wrote an algorithm (pseudo code, but I imagine it wouldn't be to hard to implement in LUA) to map out the quickest route through a series of dots connected by lines (it would count the varying length of the lines). Swap dots for CC controlled railway stations and lines for railways (and the length of them for travel times) and you have a working mesh type rail network. It would be pretty cool, with all the computers talking to each other. Ideally, a central server would hold a binder of all the routes. A "client" computer determins the best route using the algorithm (fetching an array of dots and spokes from the server) and sends it to the server. The server would then notify the controlling computers for each dot the cart will pass.

This would ideally use chunkloading, relay stations, railcraft and my Cart Manager mod/plugin (lets you get the ID of a cart, so the hubs can identify said cart).

Similar to the way a computer network routes packets? That would make expandsion very easy, but would require a lot of initial setup and programming. That would be awesome to see the multiple carts traveling in the different directions
bbqroast #7
Posted 23 January 2013 - 05:47 AM
Similar to the way a computer network routes packets? That would make expandsion very easy, but would require a lot of initial setup and programming. That would be awesome to see the multiple carts traveling in the different directions
Yeah. I actually wrote a node network system, it worked surprisingly well (very little code, pretty fast) but I never got it ready for release. The idea would be to use that to setup a large network, then the Minecart system could use it. For example, you could have an automated system:
I use an app on my computer to request some fuel.
The nodes pass around the message, eventually it reaches the fuel server.
The fuel server fills a railcraft tank cart and sends it to the nearest Minecart station. As it does this it gives the central Minecart server (over the node network) a "rail plan" (basically saying the destination of the cart along with its ID). Then the server works out the best route and tells all the stations along that route (once again, over the network) which way to send the cart when it arrives.
redeye83 #8
Posted 23 January 2013 - 07:39 AM
So how would this "node" system work in a practical sense? I've created a rail tracking system that whos if a train is on a part of the track or at a station. I use multi line as I'm basing mine on my local train network.
I'm working on a big project and there could be a need for a subway system and this might be useful for that.
bbqroast #9
Posted 24 January 2013 - 08:37 PM
So how would this "node" system work in a practical sense? I've created a rail tracking system that whos if a train is on a part of the track or at a station. I use multi line as I'm basing mine on my local train network.
I'm working on a big project and there could be a need for a subway system and this might be useful for that.
Came up with it a while ago:
Start at node A, move to all the nodes connected to node A via a spoke. At each new node store the following values:
The path traveled (example A-C), and the distance traveled.
Repeat from each node, adding the new node's identifier to the end of the string (eg A-C-G) and counting up the distance. If you hit a node that has already been explored, compare your distance with the distance that the previous path had traveled. In the previous path was shorter, stop if not delete it from the node and continue.
You cannot visit the same node twice from the same path. A path is finished when it cannot find nodes (with longer travel distances) to move to. When all paths are finished, compare them and find the shortest one that goes to your destination. You should have a string giving you all the nodes you must travel through, eg:
A-G-H-V.
It's basically the underlying code behind any pathfinding algorithm as it happens.
Orwell #10
Posted 25 January 2013 - 08:51 AM
Dijkstra didn't put all his effort into a path finding algorithm for nothing :P/> : https://en.wikipedia.org/wiki/Dijkstra's_algorithm
Dijkstra's algorithm is more efficient than what you're describing there (if I understand you right).
Also check out A*, it's more efficient than Dijkstra through the use of heuristics.
bbqroast #11
Posted 25 January 2013 - 11:05 AM
Dijkstra didn't put all his effort into a path finding algorithm for nothing :P/> : https://en.wikipedia.org/wiki/Dijkstra's_algorithm
Dijkstra's algorithm is more efficient than what you're describing there (if I understand you right).
Also check out A*, it's more efficient than Dijkstra through the use of heuristics.
I believe his algorithm is more or less the same as mine (actually, it looks exactly the same).
A* looks really clever in the way it solves things.
Orwell #12
Posted 25 January 2013 - 11:15 AM
Dijkstra didn't put all his effort into a path finding algorithm for nothing :P/> : https://en.wikipedia.org/wiki/Dijkstra's_algorithm
Dijkstra's algorithm is more efficient than what you're describing there (if I understand you right).
Also check out A*, it's more efficient than Dijkstra through the use of heuristics.
I believe his algorithm is more or less the same as mine (actually, it looks exactly the same).
A* looks really clever in the way it solves things.
You didn't mention having a queue and always taking the node with the shortest distance first. But you might've had the same in mind. A* is clever but quite dependent on the situation.
redeye83 #13
Posted 28 January 2013 - 07:19 PM
This all seems very complicated lol.
The system I thought of using was this:
A player picks the station they want to get off at from a computer. That computer tells the track that the next train is going to stop at x station and all the switchs change to make the train go there. then you get on the train and go. wouldnt it be easyer to work out the routes yourself rather than get a computer to do it?
Cranium #14
Posted 29 January 2013 - 03:00 AM
Well what if you want multiple carts going at the same time? Wouldn't you have to find some way to track the carts?
redeye83 #15
Posted 29 January 2013 - 03:54 AM
Well what if you want multiple carts going at the same time? Wouldn't you have to find some way to track the carts?
You could use signals to stack them up at key points.
bbqroast #16
Posted 29 January 2013 - 04:08 PM
This all seems very complicated lol.
The system I thought of using was this:
A player picks the station they want to get off at from a computer. That computer tells the track that the next train is going to stop at x station and all the switchs change to make the train go there. then you get on the train and go. wouldnt it be easyer to work out the routes yourself rather than get a computer to do it?
The point of my system is it can navigate through multiple intersections. So there could be 100s intersections in a cart "network" that connects to my house and my friends house, but the computer finds the quickest way through all these intersections to my friends house.
soccerboy5411 #17
Posted 31 January 2013 - 07:49 AM
Well what if you want multiple carts going at the same time? Wouldn't you have to find some way to track the carts?

The Misc Peripheral block that can detect carts can assign the cart an unique entity id. The id is not persistent, but it does offer the ability to track it.