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

Extending ways to connect peripherals and cables

Started by LazerRay, 06 May 2012 - 10:09 PM
LazerRay #1
Posted 07 May 2012 - 12:09 AM
This may be a common problem with Computer Craft users, I know I have it, trying to connect several peripherals and cables to a single computer.

The computer in my Testing Lab now has five different items attached to it (a disk drive, a monitor, a wireless modem, some bundled cable, and the ccSpeaker), I'm running out of places to connect things and space is tight.

There should be something you could attach to a computer that acts like a hub for peripherals and cables, meaning you attach it to a computer then attach more devices to it, you can even chain the hubs together to make even more room.

Another possible solution is to have the peripherals able to act like a hub so you can chain a bunch of different ones together and the computer can still use them, and still send or receive signals on redstone dust, and Red Power wires and cables when they are attached to a peripheral.

Think of things like this as USB hubs, SCUSI adapters, port replicators, and various other things along these lines, these things get used to open up more places to connect more devices when ports are limited.

To help keep this balanced, you could put a limit on how many items you can chain together similar to real devices of this type (for example USB maxes out at 127 devices on one chain and you need powered hubs for long cables).
ComputerCraftFan11 #2
Posted 07 May 2012 - 12:12 AM
This has been suggested before, but one thing you can do is add multiple computers that control the peripherals over rednet from the main PC.
LazerRay #3
Posted 07 May 2012 - 01:35 AM
The down side to that is it requires multiple computers to be running at once and they lose their states when chunks unload, the hub idea is to have a passive connection for peripherals and cables with out the need for extra programing, one reason I also suggested some type of limit so it doesn't become over powered and you still need more computers for more complex systems, the hub is meant for smaller set ups.
Xfel #4
Posted 07 May 2012 - 09:58 AM
I coded some cable system as peripheral some time ago, but I failed at the routing code, and there were some thing not quite clear. If anyone has an idea for routing, I might provide my up-to-now sourcecode.

I even found a way to replace the peripheral api with a proxy so that you could interface cabled peripherals as you interface normal peripherals.
Hawk777 #5
Posted 07 May 2012 - 05:40 PM
The state saving issue is a non-issue: the hub can be almost completely stateless and can have its "hub program" run from the startup file. When the chunk unloads, it stops; when it reloads, the program starts up again, and any computer trying to talk to it immediately succeeds at that point, just like it would with a dedicated hardware hub. Any redstone output that was active when the hub was shut down would be handled the same was as if it were directly connected to the main computer, since they're both just computers.