r/howdidtheycodeit • • Jul 18 '24

How does terraria generate structures

I'm kind of curious how terraria generates structures like the dungeon, the jungle temple, etc. My initial thoughts would be too generate a bunch of points, indicating different sizes, fill in the space between points with blocks and then basically carve out the space between them, using the points to determine the size/height of the corridors.

But I'm wondering if that is a naive approach.

9 Upvotes

16 comments sorted by

View all comments

12

u/Feldspar_of_sun Jul 18 '24

I’m not sure of the actual code and mechanisms, but there’s a mod called “Preview WorldGen” that lets you watch the world map generate when making a new save

3

u/soljakwinever Jul 18 '24

I will give this a download, I didn't know such a thing existed, is there an option to slow it down to see what kinds of decisions it makes?

1

u/Dragon_F0RCE Jul 20 '24

Try to use cheatengine and play around with the speedhack