L-system for schematics? Finding a dungeon generation API

Post Reply
User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

L-system for schematics? Finding a dungeon generation API

by texmex » Post

I'm aware of several dungeon generator mods, but is there a dungeon generation API in existance for MT? What I'm looking for is an API flexible enough to piece equal-sided room schematics together algorithmically.
Last edited by texmex on Thu Oct 10, 2019 10:14, edited 1 time in total.

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: Dungeon generation API

by texmex » Post

I realized that what I imagine actually resembles the very underused L-system for trees alot, with the difference being that nodes has been replaced by map blocks. Maybe it’d be easier to design such an API if it can inherit some of the L-system ideas.

Or maybe, there’s a good reason why people aren’t using the L-tree system to begin with but it's hard to deduce since the documentation is very poor.

User avatar
duane
Member
Posts: 1715
Joined: Wed Aug 19, 2015 19:11
GitHub: duane-r
Location: Oklahoma City
Contact:

Re: L-system for schematics? Finding a dungeon generation AP

by duane » Post

Why not just use roomgen? It already handles schematics.
Believe in people and you don't need to believe anything else.

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: L-system for schematics? Finding a dungeon generation AP

by texmex » Post

Yes, roomgen is close. It needs to be abstracted into an API type of mod however. The problem is that I don’t understand the code. xD

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: L-system for schematics? Finding a dungeon generation AP

by paramat » Post

> is there a dungeon generation API in existance for MT?

Nope =)
it would be much better for you to code what you want in a Lua mod.

ShadMOrdre
Member
Posts: 1118
Joined: Mon Dec 29, 2014 08:07
Location: USA

Re: L-system for schematics? Finding a dungeon generation AP

by ShadMOrdre » Post

I would highly recommend duane's Geomoria mod, or my fork of it. It looks quite extensible, and we still have duane around to answer questions, when he's not coding or posting more screenshots..... ;)

IMHO, all Geomoria really needs is more spaces defined for it, to give it more variety, and perhaps a way to limit generation to biomes or some other definition. It's also quite speedy.


Shad

User avatar
duane
Member
Posts: 1715
Joined: Wed Aug 19, 2015 19:11
GitHub: duane-r
Location: Oklahoma City
Contact:

Re: L-system for schematics? Finding a dungeon generation AP

by duane » Post

Geomoria uses a building description language that makes it very easy to build massive structures, and it's much more efficient than schematics, since it describes everything as cubes, spheres, etc. I was disappointed by the utter lack of anyone willing to help make maps for it. I even made a how-to with inkscape templates.

However, it can't handle things like torches or spiral staircases very well, and schematics are still better for really complicated or small structures. Also, there's something to be said for having to go into the game and build what you want, then capture it as a schematic, rather than building it all as a diagram. Plus, having to make an entire 80m cube at once can be intimidating (though no one says you can't leave part of it unfinished stone).

As for fitting it in with other terrain, don't get your hopes up. I tried for some time to get it to handle partial chunks, and it turned into such a horrible snarl of malfunctioning code that I gave up. It can deal with keeping things under or over a simple heightmap (by cutting them off), but that's about it.
Believe in people and you don't need to believe anything else.

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: L-system for schematics? Finding a dungeon generation AP

by texmex » Post

Interesting! So you’re using mapchunks as the smallest unit whereas I’d like map blocks for my solution. I also need it to be schematic based so that collaboration on prefab creation is made as easy as possible.

User avatar
duane
Member
Posts: 1715
Joined: Wed Aug 19, 2015 19:11
GitHub: duane-r
Location: Oklahoma City
Contact:

Re: L-system for schematics? Finding a dungeon generation AP

by duane » Post

texmex wrote:Interesting! So you’re using mapchunks as the smallest unit whereas I’d like map blocks for my solution. I also need it to be schematic based so that collaboration on prefab creation is made as easy as possible.
That's a nice idea -- the bigger they are, the more you can innovate -- but how do you connect them? Sixteen meters is too big for single corridors, so you either have to have fixed connecting points or make the entire face the connector and get stuck with a grid pattern of corridors, making mazes impossible.

Roomgen just connects the center of each side. Geomoria has four connection points on each horizontal face -- three low and one high. It's big enough that you can tangle the corridors connecting each exit point through the body of the chunk, but they always come out in one of the fixed locations.

I'd love to hear of another way to do it.
Believe in people and you don't need to believe anything else.

ShadMOrdre
Member
Posts: 1118
Joined: Mon Dec 29, 2014 08:07
Location: USA

Re: L-system for schematics? Finding a dungeon generation AP

by ShadMOrdre » Post

Ok, duane, from the horse's mouth.

Can you give us a quick tut on how to make some more geomorphs. I've looked at the code, I understand I'm carving empty space into a 80x80x80 cube of stone, and that's about as much as I understand.

I guess it's a little like reverse schem building. Instead of placing blocks in air, I'm carving air from a block.

Is there some chance there could be made a somewhat more schem friendly processor? If not, I'm all about expanding the geomorphs, even if it makes me head hurt. Geomoria should be made into C, added to the engine as the default dungeon code for all mapgens. This would be totally cool if it could even read geomorphs on the fly, but I'm pissin' in the wind on that one. Lua runs after C. Sigh..... A single node mapgen with biomes made available, so that Lua mapgens don't have to keep recreating the biome wheel would be another pipe dream........

texmex,

You could easily break up the mapchunks for smaller spaces, or better yet, divide them. Just because two rooms exist in the same map chunk doesn't mean they need to be connected. Those rooms can still be entered from the preset entrances that duane mentions. Hallways, even maze like, can be drawn easily within the larger geomorph, disconnected from each other, only accessible from the preset entrances. I wouldn't even worry if every room can be entered. Players will find the maze(s) that will get created, and the rooms and tunnels that aren't open to any other accessible area are just ignored, until dug out. Now you can have even vault like areas. This could be more than we think.

And duane's willing to help? What more do we need. I'm all in on this one!

Take a peek at his recent screenshots on the screenshots thread, if you haven't already. I think some of that maze like appearance could easily be "turtle" drawn, simply by randomly connecting various geomorph maze blocks.

Shad

User avatar
duane
Member
Posts: 1715
Joined: Wed Aug 19, 2015 19:11
GitHub: duane-r
Location: Oklahoma City
Contact:

Re: L-system for schematics? Finding a dungeon generation AP

by duane » Post

ShadMOrdre wrote:Can you give us a quick tut on how to make some more geomorphs. I've looked at the code, I understand I'm carving empty space into a 80x80x80 cube of stone, and that's about as much as I understand.
The original tutorial. Each item in your geomorph table is a table containing fields to describe a simple shape made of nodes. Making structures is very simple. The hard part is planning everything out, which I used inkscape for. It's exactly like paper and pencil dungeon mapping in 3D.

Schematic making is a whole different technique. Geomoria wants descriptions of shapes, not locations of nodes. In order to convert schematics to geomorphs, you need AI smart enough to recognize 3D shapes in a collection of nodes. I'm definitely not up to that challenge.
Geomoria should be made into C, added to the engine as the default dungeon code for all mapgens.
Funny you should say that. I've already converted most of the geomorph code into C as part of another project -- the C version of squaresville -- but now I can't locate the source code. If I find it, I'll be happy to give it to anyone who wants it. However, I remember at the time thinking that it would be a nightmare to try to get into the game. It required a lot of changes to the rest of the game objects that would probably be hard to get support for.

Anyway, I'm not interested in working with C anymore.

Edit: Here it is. Better copy it, if you want it. I'm liable to lose it again.

Edit: By the way, you can put torches and such in geomoria, but you have to specify a cube of size one with the correct param2 for the torch. If it's rotated (the geomorph), the torch facing will probably break -- I don't think I had any code to deal with wall-mounted items, apart from ladders. Honestly, I'd only recommend it for big constructions.
Believe in people and you don't need to believe anything else.

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: L-system for schematics? Finding a dungeon generation AP

by texmex » Post

Is WorldEdit and its param2-friendly schematic format a good fit as a dependency in a mapblock size schematic-based dungeon generation system? It seems capable?

I've also looked at both schemlib and handle_schematics in the past but I was too stupid to understand them. Looked at exschem as well, it seems most easy to use.
Last edited by texmex on Mon Oct 14, 2019 15:33, edited 2 times in total.

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: L-system for schematics? Finding a dungeon generation AP

by texmex » Post

paramat wrote:it would be much better for you to code what you want in a Lua mod.
A Lua API is what I'm asking for.

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: L-system for schematics? Finding a dungeon generation AP

by Sokomine » Post

texmex wrote: I've also looked at both schemlib and handle_schematics in the past but I was too stupid to understand them. Looked at exschem as well, it seems most easy to use.
Regarding handle_schematics, that certainly isn't your fault. It isn't sufficiently structured for an api yet, and documentation is sadly lacking. I've still got a lot to do there. The api also supports a lot of things that are necessary for placement on the surface but irrelevant for placement underground (no need to worry about snow for example).

However..after having read the discussion here...I wonder if it might be a solution to use one of the minetest.place_schematic* functions to place the schematics - and then afterwards fix what minetest.place_schematic* fails at.

If you're dealing with rooms for a dungeon, you probably won't need the replacement function, so you can live with not beeing able to change the replacement table after the first placement of the schematic after each start of the game.

Some nodes commonly found in inhabitated areas (furnaces, chests) already require special treatment after beeing placed into a VoxelManip area. Maybe nodes with facedir could be handled in a similar way: Iterate over each node of the volume, and if it's a facedir/wallmounted node that needs to be rotated properly, do so for those specific nodes *after* the placement but before writing the data back. The table format returned by minetest.read_schematic might be good enough for that purpose (16x16x16m rooms). Apart from that, handle_schematics can read .mts files. The advantage here is that you get a list of node names the schematic contains and can check each of them for special requirements (is it a chest? has it facedir set? etc.) and can later on just check for the appropriate ID in the changed volume.

Maybe you ought to experiment a bit with L-system and the minetest.place_schematic* functions to see how it works.

Geomorgia is also a very intresting but diffrent concept.
A list of my mods can be found here.

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: L-system for schematics? Finding a dungeon generation AP

by paramat » Post

texmex wrote:A Lua API is what I'm asking for.
Ah i misunderstood, thought you meant an API that exists in the MT engine.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests