AllenSeitz / DimDungeons

A Minecraft mod which adds proceedurally generated dungeons.
14 stars 11 forks source link

DimDungeons not generating outside dimension and spamming logs #3

Closed TelepathicGrunt closed 4 years ago

TelepathicGrunt commented 4 years ago

I'm creating a mod that imports features from all biomes and I noticed the DimDungeons does not get added to my mod's dimension. Instead, it seems there's an unneeded dimension check in the dungeon features' Place methods and as a result, it spams the logs with this lol image

The solution is to remove the dimension checks and add DimDungeons only to the biomes that spawn in DimDungeon's dimension to make DimDungeons more mod friendly. These kinds of error checking doesn't add extra functionality and instead, makes it less compatible with mods that want to handle other mod's stuff.

Still, the DimDungeon dimension is awesome! :)

AllenSeitz commented 4 years ago

I did register the dungeon feature exclusively to dimdungeons:biome_dungeon. The reason for not spawning the dungeons outside of the intended dimension is complicated.

Basically, I want to ensure that the dungeons only ever spawn at precise coordinates. There are two reasons for this. One is to ensure that dungeons don't overlap or spawn close enough together that they interfere. (Interfere with noise, lag, redstone, or anything else). And two I have a map on the roof. If you use a vanilla blank map inside of a dungeon then you'll see that I actually drew a minimap on the roof of each dungeon! I like this feature but it only works if the dungeons are aligned to exactly every 3rd chunk out of every 16. Which is fine. That gives me an 8x8 area to build in, and an 8x8 area on either side to leave as void. It works out nicely.

Now for world gen rules. In my 1.12.2 prototype I was spawning the entire dungeon whenever the entrance chunk was decorated. This caused "runaway chunk generation" warnings even though it was a constant 64 chunks generated at most. The lag was still terrible though. But I read a comment from the Doomlike Dungeons author saying that he wished he had split his dungeons into chunk-sized pieces, so that he could do safe worldgen like vanilla, and not place the entire complex whenever the player gets 10 chunks away. I said, Eureka! My rooms are already chunk sized! So I did it that way and performance was great! You'd think that recalculating the dungeon shape for each of 64 chunks would be worse than calculating the dungeon layout once and placing all 64 chunks together. But it turns out that the "wall math" is trivially fast and that placing blocks and mobs is slow.

Those constraints together led me to implement a very non-standard feature. Most features clamp themselves to the ground, like villages and shipwrecks. But mine appear at a constant y=50. (I can tell you more about the teleporting-in process. A lot of thought went into the unseen areas.) Most features also have a random chance to appear, or some sort of randomness like villages (again) and trees and flowers and lava lakes. But my dungeons appear 100% of the time at specific coordinates and 0% of the time in other areas.

I thought about what would happen if another mod took dimdungeons:feature_basic_dungeon and registered it to minecraft:overworld and that would be a disaster. Think of how ruined that dimension would be. So I put that print statement there and disallowed it.

It sounds like you're trying to implement a dimension which combines every feature from every biome and dimension, all together, into some sort of chaos world? End Cities and Nether Fortresses next to each other? I like it! But consider what would happen if that print statement didn't stop you. I think your entire +X/+Z quadrant from 0 to 2 million would be obliterated. (Well, from y=50-70 anyways.) And it's not like these dungeons have doors! Dungeons are enclosed boxes designed to keep the player inside. Finding one from the outside would be awkward.

AllenSeitz commented 4 years ago

I think what you need is a new feature, something like a dimdungeons:basic_dungeon_worldgen_safe version. And in this new java class the y-coordinate of the structure would not be hardcoded at 50. And the portal blocks and any obsidian touching them would be replaced with minecraft:air instead of dimdungeons:block_gold_portal. That would create a door. And then maybe a system to control structure rarity like vanilla strongholds? Among other potential changes.

TelepathicGrunt commented 4 years ago

Ah that makes sense. The dimension isn't exactly suppose to be balanced at all so complete obliteration is fine in my book lmao. But yeah, I'll see about doing a new feature to work with your mod if possible.

AllenSeitz commented 4 years ago

Actually if you're still interested I have a new idea.

My idea still involves creating a new feature. This feature would behave similar to a vanilla shipwreck in the sense that it would spawn at random locations and place a single simple structure.

But the twist is that it spawns single rooms from Dimensional Dungeons! This solves all the problems with spawning whole dungeons and I think seeing single, random, floating rooms scattered around this chaos dimension would be even more on theme!

If you look in the resources folder each room is already implemented as a single structure. They have names such as "dimdungeons:deadend_1" and "dimdungeons:entrance_5". It should be pretty easy to just randomly throw those down anywhere with no connections. And each room was designed to be self contained.

The one catch is that you would probably also want to copy my Data Block handling function so that the chests are assigned loot tables, monsters are spawned, and so forth. Or not! You can also replace those things with anything you want.

TelepathicGrunt commented 4 years ago

Oh that's a good idea, thanks! I'll try that out when I get a chance!

TelepathicGrunt commented 4 years ago

Thank you so much! I was able to add direct support for your mod and got all the dungeons to spawn nicely! (they don't connect perfectly but it is good enough as I have it where a patch of dungeons will use 4 way dungeons in a checker pattern to maximize connected rooms without needing to resort to making an complicated class to do connections)

I made sure to add a link to your curseforge page of your mod in my mod's page. :) https://www.curseforge.com/minecraft/mc-mods/worldblender

And I just realized this isn't really any issue report anymore so you can close this lol