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

Wireless Distance

Started by LitCactus, 05 March 2012 - 01:13 AM
LitCactus #1
Posted 05 March 2012 - 02:13 AM
How do distances and computers work? If you are at a computer at x0 z0, and your buddy is at a computer at x2000 z2000, could you send him a message wirelessly? I am confused about wireless connections in general with ComputerCraft…
FuzzyPurp #2
Posted 05 March 2012 - 03:18 AM
Modems have a range(sphere shaped) of 64 blocks in any direction(17 in thunderstorms). If you want to send something that far away use http api, or build a some wireless repeaters.
6677 #3
Posted 06 March 2012 - 01:13 PM
You can build a simple wireless repeater like so:

Build a computer with a wireless modem, start it running in a loop that waits for a rednet message. Then simply rebroadcast the message.

I'm not on my home PC at the moment so i can't confirm that this code will work but try this:

rednet.open("back")
running = true
while running = true do
    event, sender, message = os.pullEvent()
    if event = "rednet_message" then
	    rednet.broadcast(message)
    end
end

Its very crude, it uses broadcasting so anyone else can recieve the data aswell (so not very private) and it may be prone to echoing messages around the other wireless repeaters (not actually tested, I don't use this method myself, I have a much more complex system in place that is more secure).




The only major issue is that you are so far away from him. The chunks inbetween you 2 won't be loaded all the time. This means that any wireless repeaters won't be active so messages won't be recieved. The http api is the only reliable method for straight PC to PC connections at this range, although I don't know how to work it. Alternatively you could manually deliver messages to him on floppy disks.
Kane Hart #4
Posted 06 March 2012 - 03:42 PM
If your on a SMP Server and worried about performance having repeaters every 16 blocks you can also try to edit the class files like we had done. We run at 8096 now and it works great. If you want more info on how to do this I will make up instructions.
Casper7526 #5
Posted 06 March 2012 - 06:43 PM
And 1.31 should hopefully have a config for this as well.
Bard #6
Posted 06 March 2012 - 09:24 PM
You can build a simple wireless repeater like so:
CUT

rednet.open("back")
running = true
while running = true do
	event, sender, message = os.pullEvent()
	if event = "rednet_message" then
		rednet.broadcast(message)
	end
end
CUT

wouldn't that cause 2 repeaters to loop the message between themselves forever and ever?
Liraal #7
Posted 06 March 2012 - 09:34 PM
while true do
event, sender, message = os.pullEvent()
if event = "rednet_message" then
turtle.forward()
rednet.broadcast(message)
turtle.back()
end
end

This should work better if you use a turtle and place it at an edge of the range facing outward. I may do something more sophisticated later on.
Cookiebal #8
Posted 06 March 2012 - 10:03 PM
http://www.computerc...ndpost__p__3175

With the Skynet Api the repeaters won't repeat infinitely even if you didn't place it on the edge, as long as they are in range of eachother. So you can build long lines of repeaters and use the api to connect computers that are far away from eachother easily.
6677 #9
Posted 07 March 2012 - 09:40 AM
Spoiler
You can build a simple wireless repeater like so:
CUT

rednet.open("back")
running = true
while running = true do
	event, sender, message = os.pullEvent()
	if event = "rednet_message" then
		rednet.broadcast(message)
	end
end
CUT
wouldn't that cause 2 repeaters to loop the message between themselves forever and ever?
I did mention that in the post underneath. I can confirm that it doesn't echo forever on bundled cables but I've still not tested on wifi.
perhaps if it slept for 0.2 seconds (or maybe 0.1) at the beggining of the loop, it will reduce the bandwidth considerably though (might not be an issue for some users). That would drastically increase the time for a message to be sent at the distance mentioned though.


Skynet looks to be the best solution using modems though. (until the range can be boosted anyhow)
sorker3 #10
Posted 25 July 2012 - 04:31 PM
If your on a SMP Server and worried about performance having repeaters every 16 blocks you can also try to edit the class files like we had done. We run at 8096 now and it works great. If you want more info on how to do this I will make up instructions.
I wana know how to do it! :)/>/> I have been looking in the mods/computercraft folder for the right class filen, but have't find it :D/>/> pls dude, help :D/>/>
BigSHinyToys #11
Posted 25 July 2012 - 04:41 PM
If your on a SMP Server and worried about performance having repeaters every 16 blocks you can also try to edit the class files like we had done. We run at 8096 now and it works great. If you want more info on how to do this I will make up instructions.
I wana know how to do it! :)/>/> I have been looking in the mods/computercraft folder for the right class filen, but have't find it :D/>/> pls dude, help :D/>/>
in future make a new thread DONT BUMP OLD thread. that said it is now a file in the config folder in .minecraft
File Name : mod_ComputerCraft.cfg
content :
#diskItemID (int:4000)
#enableAPI_http (int:0)
#terminal_width (int:50)
#terminal_height (int:18)
#terminal_textColour_r (int:255)
#terminal_textColour_g (int:255)
#terminal_textColour_b (int:255)
#modem_range (int:64)
#modem_rangeDuringStorm (int:16)
#
#Wed Jul 25 15:53:22 GMT+08:00 2012
terminal_width=50
terminal_textColour_g=255
modem_rangeDuringStorm=16
computerBlockID=207
diskItemID=4000
diskDriveBlockID=208
enableAPI_http=1
terminal_textColour_b=255
checksum=440
terminal_textColour_r=255
modem_range=64
terminal_height=18


Change that to what distance you would like
sorker3 #12
Posted 25 July 2012 - 05:44 PM
Yeah thannx alot :D/>/>, I did't know it was that easy …. :)/>/>