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

Rays

Started by Lignum, 14 April 2014 - 11:29 AM
Lignum #1
Posted 14 April 2014 - 01:29 PM
I think ComputerCraft would profit from having invisible rays that can be cast from a peripheral available as a block and turtle upgrade. I do agree that the idea does seem a little too "modern" for ComputerCraft but the idea could provide players with some interesting possibilities.

What they are and what they do:
When a ray is cast it will travel straight forward from where it was cast until it hits a block. When this occurs the computer that has cast the ray will receive an event that contains how far it has travelled until collision. To balance it a little bit, rays should take some time to cross larger distances. For example, rays could be used to calculate how much fuel is required to travel a certain distance or how deep a mine shaft is.

Here's where things get interesting:
Rays should be able to be cast from two different blocks: Ray casters and cameras. While a ray caster will only cast a single ray, cameras can be told to emit rays in a grid-wise manner.

Since cameras are hard to explain, here's a rough side-view of a camera (black block is the camera, black lines are the rays it emits, green block is just a random Minecraft block).

To make cameras more dynamic, they should be able to be told what size this "grid" of rays should be. Cameras will return a 2D table (to represent the grid) of distances rather than a single distance.

Additional suggestion:
Cameras are called cameras because with them you can create low-resolution images. However using regular colours it's very hard to make a recognisable image. So, I suggest that regular computers should support different shades of grey instead of just black and white. It would also make them used more often in creative mode.
wilcomega #2
Posted 14 April 2014 - 05:00 PM
i would like to see if you were able to get the distance a ray traveled in a certain direction. of course the rays cant be casted out of no-where so it has to be with degrees.
a camera opens a lens for a certain amount of time, before the lens closes it reads the data from the sensor wich will result into an image. i dont think this will happen at all but the ray casting is really what i am hoping to see in a future update just to be able to get a better view of the surroundings,

if this is a computer from the 80's, in that time they already had ways to sens distance and maybe color(not sure) on a very small distance
CometWolf #3
Posted 14 April 2014 - 05:50 PM
Sounds like you'd like the computronics mod, it adds what is basically a raycasting camera peirpheral.
http://www.computercraft.info/forums2/index.php?/topic/17430-mc-164-cc-15x16x-computronics-030-audio-tapes-cameras/
Lignum #4
Posted 14 April 2014 - 05:52 PM
i would like to see if you were able to get the distance a ray traveled in a certain direction. of course the rays cant be casted out of no-where so it has to be with degrees.
While angles would be cool, I don't think it fits Minecraft's style. I've stated in the post that they should go forward from whatever they're sent from (assuming the peripheral faces you when placing, like pumpkins). However an option to specify what direction it gets cast in would be pretty nice.

Sounds like you'd like the computronics mod, it adds what is basically a raycasting camera peirpheral.
http://www.computerc...-tapes-cameras/
I'll definitely check that one out.

EDIT: I can't seem to get it to work, I have the blocks but I can't wrap the camera (peripheral.wrap returns nil). Is it working for anyone else?
Edited on 14 April 2014 - 04:09 PM
asie #5
Posted 09 July 2014 - 09:31 PM
EDIT: I can't seem to get it to work, I have the blocks but I can't wrap the camera (peripheral.wrap returns nil). Is it working for anyone else?

Sorry for only replying after 3 months, but you need OpenPeripheral. If it persists not to work with Computronics 0.4.1 for 1.6.4, tell me and I'll put out a bugfix release.
Lignum #6
Posted 09 July 2014 - 09:34 PM
Sorry for only replying after 3 months, but you need OpenPeripheral. If it persists not to work with Computronics 0.4.1 for 1.6.4, tell me and I'll put out a bugfix release.
No problem. I should have read the docs properly regardless. Thanks, I'll try it out tomorrow.
Edited on 09 July 2014 - 07:36 PM