Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  1. OpenComputers

    1. Announcements

      OpenComputers official announcements.

    2. Feedback

      Tell us what you think.

    3. IRC

      #OC channel discussion
      irc.esper.net #oc

  2. Code Central

    1. Support

      Ask for support from the OpenComputers community

    2. Showcase

      Showcase what you have created for OC. No 'malware' or other junk!

    3. Tutorials

      Help other users out. Please no 'false tutorials'

  3. Addons & More

    1. Addons Mods

      Show off your OC addons mods

    2. Architectures

      Discussions for Architectures

    3. OpenEngineering Task Force

      Discussion board for the OETF documents

  4. General

    1. Lounge

      Just lounge around or have an open discussion.

    2. Forum Games

      Fight boredom!

    3. Showcase

      Show off your creations! (not for your programs)

    4. Servers

      A place to advertise your servers

  5. Archives

    1. Public Archives

      OpenComputers public archive forum

  • Topics

  • Posts

    • There is an interesting device in the OpenComputers mod that allows you to determine the block hardness at a distance. But the trouble is, the data it gives out is rather noisy and the greater the distance, the more noise. To determine the true hardness of a block, we can scan it several times and average the result. The noise that interferes with scanning is of a probabilistic nature. And after several scans, you can statistically find what the most likely hardness of the block is. In one tick, we can scan 64 blocks. To analyze the entire available area (65 x 65 x 64) with hundred of iterations, we need 422500 ticks, which is equal to 21125 seconds or 352 minutes, that is, almost 6 hours. But how many times should we scan? One hundred? A thousand? Secret knowledge is open to us and there is an exact answer. One. With just one scan, we can find ore among any other blocks. If you want absolute certainty, you will have to do a couple of magic passes and re-scan. Let's start with theory. First, open the mod's code and find the geolyzer.scan function, it is located [here] and is called onGeolyzerScan() Looking at the code, we can understand that the function accepts parameters, by these parameters it scans blocks in the world. Does various checks like world.blockExists(x, y, z) && !world.isAirBlock(x, y, z) to make sure is a block here. Then he receives information about the block by coordinates, makes a few more checks (checks again that this is a block block != null, checks additional parameters: includeReplaceable, isFluid(block), block.isReplaceable(world, blockPos.x, blockPos.y, blockPos.z)) Then the distance to the block is measured. And at the end, hardness is taken, mixed with noise and distance. The result is added to the block table and sent to the player. It seems to be nothing unusual. Noise, distance, hardness. We already know the dependence of the strength of the noise on the distance. And that's where the magic begins. Let's take a closer look at the code for calculating the final block hardness. e.data(index) = e.data(index) * distance * Settings.get.geolyzerNoise + block.getBlockHardness(world, x, y, z) Briefly, we can write this in the form of the formula: R = G * D * N + H G - the generated noise. D - distance to the block. N - noise multiplier from the config (standard - 2). H - the true hardness. R - result of the geolyzer. If we try to subtract the expected hardness from the result as an experiment, we will not learn anything new. If we reverse all operations with known values, then we get only noise. Can we also parse the noise formula? Let's try. A few lines above [link]. We can observe the receipt of an array of random bytes. val noise = new Array[Byte](e.data.length) world.rand.nextBytes(noise) This is followed by normalization of values. noise.map(_ / 128f / 33f).copyToArray(e.data) Hmm. Well, well, well. If we combine all this with the previous formula, we get something like this: R = G(RANDOM_BYTE / 128 / 33) * D * N + H And what does it give us? And the fact that the original pseudo-random number has a hard discreteness. PRNG gives random numbers of type byte, and these are only 256 values (-128, +127). We know all the values except H and RANDOM_BYTE, what does this give us? We can assume the value of H and reverse the entire formula. (R - H) / D / N * 128 * 33 For a standard config, we can shorten to: 2112 * (R - H) / D And now I will open the secret knowledge for those who have not yet solved the riddle on their own. We took the desired block hardness (eg 3 for ore). Substituted this value for H. Got a random value. We can easily determine if the hardness is correct or not. Due to the discreteness of the random values of PRNG, the probability distribution for blocks with different densities is not the same.   Let's put into practice Here is the code of a simple script that searches for blocks with the desired hardness in a given radius. The result is displayed on the holoprojector. local sqrt = math.sqrt local component = require('component') local geolyzer = component.geolyzer local hologram = component.hologram local function distance(x, y, z) return sqrt(x^2 + y^2 + z^2) end local function magic(R, H, D) return 2112 * (R - H) / D % 1 end local function visualize(hardness, elevation, size) hologram.clear() hologram.setScale(9) local blocks, result for x = -size, size do for z = -size, size do blocks = geolyzer.scan(x, z, elevation, 1, 1, 32) for i_y = 1, 32 do result = magic(blocks[i_y], hardness, distance(x, i_y+elevation-1, z)) if blocks[i_y] ~= 0 and (result > 0.9998 or result < 0.00005) then hologram.set(x+24, i_y, z+24, true) end end end end end local hrd, ele, siz = table.unpack({...}) hrd = hrd or 3 ele = ele or -32 siz = siz or 16 visualize(hrd, ele, siz) And here's the result:
    • Ok, turns out I'm just incredibly stupid. Since i was using a tier 2 robot i had to use an upgrade container to get the chunk loader upgrade, because i put in the chunk loader upgrade after starting the robot it was set to be inactive by default. edit: not sure why this would cause it to shut down though as running it on robots without chunk loader upgrades and moving 36 chunks away doesn't seem to break anything.
    • I've made a simple mining program but after a while of mining the robot just turns off and the analyzer doesn't give an error message.   code: local robot = component.proxy(component.list("robot")()) local inventory_controller = component.proxy(component.list("inventory_controller")()) local generator = component.proxy(component.list("generator")()) local inventorySize = robot.inventorySize() local maxEnergy = computer.maxEnergy() local trash = {} trash["minecraft:cobblestone"] = true trash["minecraft:dirt"] = true trash["minecraft:gravel"] = true trash["minecraft:stone"] = true function rebind() robot = component.proxy(component.list("robot")()) inventory_controller = component.proxy(component.list("inventory_controller")()) generator = component.proxy(component.list("generator")()) end function select(n) if not robot.select(n) then rebind() robot.select(n) end end function inventoryManagement() select(1) if robot.place(0) then for i = 2, inventorySize do item = inventory_controller.getStackInInternalSlot(i) if item then if trash[item["name"]] then select(i) robot.drop(1, 64) elseif not(string.find(item["name"], "minecraft:coal") or string.find(item["name"], "pickaxe")) then select(i) robot.drop(0, 64); end end end end select(1) swing(0) end function refuel() for i = 2, inventorySize do item = inventory_controller.getStackInInternalSlot(i) if item then if string.find(item["name"], "minecraft:coal") then select(i) generator.insert(16) end end end end function equip() for i = 2, inventorySize do item = inventory_controller.getStackInInternalSlot(i) if item then if string.find(item["name"], "pickaxe") then select(i) inventory_controller.equip() break; end end if i == inventorySize then computer.shutdown() end end end function swing(n) success, result = robot.swing(n) while not(success) do if result == "air" then break elseif result == "block" then equip() end success, result = robot.swing(n) end end function move(n) while not robot.move(n) do swing(n) end end b = 1 while true do for a = 1, 16 do if a == 1 then robot.turn(b % 2 == 1) end if a == 16 then robot.turn(b % 2 == 0) end swing(0) swing(1) swing(3) if a == 16 then inventoryManagement() end move(3) end b = b + 1 if computer.energy() / maxEnergy < 0.75 and generator.count() < 16 then refuel() end computer.pullSignal(0) end the turtle has an ender chest from ender storage in it's first inventory slot and pickaxes / coal in it's inventory. When it shuts off it hasn't run out of pickaxes or energy, the problem seems to only happen when it's doing the inventoryManagement() function. Minecraft version: 1.12.2 Tier 2 robot with 2 inventory upgrades, 1 inventory controller upgrade, 1 generator upgrade and a chunk loader upgarde.  
    • ProjectOC 3 ProjectOC 3 is a little server with focus on OpenComputers. The pack is designed for our server, but can be used standalone too. On our server you have the possibility to access your OC disks using an FTP connection. This way you can code directly on the server using your preferred editor/IDE. To guarantee the server performance as much as possible we have limited the amount of chunkloader upgrades to 10 per player. But at least you get these right from the beginning. We are open for any suggestions and to do some events like game jams if the interest is these. If you want to join the project we recommend you to join our Discord server too. There you can talk with us and get news about POC in general as well as server events. MC server: poc3.bloodcoffeegames.com Discord server: https://discord.gg/v927kk7 Modpack (GitHub): https://github.com/toothlessblue/POC3 Modpack (Technic Launcher): https://www.technicpack.net/modpack/projectoc-reboot.1745971 Optifine We strongly recommend anyone to install optifine. Unfortunately we are not allowed to add it to our modpack. So you have to install it by yourself. Optifine: https://optifine.net/adloadx?f=OptiFine_1.12.2_HD_U_F5.jar The modpack: OpenComputers with:   Computronics   OCDevices   OCSensors   OpenGlasses   OpenLights   OpenModularTurrets   OpenScreens   OpenPrinter   OpenPython   OpenSecurity   OpenFM   Zettaindustries Some mods to round off the pack:   Alchemistry   AliensVsPredator   AppliedEnergistics2   ArchitectureCraft   AE2Stuff   BetterFPS   BiomesOPlenty   ChestTransporter   Chisel   ChiselAndBits   Clipboard   Comforts   Controlling   CompressedBlocks   DoggyTalents   EnchantingPlus   EnderIO   EnderIO Conduits   EnderStorage   FastLeafDecay   FTBUtilities   Gravestone   IronChest   IronJetpacks   LittleTiles   MalisisDoors   MmmMmmMmmMmm   ModernLights   Morpheus   Morph-o-Tool   MouseTweaks   MultiHotbar   NuclearCraft   PneumaticCraft:Repressurized   ProjectRedBase   ProjectRedCompat   ProjectRedFabrication   ProjectRedIntegration   ProjectRedLighting   Railcraft   RetroComputers   RSGauges   SimpleFluidTanks   ThermalExpansion   ThermalDynamics   Thut'sElevators   Tinkers'Construct   Tinkers'ToolLeveling   VeinMiner   WirelessCraftingTerminal   and some requirement mods/libarys as well as background mods like BetterFPS. optional:   ChunkAnimator   Jei (of course)   SoundFilters   TheOneProbe   InventoryTweaks We hope you like that project, and we see you on the server :).  
    • Hello fellas, I've got some Question and an Error in the Github Documentation under "Extending" (Github documentation). 1. The "dev JAR from the build server" isn't available; Error 404 Where can I get the File from? Do I really need it to develop something compatible with OC? 2. Where is "eclipse/mods"? Thanks in advance!
  • Popular Contributors

  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.