fnuecke / oc2

RISC-V VMs in Minecraft.
https://www.curseforge.com/minecraft/mc-mods/oc2
Other
623 stars 80 forks source link

Bigger Memory Sticks / Bigger Flash #50

Open fionera opened 3 years ago

fionera commented 3 years ago

When Playing around with the Mod the maximum memory of 4x8MB gets filled quickly. How about adding a recipe which adds a way to increase the memory stick capacity until maxMemorySize gets hit.

I already played a bit with the Code tho I dont know how to add a Recipe that just edits the NBT Data. The memory or harddrive size would get doubled by this recipe:

            ShapedRecipeBuilder
                    .shaped(Items.MEMORY_SMALL.get(), 1)
                    .pattern(" T ")
                    .pattern("ISI")
                    .pattern(" B ")
                    .define('T', Items.TRANSISTOR.get())
                    .define('I', Items.MEMORY_SMALL.get())
                    .define('S', Tags.Items.SLIMEBALLS)
                    .define('B', Items.CIRCUIT_BOARD.get())
                    .unlockedBy("has_computer", inventoryChange(Items.COMPUTER.get()))
                    .unlockedBy("has_robot", inventoryChange(Items.ROBOT.get()))
                    .save(consumer);

What do you think about this?

CoolCat467 commented 3 years ago

I wouldn't know anything in particular, but I know that the original Open Computers mod was specifically designed to work well with servers. I would expect OCII to follow in those footsteps, and again, not sure about any of this, but there are probably reasons behind the current max size. I think more memory is unlikely to happen knowing this, but who knows? Things change.

fionera commented 3 years ago

I already tested this by just increasing the sizes and it just works. Even the maxMemory value which blocks starting of too big Systems. It just allows more freedom in configuring :)

fionera commented 3 years ago

I got the recipe to work tho I dont know how to get it into JEI. https://github.com/Paranoidlabs/oc2/commit/fb0a5dff04ae5d8d19eca94b1e2c12a26173ecab

fnuecke commented 3 years ago

For now the intent is to enable some scripting and... well. That it runs Linux is fun and all, but I don't really aim to support full-blown desktop distributions, so for now I feel like 32M is quite a lot already. Keep in mind all of this also has to be stored on disk somewhere, for every running computer in the world. And if absolutely needed, larger RAM could be implemented in an addon.

Before I write this off, however, I'm curious: what is your use-case for you to run out of memory, right now?

7eggert commented 3 years ago

My use case for OC is a few robots and one computer on a single-player world so having a higher limit would be fine.

IDK if I ran into this problem but my recursive mining algorithm did sometimes just stop.

CoolCat467 commented 3 years ago

Recursion is very memory intensive though. Is there not other ways to do it?

7eggert commented 3 years ago

Maybe there is one but imagine a patch of soul sand and a bot with a shovel. The bot can only check it's immediate surroundings and it's supposed to avoid turning and moving.

logan2611 commented 3 years ago

I also found that during my testing it was pretty easy to run out of memory, although that was running Linux programs, not scripts. Perhaps like what was proposed in #77 the memory tiers could be adjustable in a config file and also implement a per player limit?

bastetfurry commented 2 years ago

Keep in mind all of this also has to be stored on disk somewhere, for every running computer in the world.

That certainly might be a problem with a large public world, but me being the admin of our little private world would love to increase harddisk spaces to at least double if not quadrupled. I doubt that four to five gigabyte of OC2 drives would make the coal fat for our game, if we even ever get there. Even with one of us porting over some "missing" programs like BWBASIC. ;)

In essence, i would propose that you simply make that configurable, let the admin decide if they can spare the space for a bunch of OC2 drive images.