Worldgen Rewrite

We Dwarf Fortress now

Actually, DDA is getting quite DF-y now that I think about it.[/quote]

Yep, we’re getting there. Takes longer because we’re not full-time and there are more of us to coordinate, but we’re getting there.

Alright, I have saving and loading down. Now I’m going to go through and fix up overmapgen, and then we’ll see about making the localmapgens more interesting. Is it alright it I go and add a bunch more tags to the overmap terains? Like how they currently have tags for “is_road”, “is_river”, I’d add things like is_building, is_landform, post_cataclysm, etc. I’m not sure on the specifics, but something like that.

If you want to add a lot of tags, it may be better to make them into a std::set instead. Or if you need speed, std::bitfield.

std::set is straightforward to use, the only semi-challenging part is loading it from a json. However this is already solved in src/item_factory.cpp, so you can just copy some functions and repurpose them.

std::bitfield is a bit harder to use (and also a bit more tedious), but it’s still nothing advanced. Vehicle and monster code uses it a lot: whenever you see things like VPFLAG_AISLE, it’s actually an index for the bitfield.

With either of those (or both at once, like in vehicle code), you’d have a nice and clean way to test everything rather than a big block of if-else.

Alright, I’ll look into those. What about the underground stuff? Are subways still a thing, or were they taken out? I’m not seeing any in the worlds I generate but that might just be coincidence.

Edit: nvm, the code is still in. Hmm.

Subways should still be generating, if they aren’t that’s a major bug.
Every manhole and subway station should be linked to every other, at least transitively.

Std::set and std::bitfield are the best.

PS we’d LOVE to have more interesting subways.

[quote=“Kevin Granade, post:45, topic:8934”]Subways should still be generating, if they aren’t that’s a major bug.
Every manhole and subway station should be linked to every other, at least transitively.

Std::set and std::bitfield are the best.

PS we’d LOVE to have more interesting subways.[/quote]

IME subways/sewers link to a few other entry points, but should not be relied upon to get around. Sewers virtually never link to sewage treatment plants at the moment, and I don’t recall them doing so for a few stables.

Alright. I’ll take a look at that, then. I was also considering adding worm tunnels, from the graboids or something. Does that sound worthwhile?

Interesting idea but hits an issue as graboids are single-tile and just churn up dirt.

Now, cthonian or dhole tunnels, those could be Interesting. :wink:

Dhole’s would probably need to mention that they are in fact, the Cthulhu mythos creature and not the small fox-like one. :stuck_out_tongue:

Fixed broken link, thanks for the clarification :wink: -KA101

Hmmyes, Dhole tunnels…


so how does one tell if a tile is a road tile, just from reading the JSON? Cause some of my code cares about that, and it’s acting really funky.

What json are you referring to?

mapgen.cpp has is_ot_type checks, but they’re used for adjacent tiles and generally only during worldgen (make sure building entry-points connect to the road).

Specifically, the is_road boolean on oter_t. it’s set by the is_road function in overmap.cpp.

overmap::is_road(x, y, x) takes the oter_id at (x, y, z) on the overmap, grabs the corresponding oter_t from the id, and returns its “is_road” value, which is set by ::isroad(std::string bstring) in overmap.cpp, which compares ids read in from json to hardcoded values to determine whether a tile is considered a road (or a road equivalent) by the road smoothing algorithm (which treats things like subways and sewers as roads because they use the same algorithm) for the purposes of making things line up correctly (for example, bridges return true for isroad so that when a road butts up to a bridge, it knows to connect to that bridge instead of using a road termination like a cul de sac).

I’d have one request here:
I’d like the terrain generation not to get significantly slower when the terrain is pure rock or pure air. Most of the terrain generated after z-level update will be of this kind.
It doesn’t need to be blazing fast (current mapgen does a bit of unnecessary stuff), just no billions of mandatory checks if the terrain itself is going to be a block of uniform rock.

Just those two cases - pure rock and pure air.

yeah, those two should be pretty fast. Slowdown should be dependent on how many things are on a tile, so with pure anything it should be pretty fast.

hmm. So I’m getting sewers, though mostly just as big lumps beneath cities, (Correction: I’m getting necropolis sewers. No normal ones, though) but subways, ant hills, mines, and labs are all refusing to generate below ground. Does anybody, know of any major differece between how sewers are generated and how everything else is generated?

Also, what’s up with the necropolis cities? They look like other cities from the surface, except their base IDs are all necropolis_a_54 or whatever. When I walk through them, they look really trashed, is that the whole point? If so, is it alright if I rewrite them to be generated as normal cities with a tile on top indicating that they should be trashed or something?

The notable part of necropolis cities is their underground portion (which is admittedly incomplete). It’s probably best to leave them as set pieces right now to ensure access to their underground area, unless you want to create repaired versions of the necropolis city and then apply damage to it around various places, but you would still have to ensure that the underground was accessible.

Hmm. I’ll take a look at that later, then. I think I’m still likely to rewrite it in some fashion. I’ll need to go over and see what all’s been implemented and what all was planned to be implemented.


The surface will likely be a relatively nomal town, using normal town tiles, with some invisible tiles laid on top to signify it’s a necropolis, then with a heavy dose of the generic “This place is wrecked” tiles on top of that, or maybe use the necropolis tiles for such damage. Underground, it’ll detect the necropolis tiles on the surface and generate a proper crypt to go with them.