#scripting and world generation

160 messages · Page 1 of 1 (latest)

harsh frost
#

are there any plans to enable scripting integration within world generation?
for example scripts that can modify structure placement or contents based on world events.

blazing kite
#

We need worldgen custom components xD

rigid sundial
nimble bramble
zinc spear
#

the performance wozld definitely fail here, molang is the way or static definition components

harsh frost
zinc spear
#

what do you mean by that?

#

like block events?

harsh frost
zinc spear
#

well custom components still have JS callbacks and like i said JS is slow

#

so i still dont think thats the way

harsh frost
#

i am not saying it should be the way. just as an option
we do have a lot of molang stuff that script can do, so it would be nice to have the option to play around with world gen using script

undone lynx
zinc spear
#

but thats not happening so it wwould be slow if they just add apis for conditions or something

#

also keep in mind that API calls are slower then actually JS context calls

undone lynx
#

I was more referring to fully custom impls

#

Like WGE or ur thing

zinc spear
#

ohh

#

👍

undone lynx
#

Tho please mojang optimize molang lmao

hexed cosmos
#

We're looking to explore some ways to maybe integrate scripting with world gen, but as you all note, it's a bit hard because it wouldn't be performant to, say, have scripting "take over" significant parts of chunk generation. Three-deep for loops of a set of blocks can get slow quickly 🙂

But maybe there are places where we can call out to script to "make a decision" about something. Not aware of a place where script will be in the short term roadmap for worldgen though.

hexed cosmos
#

One of the first demos I tried to build with scripting a couple of years ago was a dungeon generator in script, but it was hard to make it work because most of the logic was about how do you timeslice all of the block placement (and also deal with chunk load semantics) across ticks to get the thing built.

Since then there is a bit more support in scripting for things like generator functions to take advantage of spare cycles in a tick - and maybe if you limit its usage to highly performant devices (a beefy dedicated server) or you really optimize - it could be pretty workable and awesome. I know some people in the community have built some cool things along those lines.

terse cipher
#

I've chatted about it elsewhere, but a fun prototype for us to do would be to use the webworker model to spin off JavaScript to actually run on other threads for stuff like world generation.

A neat idea would be to provide a different API surface (a different module you can import) with specific world-gen related APIs.

All just fun ideas at this point, but maybe one day!

warped belfry
#

I think even just hooks like chunkBuilt could be interesting. But would even something at that scale still be too slow?

wooden umbra
#

the current issue with generation in general using the Script API is that it is post-generation, meaning it does not generate unless you are within simulation distance. Luckily Molang can be used for custom terrain, but its also still not very performant.

terse cipher
cosmic quarry
wooden umbra
terse cipher
acoustic vessel
cosmic quarry
cosmic quarry
acoustic vessel
#

Structures are very different from sculpting and decorating the world

cosmic quarry
wooden umbra
#

my dungeon generator would be far laggier in scripts than it currently is with functions

wooden umbra
acoustic vessel
cosmic quarry
acoustic vessel
#

And there's still the terrain itself

wooden umbra
#

and it does not take 3 minutes

cosmic quarry
wooden umbra
#

now the unreleased one could take a little while because it has to be able to load individual modules that are 31x31x31 or larger

#

i purposely slowed that one down, but once i finally finish it itll load a lot faster

cosmic quarry
dusky kiln
terse cipher
cosmic quarry
#

I think it would be nice to have an event that is called when a certain structure is loaded

dusky kiln
cosmic quarry
#

And ticking area cannot be set through scripts

wooden umbra
acoustic vessel
olive gate
#

🙏 If scriptAPI can't do it, I know my boy runCommand comes in clutch.

cosmic quarry
#

By the way, good idea..

acoustic vessel
#

Wait, you're making structures block by block???

wooden umbra
#

the unfinished one uses it tho, but only to reduce lag as much as possible

cosmic quarry
wooden umbra
limpid rose
#

For dungeon creation on the fly, I found using a block generator to be too slow and switched to making chunk-sized room structures and I'm placing and updating them at sim distance whenever the player changes chunks

cosmic quarry
wooden umbra
#

performance is

cosmic quarry
wooden umbra
#

using block-by-block also makes sure fps doesnt slow to a crawl

cosmic quarry
acoustic vessel
wooden umbra
#

itll also lag more

acoustic vessel
wooden umbra
#

its one reason i chose to use functions

wooden umbra
acoustic vessel
#

I don't know

#

I can't even remember you saying that

#

With the title of the post and the conversation I assumed we were talking about structure generation via scripting

cosmic quarry
dusky kiln
wooden umbra
dusky kiln
#

there have also been other implementations by people such as ConMaster

wooden umbra
#

you do realize how laggy that actually is...

#

it's post-gen

orchid quail
wooden umbra
#

at least using molang for terrain isnt laggy

dusky kiln
#

Its not as laggy

#

in general it actually is not laggy at all

wooden umbra
#

if so its just as bad

dusky kiln
wooden umbra
#

Molang-based terrain is done in generation

#

what ur using is post-generation

dusky kiln
wooden umbra
#

which will ALWAYS be laggier than generation passes

dusky kiln
cosmic quarry
wooden umbra
wooden umbra
dusky kiln
#

which is not a big difference

cosmic quarry
wooden umbra
#

MPT = Mod-Plug Tracker

#

lmao

dusky kiln
wooden umbra
#

no matter what you do

dusky kiln
wooden umbra
#

unless it can be done within generation

#

there will always be a performance increase

#

there's no getting around that

dusky kiln
#

sure, but if the end users doesnt notice a difference it is fine.. isnt it?

wooden umbra
wooden umbra
#

not fine for creators

#

more of a hassle to do than it needs to be

dusky kiln
wooden umbra
#

it's better to wait for the q.noise query to have its seed unlocked or wait for the ability to directly modify Minecraft's terrain generator

dusky kiln
#

a solution via scripts is way easier and way more extendable :)

cosmic quarry
wooden umbra
dusky kiln
#

no absolutely not, just use WGE/other custom world gens as a polyfill rn

dusky kiln
wooden umbra
#

its literally just math

dusky kiln
cosmic quarry
dusky kiln
#

but we can optimize it more

#

and have more than just math lol

wooden umbra
#

thats literally all procedural terrain is

#

math

dusky kiln
#

eh, kinda and kinda not

#

yes it is mostly math

wooden umbra
#

perlin noise is also math

dusky kiln
#

but a lot is also other conditions, for example using libraries for a lot of features

wooden umbra
#

sure libraries are helpful

#

but again

#

postgen is a nightmare

#

i will never go back on that

#

sure, my dungeon generator is postgen

doesnt mean i like postgen

dusky kiln
#

wonder how much I can optimize that dungeon generatior via the scripting api

#

one tick dungeons generation go brrr

cosmic quarry
#

We are all content creators after all, and I don't think we should argue about which is better. Because “better” is a rather complex concept. I believe that the main thing for generation is optimization and comfort for the player. And not speed, although this is also important

cosmic quarry
wooden umbra
#

but good luck

#

youll likely run into a lot of issues

#

especially with infinite module size

cosmic quarry
#

Difficulties in writing scripts are the norm

dusky kiln
wooden umbra
# dusky kiln ?

its the issue im tackling with my unreleased generator version

#

the fact that larger modules cause significantly more lag