Computercraft - Dealing With Chunk Loading/Unloading (State Persistence)

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 พ.ย. 2024

ความคิดเห็น • 12

  • @DamienAustinn
    @DamienAustinn ปีที่แล้ว +23

    Dude, it's so refreshing seeing someone new doing something different in the ComputerCraft scene instead of the usual farm or reactor control, but instead showcasing a core component for full automation. I look forward to watching your youtube career grow with great interest!

  • @bmorr
    @bmorr ปีที่แล้ว +5

    I never actually got around to trying to make something like this, but I planned to do something similar back in 2021.
    It’s awesome to see someone actually doing something I really wanted to do but didn’t have time. I’m inspired to get back in and finish my strip mining program using this new knowledge.

  • @anonymousanon4822
    @anonymousanon4822 ปีที่แล้ว +6

    This can be done using only internal state (without GPS) and I did so many years ago. Program called ore collecting miner, you can probably find it on the old forums.
    The approach completely destroyed the maintainability of my program which meant that while being the most advanced thing I did, it was also the thing that completely killed further developement on that program.
    Basically I did use a file to keep state (only that I also kept instructions that still had to be done to be able to resume from anywhere in the program. This was done by completely rewriting the program so that each instruction now was instead written into the file, which was iterated over). But how did I manage to make it stay synchronous? I figured out that movements can actually be made persistant as LAMA does by tracking the fuel level. If fuel was used, the turtle moved, if fuel wasn't used, it didn't. This is known. My innovation was simply to do a similar thing for turns. At the start of the program I'd use a torch (which prefers to point in a certain direction - I believe south, but I dont remember) to figure out which direction the turtle is facing. The keep track of the faced dirdction throughout the program. Upon restart recheck the direction with the torch and fix it if necessary. To measure the torch, the turtle would make sure that the block above has a block on each side, then place the torch up (between those 4 blocks). It would always choose the same block to stick on. Tgen the turtle would remove the 4 blocks one by one, checking after each if the torch dropped (meaning the torch must've stuck to that block, making it north (iirc)). Nowadays this can be achieved way easier because of turtle.inspect(). Just place the torch against one block and read the metadata, then you know which way that block is facing.

    • @Dragonofshame
      @Dragonofshame 8 หลายเดือนก่อน +3

      This is an interesting solution to a problem that I was just having. After doing some testing I think that an even better approach is to use something like a furnace. They always face one of the cardinal directions, so you don't have to worry about the turtle placing them incorrectly. The turtle also always places the furnace facing itself, so if the state of the furnace is that it's facing south then you know that the turtle is facing north.

  • @tonitch
    @tonitch 4 หลายเดือนก่อน +1

    great video ^^ you could also use "checkpoint" if your gps is not setup by having special blocks in certain spaces. for instance you could have a block in front of the turtle (or a flower if you like fancy) everey time it should turn to the right. this way the turtle will never get out of path and the code stay quite simple ^^

  • @czowiektost9376
    @czowiektost9376 ปีที่แล้ว +2

    I was looking for a video like that, it helped me a lot

  • @manto4479
    @manto4479 3 หลายเดือนก่อน

    With a mod like peripheralsplusone, that add a chunk loader peripheral, this problem could be easily avoided, if anyone was wondering

  • @guitarrplayer16
    @guitarrplayer16 19 วันที่ผ่านมา

    This problem is why I stopped playing computer craft 10 years ago. I culd not do anny reliable operations as they constantly broke when chunk was unloaded.

  • @thewannabetradesman
    @thewannabetradesman ปีที่แล้ว +3

    Hello!
    I was having a problem with chunk loading and wonder if using a chunk loader block will help.
    I recall I had a simple program [using peripherals++ chatbox] to tell me when I needed to sleep if i didnt see the sun to prevent mob spawns.
    If I was away from the computer, the warnings never came. since I did have the program as a run on start, it would work when I returned in range.
    It makes sense for you not to want some programs to run when you are away - however for systems like that, i want it to run all the time.
    I have a modpack that has chunkloaders. I wonder if keeping the chunk loaded will stop this problem, since I also want to use computercraft to do monitoring and management of power systems and other automation which is chunk loaded [dont have the stuff set up yet] and i dont want my machines working without control and breaking or doing weird stuff if the computers don't pay attention to chunk loaders.
    Do computers stay running when the chunk is loaded?

    • @reinhardtborichevski6530
      @reinhardtborichevski6530  ปีที่แล้ว +2

      Yes, if you have access to chunkloaders then great, your computers will work. You can also add a computer to the spawn chunks, which are always loaded.

  • @raymondbottomtextbutidk8140
    @raymondbottomtextbutidk8140 7 หลายเดือนก่อน +1

    jesus christ that pc is running

  • @Mr.Katzzz
    @Mr.Katzzz ปีที่แล้ว +1

    can you put your work around in paste bin and put a link in the video please❓