# Worldgen Rewrite

**URL:** https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934
**Category:** The Drawing Board
**Created:** [February 17, 2015, 5:43am UTC](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934 "2015-02-17T05:43:36Z")
**Posts on this page:** 20
**Page:** 3

<div class="post-metadata">

### Author: ![KA101](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@KA101](https://discourse.cataclysmdda.org/u/KA101)
#### Post date: [February 21, 2015, 1:49am UTC](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934/41 "2015-02-21T01:49:33Z")

</div>

> [@Coolthulhu](#):
>
> [quote=“vache, post:39, topic:8934”]I don’t think there’s ever intended to be an end of development.

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.

---

<div class="post-metadata">

### Author: ![Angle](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/angle/32/957_2.png) [@Angle](https://discourse.cataclysmdda.org/u/Angle)
#### Post date: [February 21, 2015, 9:46pm UTC](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934/42 "2015-02-21T21:46:27Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Coolthulhu](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/coolthulhu/32/2446_2.png) [@Coolthulhu](https://discourse.cataclysmdda.org/u/Coolthulhu)
#### Post date: [February 21, 2015, 10:20pm UTC](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934/43 "2015-02-21T22:20:57Z")

</div>

> [@Angle](#):
>
> Is it alright it I go and add a bunch more tags to the overmap terains?

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.

---

<div class="post-metadata">

### Author: ![Angle](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/angle/32/957_2.png) [@Angle](https://discourse.cataclysmdda.org/u/Angle)
#### Post date: [February 21, 2015, 10:24pm UTC](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934/44 "2015-02-21T22:24:21Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![kevin.granade](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/kevin.granade/32/1316_2.png) [@kevin.granade](https://discourse.cataclysmdda.org/u/kevin.granade)
#### Post date: [February 21, 2015, 11:47pm UTC](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934/45 "2015-02-21T23:47:57Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![KA101](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@KA101](https://discourse.cataclysmdda.org/u/KA101)
#### Post date: [February 22, 2015, 1:23am UTC](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934/46 "2015-02-22T01:23:22Z")

</div>

[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.

---

<div class="post-metadata">

### Author: ![Angle](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/angle/32/957_2.png) [@Angle](https://discourse.cataclysmdda.org/u/Angle)
#### Post date: [February 22, 2015, 1:29am UTC](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934/47 "2015-02-22T01:29:08Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![KA101](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@KA101](https://discourse.cataclysmdda.org/u/KA101)
#### Post date: [February 22, 2015, 1:36am UTC](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934/48 "2015-02-22T01:36:30Z")

</div>

> [@Angle](#):
>
> 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. 😉

---

<div class="post-metadata">

### Author: ![i2amroy](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/i2amroy/32/909_2.png) [@i2amroy](https://discourse.cataclysmdda.org/u/i2amroy)
#### Post date: [February 22, 2015, 3:18am UTC](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934/49 "2015-02-22T03:18:13Z")

</div>

Dhole’s would probably need to mention that they are in fact, the [Cthulhu mythos creature](http://en.wikipedia.org/wiki/Dhole_%28Cthulhu_Mythos%29) and not the [small fox-like one](http://en.wikipedia.org/wiki/Dhole). 😛

Fixed broken link, thanks for the clarification 😉 -KA101

---

<div class="post-metadata">

### Author: ![Angle](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/angle/32/957_2.png) [@Angle](https://discourse.cataclysmdda.org/u/Angle)
#### Post date: [February 22, 2015, 4:49am UTC](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934/50 "2015-02-22T04:49:28Z")

</div>

Hmmyes, Dhole tunnels…

Yessssss…

---

<div class="post-metadata">

### Author: ![Angle](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/angle/32/957_2.png) [@Angle](https://discourse.cataclysmdda.org/u/Angle)
#### Post date: [February 22, 2015, 9:28pm UTC](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934/51 "2015-02-22T21:28:11Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![vache](https://avatars.discourse-cdn.com/v4/letter/v/ea666f/32.png) [@vache](https://discourse.cataclysmdda.org/u/vache)
#### Post date: [February 22, 2015, 9:32pm UTC](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934/52 "2015-02-22T21:32:38Z")

</div>

What json are you referring to?

---

<div class="post-metadata">

### Author: ![KA101](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@KA101](https://discourse.cataclysmdda.org/u/KA101)
#### Post date: [February 22, 2015, 9:40pm UTC](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934/53 "2015-02-22T21:40:57Z")

</div>

> [@Angle](#):
>
> 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.

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).

---

<div class="post-metadata">

### Author: ![Angle](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/angle/32/957_2.png) [@Angle](https://discourse.cataclysmdda.org/u/Angle)
#### Post date: [February 22, 2015, 10:26pm UTC](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934/54 "2015-02-22T22:26:59Z")

</div>

Specifically, the is\_road boolean on oter\_t. it’s set by the is\_road function in overmap.cpp.

---

<div class="post-metadata">

### Author: ![vache](https://avatars.discourse-cdn.com/v4/letter/v/ea666f/32.png) [@vache](https://discourse.cataclysmdda.org/u/vache)
#### Post date: [February 22, 2015, 10:43pm UTC](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934/55 "2015-02-22T22:43:40Z")

</div>

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).

---

<div class="post-metadata">

### Author: ![Coolthulhu](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/coolthulhu/32/2446_2.png) [@Coolthulhu](https://discourse.cataclysmdda.org/u/Coolthulhu)
#### Post date: [February 23, 2015, 8:52am UTC](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934/56 "2015-02-23T08:52:00Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Angle](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/angle/32/957_2.png) [@Angle](https://discourse.cataclysmdda.org/u/Angle)
#### Post date: [February 23, 2015, 5:41pm UTC](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934/57 "2015-02-23T17:41:49Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Angle](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/angle/32/957_2.png) [@Angle](https://discourse.cataclysmdda.org/u/Angle)
#### Post date: [February 23, 2015, 9:10pm UTC](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934/58 "2015-02-23T21:10:22Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![vache](https://avatars.discourse-cdn.com/v4/letter/v/ea666f/32.png) [@vache](https://discourse.cataclysmdda.org/u/vache)
#### Post date: [February 23, 2015, 9:25pm UTC](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934/59 "2015-02-23T21:25:33Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Angle](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/angle/32/957_2.png) [@Angle](https://discourse.cataclysmdda.org/u/Angle)
#### Post date: [February 23, 2015, 9:27pm UTC](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934/60 "2015-02-23T21:27:58Z")

</div>

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.

!!Spoilers!!

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.

[Previous page](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934.md?page=2)

[Next page](https://discourse.cataclysmdda.org/t/worldgen-rewrite/8934.md?page=4)
