SethBling / cbscript

CBScript for Minecraft
1.14k stars 27 forks source link

feat: ability to convert existing datapack to cbs #7

Open nick-tonjum opened 8 months ago

nick-tonjum commented 8 months ago

Hi Seth! Very great job. I once had a project similar to this a few years ago but never ended up finishing it. I'd like to help out and contribute to this project, so expect to see some PR's from me. I'll cover this feature unless you beat me to it.

deli73 commented 8 months ago

out of curiosity, how would this work? decompiling minecraft commands sounds like it'd result in some pretty messy code at best.

nick-tonjum commented 8 months ago

out of curiosity, how would this work? decompiling minecraft commands sounds like it'd result in some pretty messy code at best.

Yeah probably. A whole new side of the program would have to be made. I was also thinking possibly a llama.cpp model that could possibly convert it?

deli73 commented 8 months ago

also any minecraft command can be a valid line of CBScript code, so we're not sure how one determines what can and can't be decompiled in the first place.

Brian151 commented 8 months ago

it seems to me you'd probably end-up with something akin to a dissaembly that should be your first step, anyways

i'm not sure how far decompiling/"decompiling" any given datapack would go, but you might be able to, say given an example "pack/customentity/<spawn.mcfunction,destroy.mcfunction,tick.mcfunction>" get "pack/customentity.cbs"

[re-]generating loops/ifs and other control flow or logic sounds like it wouldn't be nearly as simple. you could surely "decompile" the list of commands/functions, themselves but is that particularly helpful versus porting the whole thing by hand? how much manual fix-up is needed, regardless?

MinekPo1 commented 8 months ago

honestly, I feel like that is quite a bit out of scope from this project and would be better suited as a separate project.

I also have significant doubts about large language models being a good tool for the job, both due the resource usage and the risk of hallucinations. From my (though admittedly limited) experience, large language models struggle with unusual programming languages, though it should be noted the experience I'm drawing from is with a esoteric programming language.