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

[DISCONTINUED] [CC 1.481 | MC 1.4.7] Advanced Modems - 0.1

Started by Tiin57, 27 December 2012 - 01:24 AM
Tiin57 #1
Posted 27 December 2012 - 02:24 AM
The advanced modem is basically a modem with some new features and a gold recipe.
First; craft it as you would a modem, but with gold, not stone.
Second; THEY CANNOT CONNECT TO THE REGULAR REDNET NETWORK. This is a feature I plan to add. No ETA requests; it'll be done when it's done.
Third; Channels. They're fun. Here's some methods for you to eat. Nomnomnom.

boolean = modem.open()
boolean = modem.close()
boolean = modem.send(id, msg)
boolean = modem.broadcast(msg)
boolean = modem.setChannel(channelID)
int = modem.getChannel()
Also, the message event for a modem is "advmodem_message".
Fourth; no textures yet. Or fancy rendering. Yes, I fail. Move on with life.
I think that's it.
Changelog & Downloads:
Spoiler

0.1: Hopefully functional. - http://adf.ly/HHPLf
0.0.1: First, crap release. No download.
Do be warned that it is not functional as an advanced modem yet, and that it might be broken (haven't tested). I will be watching this thread for bug reports; tell me, so I can squish them with my Eclipse hammer.
Doyle3694 #2
Posted 27 December 2012 - 02:54 AM
no distance or sender id for modem.receive?
and I assume modem has to be wraped as a peripheral?

Otherwise, awesome. Will be added to my server once it gets recipies ;)/>

Though cloudy said it would be a planned feature as well, I really like this, have been waiting for it a long time.
+1!
Tiin57 #3
Posted 27 December 2012 - 03:19 AM
no distance or sender id for modem.receive?
Soon to be added.

and I assume modem has to be wraped as a peripheral?
Yep.
Otherwise, awesome. Will be added to my server once it gets recipies ;)/>
Though cloudy said it would be a planned feature as well, I really like this, have been waiting for it a long time.
+1!
Awesome, thanks!
Doyle3694 #4
Posted 27 December 2012 - 04:36 AM
Oh, and your links actually are ended with an .(dot)

So them no work, unless you manually copy into your URL bar and remove the dot
Tiin57 #5
Posted 27 December 2012 - 06:31 AM
Derpyface, that has been fixed. Thanks.
Anyone having bugs?
CoolisTheName007 #6
Posted 30 December 2012 - 05:30 AM
If this can be used in turtles, what do you think about allowing the modem to listen to 2 frequencies? That way, turtles could connect two networks (each with a different frequency).
This makes more sense in the context of changing rednet to use frequencies (e.g. not send(id,msg) ). Since it's related, I post here what I think would be a complete solution for rednet frequencies (which is based of many ideas of the rednet frequencies suggestion thread):
setListenFreq(freq,n), where n is 1,2,3, or 4, and freq is something out of a very larger set of things, e.g. all Lua numbers, or strings of limited size.
Sets frequency slot n to freq.
Frequencies could initially be:
1st slot - the computer id;
2,3, and 4th slot: _default = a default frequency that wouldn't match any computer id;
All frequencies could also be a default value, in case there is the need to get rid of id's; which is an entirely diferent problem btw, how would people access their respective computer folders, ect. Plus, that wouldn't be backwards compatible.

send(freq,msg)
For all computers listening to the frequency freq, that are in rednet range, queues a rednet event ('rednet',freq,msg,distance,side) (side, why not? that way we can differentiate between modems). This is consequently backwards compatible with send(id,msg)

For backward compatibility, one can still implement broadcast(msg) as send(_default,msg). Backwards compatibility fails when people rely on send(_id,msg) only reaching the computer whose id is _id, because it would reach anyone listening to the frequency _id.

Why 4 frequencies to listen on? Because, in the context of a network, that is, a set of computers which wish to communicate efficiently among themselves, without interfering with others, and a turtle A of that network:
-1 frequency slot only, wouldn't allow listening to both the network's internal broadcasts and messages forwarded directly to A. The only solution would be filtering messages based on a target descriptor, e.g. send(net_freq,'target:A|msg'), but that would wake up every computer of the network in range of A, unnecessarily.
-2 frequency slots are better; but in networks there may be the need to have nodes linking 2 different networks, for instance the server network and a turtle fleet network, that one wants to keep with different frequencies, which are kept private and effectively serve as a secure channel (so that blacklisting a sub-network does not need to set a new frequency in the server network). Consequently, 4 channels are fine for this.

A computer can currently make this work with 4 advanced modems, but a turtle would need a modem with 4 channels. Personnaly, I would prefer a modem with 4 listening frequencies for all computers, because ease of use and turtle auto-servers and whatnot.

Btw, I now I've been talking a lot about networking, and I don't have anything completely ready yet, but I've already coded a routing protocol (github anyone interested, osi repository). I'm in the process of adpating cc-emu to simulate broken connections, and would like to use something like this to compare efficiency of normal broadcast with using channels. As it is now, it will work with the normal broadcast, but it would be more efficient either with the advanced modem as it is or the rednet frequencies described above.
Edited on 30 December 2012 - 06:20 AM
Cozzimoto #7
Posted 30 December 2012 - 06:13 AM
yes this is going to be awesome for added security and added ways to attempt to hack. lol =P

+ 10
Sebra #8
Posted 30 December 2012 - 08:55 AM
I like the way you done it.
Imho channel 0 should be connected to CC Modems. Not sure can you do it.
Rednet API should be able to use it. Not sure can you change it.
CCLan and Trans-World Modem can fit rednet very well too. I think rednet should be able to use many peripherals to communicate. At least which have all methods Modem have.
Tiin57 #9
Posted 14 January 2013 - 09:25 AM
Ok, finally have proper networking, I hope.
Please BUGTEST.
Channel 0 will eventually connect to rednet.
zekesonxx #10
Posted 14 January 2013 - 09:30 AM
and I assume modem has to be wraped as a peripheral?

Edit rom/apis/rednet. The normal rednet modem is a peripheral as well.
Tiin57 #11
Posted 16 January 2013 - 05:50 AM
Are there seriously no bugs?
theoriginalbit #12
Posted 17 January 2013 - 10:51 PM
Nice :)/> Was it you that made this as a suggestion at one point?

Also whats the channel range? And is there a way to get the channel its set to?
Tiin57 #13
Posted 20 January 2013 - 04:27 AM
Nice :)/> Was it you that made this as a suggestion at one point?
Thanks!
And yes, this is in response to a suggestion.

Also whats the channel range? And is there a way to get the channel its set to?

modem.getChannel()
The range is up to 6 billion or something silly.
theoriginalbit #14
Posted 20 January 2013 - 04:33 AM
Nice :)/> Was it you that made this as a suggestion at one point?
Thanks!
And yes, this is in response to a suggestion.

Also whats the channel range? And is there a way to get the channel its set to?

modem.getChannel()
The range is up to 6 billion or something silly.
Very nice! :D/>
Doyle3694 #15
Posted 29 January 2013 - 12:51 PM
and I assume modem has to be wraped as a peripheral?

Edit rom/apis/rednet. The normal rednet modem is a peripheral as well.

I know I'm abit late, but yes, I know it's a peripheral, I'm not retarded. My question was if I had to wrap it or if it was already wrapped with a built in program :P/>
Dirkus7 #16
Posted 08 February 2013 - 11:21 AM
This is now in the new ComputerCraft beta, the whole channel idea!
Tiin57 #17
Posted 08 February 2013 - 01:40 PM
Yep. Due to CC's imminent inclusion of this idea in the core mod, I will not be developing this any further.