Page 1 of 1

Diginet: a higher-level digiline-based protocol

PostPosted: Mon Jun 08, 2015 13:47
by technomancy
I'm working on a mod that provides in-game servers running a pure-lua virtual operating system.

In order for these nodes to be useful, obviously they will need to communicate with other nodes, and digilines is the obvious choice for doing so. However, from the perspective of an operating system, digilines is rather low-level. It's great for simple interactions between nodes, but I feel like my needs would be better served by another layer on top of digilines.

To that end I've done a bit of musing on the topic of what kind of protocol would fit my requirements. I haven't done any coding on it yet, but I thought I'd ask for some feedback here, firstly to see if anyone else would use this kind of thing were I to implement it, and secondly if anyone has suggestions for how the protocol could work.

The design sketch is here: https://github.com/technomancy/calandri ... /readme.md

tl;dr: you send packets around that use position strings as addresses; every packet (table) has a source/destination, the latter of which can include wildcards and ranges. Packets also need a "method" argument roughly equivalent to that of HTTP. Nodes which speak Diginet must reply to pings with a list of what methods they support.

Please let me know if you have any thoughts on the subject.

Re: Diginet: a higher-level digiline-based protocol

PostPosted: Tue Jun 09, 2015 17:29
by srifqi
Woah,
Internet-like network in Minetest!

Hope it will be realized, can't wait to see 'em in server.

NB:
Will be there a browser? Just my thought.
Also, will be an URI-like (e.g. srifqi.server)? So, we don't have to remember the "IP".

Re: Diginet: a higher-level digiline-based protocol

PostPosted: Wed Jun 10, 2015 07:47
by prestidigitator
Why go part way? How about an implementation of HTTP/REST (GET, POST, PUT, DELETE) with Lua values (including table references) as the content type? "DNS" can route request URLs to specific "addresses" (locations)....

(And broadcast multicast can be implemented using RESTful APIs for event/listener registration....)

Re: Diginet: a higher-level digiline-based protocol

PostPosted: Thu Jun 11, 2015 15:19
by technomancy
srifqi wrote:Woah,
Hope it will be realized, can't wait to see 'em in server.


Here's what I've got so far:

https://github.com/technomancy/calandri ... t/init.lua

No broadcast/multicast yet. I have used it to facilitate communication between my terminal and server nodes. I haven't yet tried server-to-server or servers to other peripherals, but that's next.

If people are interested in using this in their own mods and games, I can spin it out into its own code repository.

I actually expected to implement this on top of digilines, but it turned out to be much easier to implement a "wireless" version that simply plucks nodes out of the air and delivers messages to them. I may consider a wired variant in the future or a gateway node that can route between the two network types. The advantage of the wireless approach is that communication happens much more quickly; propagation between digilines happens node-by-node, so far-apart blocks can take many seconds for messages to get delivered between them.

srifqi wrote:Will be there a browser? Just my thought.
Also, will be an URI-like (e.g. srifqi.server)? So, we don't have to remember the "IP".


The forms engine is far too primitive to support a browser unfortunately. Even emulating a 1980s "glass tty" is sketchy. I have thought about adding URIs but need to think more about what that would look like. I have a branch where I'm working on a DNS-like system though, because you're right: typing out the addresses is pretty tedious.

prestidigitator wrote:Why go part way? How about an implementation of HTTP/REST (GET, POST, PUT, DELETE) with Lua values (including table references) as the content type?


I actually feel like this is a superset of what HTTP provides. The main difference is that it is completely asynchronous rather than fitting into a neat request/response cycle, but such a mechanism could be built on top of the current API easily enough. You can think of methods also as being analogous to ports, where a single node can "listen" on a variety of methods by declaring callbacks. But packets are lua tables that can include lua tables (no need to flatten everything down into a single string or whatever) and you can easily include any fields you would normally put in HTTP headers. At that point it's more a matter of defining conventions than anything else.

Of course, a bridge between diginet and real-world HTTP feels like a no-brainer; unfortunately this is currently blocked on getting this pull request applied which was objected to for nonsense security reasons: https://github.com/minetest/minetest/pull/1869

Re: Diginet: a higher-level digiline-based protocol

PostPosted: Thu Jun 11, 2015 16:06
by rubenwardy
It would be cool to have this as a separate mod. The players need to be able to use it, though, without having to do lua mods / restarting.

It would be cool to be able to place wires and routers, etc. To make this work on unloaded blocks, you'd need to store details in a lua table (eg: wire A goes from object A to object B).

Maybe instead of placing physical wires, you could use a tool to do select from - to. (Although it wouldn't be so good to visualise.)

You should look at BuildAWorld for inspiration: https://youtu.be/PnRMxO4IAA4?t=38s
Invisible lines / wires.

Re: Diginet: a higher-level digiline-based protocol

PostPosted: Fri Jun 12, 2015 02:26
by technomancy
rubenwardy wrote:It would be cool to have this as a separate mod. The players need to be able to use it, though, without having to do lua mods / restarting.


Oh yes; the goal is absolutely to allow this to be used directly from minetest without restarting or editing mods. But that's not the goal for this mod; that's something I'm shooting for with Calandria: https://github.com/technomancy/calandria

Unfortunately the severely limited functionality of formspecs makes it very difficult. In particular, writing a text editor that runs on a server but uses a formspec for its interface is basically a lost cause. I have some workarounds in mind, but we're never going to get anything nearly as nice as the ComputerCraft editor without a total overhaul of the formspec system, which is disappointing.

I've spun off diginet into its own repository here: https://github.com/technomancy/diginet/

Feel free to open issues for features you'd like to see. The main open issues are for service discovery via broadcast/ping showing supported methods and the DNS system. Would be happy to get pull requests for these as well.

Re: Diginet: a higher-level digiline-based protocol

PostPosted: Sun Jun 28, 2015 04:14
by technomancy
For anyone following along, I've added a DNS server node that supports setting aliases for any given position so they're easier to remember:

Image

Each DNS server is limited to setting only 4 aliases, but you can create any number of DNS servers.

Re: Diginet: a higher-level digiline-based protocol

PostPosted: Thu Aug 13, 2015 16:00
by matyilona
It seems like a really cool mod, but what about mobile "devices"? A mod with some kinds of robots/drones would have to have a way of getting IPs. Maybe a "dhcp" server should be implemented for mobile stuff. A method for getting an IP registering it in a table, maybe even using it for the normal nodes, just giving the their place. As far as I can see only the node_for function has to change, and maybe having strings as IPs with regex would help with multicasting.

Re: Diginet: a higher-level digiline-based protocol

PostPosted: Tue Sep 01, 2015 07:05
by jogag
What about Wi-Fi? I'm working on it in my Digiline Stuff pack, along with IoT devices like ESP8266 (Wi-Fi programmable chip) and hack-ready routers.

Re: Diginet: a higher-level digiline-based protocol

PostPosted: Tue Sep 01, 2015 14:35
by benrob0329
I personally think that digilines is enough to do it, with channels being able to be domains and such, I don't see why a higher level wire is needed.

That's my my two digilines anyways XD

Re: Diginet: a higher-level digiline-based protocol

PostPosted: Tue Sep 01, 2015 14:56
by jogag
benrob0329 wrote:I personally think that digilines is enough to do it, with channels being able to be domains and such, I don't see why a higher level wire is needed.

That's my my two digilines anyways XD

Yes, digilines has already these features, but what if you want to temporarily fetch something from a device, and you don't want to register a domain for that device (e.g. a mobile phone that can't be placed and have a pos)? You need (a sort of) DHCP, which is not natively supported by digilines.
This also makes guidelines for all devices, do you want every device expect different messages, data formats and stuff?
It's simply like real life: why do computers use ethernet and Wi-Fi if they can use USB (or I2C)?

Re: Diginet: a higher-level digiline-based protocol

PostPosted: Tue Sep 01, 2015 15:55
by benrob0329
@jogag True