Jump to content




Disknet: "Modem" communications through a disk drive!


6 replies to this topic

#1 LDDestroier

  • Members
  • 1,090 posts
  • LocationACDC Town

Posted 02 May 2019 - 02:58 PM

Want to have modemless interdimensional communication, but Skynet is too slow? (it's not that slow)

Are you on a version of ComputerCraft that doesn't support websockets? (update, you luddite)

Or are you that guy?

Then Might I IntroDuce To You


DISKNET


The Only Network API That You Can Download By Executing The Command:

wget https://github.com/LDDestroier/CC/raw/master/disknet.lua

Disknet works by using a shared directory between two or more computers to emulate the functionality of a modem.

You open a "channel" file, then can send/receive messages to/from it.

While one machine is receiving, it is constantly checking the channel file for changes. If it finds one, it will re-read it and see if a new message was sent.

This reads one or more files every tick, so using several channels might slow it down a tad.


This might not seem useful, but if you have two duplicated floppy disks with the same ID, you can use this for private inter-dimensional communications!

Without that, you can also essentially double the maximum possible length of wired cables from 256 to 512 by sticking a disk drive w/ a disk at the halfway point. That's useful, probably.


I've always wanted to make something like this since 2014, but never knew how until now!


Here's the list of functions and their uses:
Spoiler

Tell me what you think in the comments, or I'll eat your shoes


Edited by LDDestroier, 08 May 2019 - 08:32 PM.


#2 SquidDev

    Frickin' laser beams

  • Members
  • 1,404 posts
  • LocationDoes anyone put something serious here?

Posted 02 May 2019 - 03:07 PM

while true do
  -- ...
  os.queueEvent("")
  os.pullEvent("")
end

I realise this is the only way to do it, but "oh no" none-the-less.

#3 LDDestroier

  • Members
  • 1,090 posts
  • LocationACDC Town

Posted 02 May 2019 - 04:39 PM

View PostSquidDev, on 02 May 2019 - 03:07 PM, said:

while true do
  -- ...
  os.queueEvent("")
  os.pullEvent("")
end

I realise this is the only way to do it, but "oh no" none-the-less.

That's a fair analysis. I tried to reduce the amount of new fs.open() calls as best I could, but it's always going to be hard on the hard drive.

#4 SquidDev

    Frickin' laser beams

  • Members
  • 1,404 posts
  • LocationDoes anyone put something serious here?

Posted 02 May 2019 - 04:54 PM

View PostLDDestroier, on 02 May 2019 - 04:39 PM, said:

I tried to reduce the amount of new fs.open() calls as best I could, but it's always going to be hard on the hard drive.
If you wanted to be really fancy, you could open them in binary mode and then seek to the beginning of the file.

Though then I guess this wouldn't work on anything but CC:T, which rather defeats the "Are you on a version of ComputerCraft that doesn't support websockets?". Ptth, who are these people?

#5 LDDestroier

  • Members
  • 1,090 posts
  • LocationACDC Town

Posted 02 May 2019 - 04:56 PM

View PostSquidDev, on 02 May 2019 - 04:54 PM, said:

If you wanted to be really fancy, you could open them in binary mode and then seek to the beginning of the file.

Though then I guess this wouldn't work on anything but CC:T, which rather defeats the "Are you on a version of ComputerCraft that doesn't support websockets?". Ptth, who are these people?

Troglodytes (or anyone using a technic pack that is restricted to an older version of minecraft to maintain compatibility with the rest of the mods), that's who!

#6 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 03 May 2019 - 07:09 AM

View PostSquidDev, on 02 May 2019 - 03:07 PM, said:

I realise this is the only way to do it

Is it really? I mean, even regular modem messages don't arrive until the next server tick. Obviously this can go faster, but does it need to?

#7 SquidDev

    Frickin' laser beams

  • Members
  • 1,404 posts
  • LocationDoes anyone put something serious here?

Posted 03 May 2019 - 10:26 AM

View PostBomb Bloke, on 03 May 2019 - 07:09 AM, said:

Is it really? I mean, even regular modem messages don't arrive until the next server tick. Obviously this can go faster, but does it need to?
IIRC wireless modem messages are instant, but I can't think of any programs which actually need same-tick delivery. Would probably be better to use sleep(0) by default (still kinda eww), and then allow using queue/yield if a config option is set.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users