How can i make structures generate automatically?

Post Reply
W3RQ01
Member
Posts: 157
Joined: Sat Nov 28, 2020 06:33
GitHub: W3RQ01
In-game: Dario23 or W3RQ01
Contact:

How can i make structures generate automatically?

by W3RQ01 » Post

Hi everyone!

I'm currently in search of a mod that generates random structures across the world but as of now i still haven't found anything so i started thinking about make it on my own.

The problems that I'm facing are multiple and one of them - if not the biggest - is: How can i make the structures generate automatically? How do tell mt to generate that structures only in specific cases?

Any help is appreciated,
W3RQ01
OneUnitedPower

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: How can i make structures generate automatically?

by sirrobzeroone » Post

A very big question.

A Question for your Question:
  • By random structures do you mean the structures themselves are randomly created on the fly by the engine or just that the engine picks from an available pool of schematics per biome?
If it's the second just selecting from a pile of schematics, they would just be registered as decorations for each biome and you could set the decoration placement chance low (fill_ratio or noise_params). The hard part with this solution although it would be fun is building all the schematics.
Info around decoration placement is at the below, I'd recommend Wuzzys schematic exporter and using Lua schematics rather than mts format:
https://minetest.gitlab.io/minetest/def ... definition
viewtopic.php?f=11&t=18515

The first have the engine construct things from random blocks, I have no idea best I can think of is replacing the nodes in a predefined schematic with ones specific to a biome - bit like dungeons but it's not hard to do. if it's just random geometric type shapes that's doable....fairly sure theres a lua mapgen that does fractals somewhere. Beyond that I think I remember maybe Sokomine playing around with house shapes being auto-generated rather than schematics but it might have been someone else.

If it is the second your after - rough process:
  • create a simple build in mtg, export using wuzzy's schematic exporter
  • create a simple mod for mtg and have that decoration randomly placed in say grassland biome
  • Once above works add more schematics and decoration configuration
  • Add code improvements for example use same schematic but replace wood planks for trees native to that biome - this is easier with lua schematics from my limited knowledge :)

W3RQ01
Member
Posts: 157
Joined: Sat Nov 28, 2020 06:33
GitHub: W3RQ01
In-game: Dario23 or W3RQ01
Contact:

Re: How can i make structures generate automatically?

by W3RQ01 » Post

sirrobzeroone wrote:
Wed Aug 17, 2022 00:15
A very big question.

A Question for your Question:
  • By random structures do you mean the structures themselves are randomly created on the fly by the engine or just that the engine picks from an available pool of schematics per biome?
Is possible the make the game auto-generate them?
OneUnitedPower

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: How can i make structures generate automatically?

by sirrobzeroone » Post

W3RQ01 wrote:
Wed Aug 17, 2022 12:40
Is possible the make the game auto-generate them?
In theory anything is possible, whether it's worth the time and effort in coding is another question - there's no in built function so you would be creating everything from scratch but people have created maze builders and other things I mentioned so it's possible.

I'm not sure you would get much more flexibility than say creating schematic files for a dozen various things and then replacing the nodes on place with biome specific ones.

User avatar
Skamiz Kazzarch
Member
Posts: 613
Joined: Fri Mar 09, 2018 20:34
GitHub: Skamiz
In-game: Skamiz
Location: la lojbaugag.

Re: How can i make structures generate automatically?

by Skamiz Kazzarch » Post

This mod might be interesting to you: Structure generator

Astrobe
Member
Posts: 571
Joined: Sun Apr 01, 2018 10:46

Re: How can i make structures generate automatically?

by Astrobe » Post

There are a couple of mods that do this like this one:

viewtopic.php?t=7200

There's also a couple more than generate roads.

But they are rather old.

Astrobe
Member
Posts: 571
Joined: Sun Apr 01, 2018 10:46

Re: How can i make structures generate automatically?

by Astrobe » Post

sirrobzeroone wrote:
Wed Aug 17, 2022 00:15
The first have the engine construct things from random blocks, I have no idea best I can think of is replacing the nodes in a predefined schematic with ones specific to a biome
That's sort of what Blockmen's ruins generator I mentioned above does, except it doesn't use schematics.

I have integrated and evolved this mod in my game, see https://gitlab.com/Astrobe/minefall/-/t ... mods/ruins if you are interested in that approach.

This is an old version, I have since used the method you described for placement - I hijack the decorations generation to have the mapgen select locations for me, rather than using the heavy find_node_in_area() method.

W3RQ01
Member
Posts: 157
Joined: Sat Nov 28, 2020 06:33
GitHub: W3RQ01
In-game: Dario23 or W3RQ01
Contact:

Re: How can i make structures generate automatically?

by W3RQ01 » Post

Ok thanks everyone!

If you have more advices please let me know, i'm kinda noob in this
OneUnitedPower

User avatar
FreeLikeGNU
Member
Posts: 280
Joined: Tue Oct 28, 2014 02:50
GitHub: FreeLikeGNU
IRC: freelikegnu
In-game: FreeLikeGNU

Re: How can i make structures generate automatically?

by FreeLikeGNU » Post

My witches mod generates randomized cottages over dungeons close to the surface using the dungeon generation event in the mapgen. Link in my signature.

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests