Viewing Issue Simple Details Jump to Notes ] Wiki ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0007153 [DCSS] Patches feature N/A 2013-06-04 08:56 2013-06-20 08:50
Reporter infiniplex View Status public  
Assigned To mumra
Priority normal Resolution done  
Status resolved   Product Branch 0.13 ancient branch
Summary 0007153: Changes to box generation in layouts, layout_gehenna_???, layout_city
Description There are 4 patch files here so they can be analyzed independently. They all apply to level generation.

1. Rewrote LUA dgn.add_box_doors function
    -> The set of passable glyphs that doors will place next to can now be set.
    -> The door glyph can now be specified
    -> Doors are now distributed evenly between possible edge positions directly, instead of to 4 sides equally and then equally along the side. This will make the doors more even on long thin boxes. This is also the only change that will affect existing use of this function.
    -> Doors can optionally be forbidden to place beside each other and form a gate.
    -> Doors will now only place if there is an open cell directly in front and behind them. Previously, any three passable neighbors was sufficient.
    -> Doors can now place on a wall that is more than one cell thick. The normal door glyph is placed on the outside of the (thick) wall. Glyphs can also be set for the inside of the wall and the intervening cells.
    -> Added sanity check so that function no longer locks up if there are no valid positions for doors.

    -> Removed to helper functions only used by dgn.add_box_doors
    -> Renamed wall thickness parameter in dgn.add_box from "width" to "thickness". This is for consistency with the dgn.add_box_doors function. The parameter was never used, so this will not affect anything.

2. Added LUA you.depth_fraction function that returns the player's depth in the current branch as a fraction in the range (0, 1]

3. Added rooms to the layout_gehenna_??? layouts
    -> Rooms are stone and embedded in the existing rock walls
    -> This revision can leave disconnected lava pools on the map. I consider this a flaw in the zonify.map_fill_zones function, which I do not understand well enough to change. However, my testing suggests that uncontrolled teleport never teleports you over lava even if you are flying. If this is the case, this is not a major issue unless/until lava orcs or similar are added.
    -> The layouts now have somewhat more lava to compensate for the area lost to the rooms.
    -> Fixed a bug that made lava pools become smaller with depth instead of larger.

4. Fiddled with layout_city
    -> Added unusual rooms with outer walls 2 or 3 tiles thick. These rooms can also contain an inner room if they are large enough
    -> Fixed the treasure_area to test left bound against right (and top against bottom) before placing items. Previously it checked right against right and thus never placed anything.
    -> Changed item placement in treasure_area to place less valuable items as the number placed increased. Function previously might place 25 '|'-quality items if called in a moderately large room.
    -> Inner room has a 1/5 chance of generating with a different material than its outer box

    -> broke up a few long (>80 character) lines in other layout functions

I have also demonstrated to my own satisfaction that the LUA commands to test and change MMT_VAULT marks on a cell assume that the current vault (or layout) will not be rotated or mirrored. Becuase making vault generation generate around an empty area make silly-looking maps, I have added no checks for vault overlap to the layout_gehenna_??? layouts. Note that some of these layouts are non-symmetrical, and depend to mirroring and/or rotation to cover all cases.
Additional Information
Tags No tags attached.
Attached Files ? file icon 0001-Reimplemented-LUA-dgn_make_box_doors-more-options.patch [^] (6,694 bytes) 2013-06-04 08:56 [Show Content]
? file icon 0002-Added-LUA-you.depth_fraction-function.patch [^] (1,297 bytes) 2013-06-04 08:57 [Show Content]
? file icon 0003-Added-rooms-to-Gehenna-pools-layouts.patch [^] (7,942 bytes) 2013-06-04 08:57 [Show Content]
? file icon 0004-Added-thick-walls-to-some-layout_city-rooms.patch [^] (9,109 bytes) 2013-06-04 08:57 [Show Content]
png file icon GehennaRooms1.png [^] (28,641 bytes) 2013-06-04 08:57

png file icon GehennaRooms2.png [^] (52,914 bytes) 2013-06-04 08:57

png file icon LayoutCityThickWalls.png [^] (37,939 bytes) 2013-06-04 08:57

? file icon layout_city2.des [^] (7,749 bytes) 2013-06-07 06:53 [Show Content]
png file icon LayoutCityThickWalls2.png [^] (22,923 bytes) 2013-06-07 06:53

? file icon layout_pools.des [^] (21,257 bytes) 2013-06-14 06:23 [Show Content]
png file icon GehennaCircularRooms.png [^] (82,562 bytes) 2013-06-14 06:23

? file icon 0001-Added-LUA-make_round_box-function.patch [^] (8,953 bytes) 2013-06-15 19:48 [Show Content]

- Relationships

-  Notes
infiniplex (reporter)
2013-06-04 09:01

The green areas (excluding isolated cells) in the layout_city layouts are treasure areas placed by the layout. These are the first layout_city that generated for each depth (after I started looking for screenshots), so the frequency should be representative.

Exception: I generated several layout_city layouts for Lair:2 before I got one with thick walls to demonstrate the ruining effect on them. I took the first layout with non-1 thickness walls, so the same should still be (approximately) representative.
mumra (developer)
2013-06-04 21:43

1) Nice to see the Gehenna architecture concept expanded upon. The effect seems to have worked better in some screenshots than others. It seems to look best when the rooms are embedded around the edge of the layout; you could perhaps hunt for spots where 40%+ of the area is rock. I'd also like to see something with non-rectangular rooms, they're a bit boring compared to the very organic rock formations; crennellations, towers, or just the irregular box function. I have some slightly more complex ideas to test out for this at some point but what we have here is certainly a nice variant already anyway.

2) The zone filling problem is something I'm aware of, I fudged something for the Swamp layout to allow deep water zones to get filled there, should be able to apply the same principle here.

3) The thickened wall rooms I like, these could actually be a bit more frequent since they are more interesting than the plain boxes. For further variation the inner and/or outer doors could randomly be omitted, having open corridors leading to the /inner area instead of those ante-chambers. Something else I was planning is to conflate a number of the room drawing techniques used in various layouts into a kind of API so that all room-based layouts can pick from a weighted list of common room generators. This has kind of been my idea all along (and a common system to actually place those rooms onto existing layouts) but it hasn't been realised as yet and there are other questions like perhaps we should be improving the standard vault placement code and then use *that* to perform techniques like this.

4) The mirror/rotate problem is pretty much unavoidable since the layout code runs before vault placement decides where to put the map. The only reason it can work at all is because the layouts are always full-size so they always place at (0,0). The only solution is to use nomirror/norotate and make sure the layout itself covers all orientations internally (most of mine already do that). Of course if the rooms were placed later with vault placement as per my suggestion in 3) they would automatically avoid overwriting vaults. For now there's nothing else that can be done although the results aren't usually too bad what with orient vaults automatically carving an entrance and vetoes existing. Very occasionally however weird things can happen: recently I saw a Zot layout where the entire level was cut off from the orb chamber, except for about two squares which happened to contain a staircase. Because the stairs were there the area wasn't considered disconnected so it didn't carve any further path. Perhaps we should always veto if there is more than one zone after level generation for oriented maps.
infiniplex (reporter)
2013-06-05 07:42

1. a) The rooms already place only overlapping rock. I believe the ones that look like they are in the open entirely replaced rock pillars. I will try increasing the required fraction.
b) T see three things I could do with the rooms to make them more interesting.
  -> Just use assorted interesting shapes. Possibly make a couple new functions to generate them. (We may need a separate file for all of these...)
  -> Make all the rooms some special shape and keep it unique to Gehenna (which would help with uniqueness). I am thinking circular towers that get bigger with depth. The smallest ones would just be solid 3x3 pluses, but they could get much larger.
  -> You have some quite interesting rooms in some of your layouts (I think this is hyper code?). Would those work here? If so, how do I use them?

2. Zone-filling is tricky conceptually. Even if you fill in all the lava, there are still can be buried walls on non-rock tiles (in my case stone) out there to find with dig. As such walls might also be supposed to be there, I am not sure how to deal with this.

3. a) I will make the suggested changes.
b) If you make a room placement API, make sure that you can either set weights for the rooms generated or place rooms of any type without the API. I suspect I am not the only control freak who will look at them.
c) If you make an API, please at least make a list of the functions people using it are meant to use. I was able to find the lists in the .cpp files for the C++-implemented ones, but with LUA I never know which are just helpers.

4. a) Shucks. I will have to complicate a few of my layouts.
b) I don't think disconnected parts of maps is necessarily bad. It would be in hells and pan where going back is not an option, but elsewhere you can just use try a different stairs. Perhaps it would be better to veto zones below a certain minimum size.

5) Are the first two patches good as they are?
infiniplex (reporter)
2013-06-07 06:53

3. a) Here is a revised layout_city. Changes:
(i) Thickened walls are more frequent.
(ii) Boxes with walls of 2 or thicker sometimes place without doors.
(iii) Boxes can appear with an internal dividing wall at the same probability as an inner box. The probability of treasure rooms adjusts to keep the total frequency the same.
(iv) I choose some random percentages for unusual features (thicker walls, inner boxes, inner walls) at the start. I theory, this will make give each map generated a bit of a style more often that just random numbers.
(v) There are no thick walls in Dis, but the inner boxes and walls are more common.
mumra (developer)
2013-06-11 01:54

This looks cool. Do all four patches need applying in order?
infiniplex (reporter)
2013-06-11 19:35

Apply the first 2 patches (in either order) and the the new version of the city layout afterwards. I am not done revising the Gehenna stuff based on what you said, but I will make a new patch for it when I am done. I suspect that it would be better to put it in a new issue, as this one is getting rather tangled.

Based on the amount of scrolling I have to do, I am wondering if I should go back to smaller layout images. Alternatively, is there some way to make them start not expanded by default? (Like text files do.)
mumra (developer)
2013-06-12 12:54

Thanks. I'm not bothered by the images but what's interesting is that on my old Gehenna layouts patch - 0006738 - the images weren't expanded at all and the links had to be clicked. The only obvious reason I can see for this is that the file sizes were much bigger.

Another option is to upload them to an image pasting service like [^] or [^] - but really, I wouldn't worry about it too much. You could also make the images more compact by tiling more across horizontally and reducing the whitespace between maps.
infiniplex (reporter)
2013-06-14 00:40

I was worried that if I make the images really wide, they will be bigger than some people's screens. I know that I (and mumra) have big screens, but I was not sure about other people. When I think about it, however, having to scroll sideways past images you want to see is not that horrible a fate, so I will do that from now on. The black squares are 80x70 pixels before scaling (to give a sense of map size), but I can place them closer together. Thank you.

A file size cutoff seems to be in effect. I checked a bunch of Mantis posts, and the cutoff seems to be somewhere between 90,186 and 109,621 bytes. I would guess 102,400 (100kb).
infiniplex (reporter)
2013-06-14 06:23

And here are two more files.

The first is a patch adding a new LUA function named make_round_box that makes circular (or ellipse - I tested it) boxes with doors. The doors only generate next to passable terrain, and there is an option (veto_if_no_doors) to make the entire room not place if no doors can be placed. A value is returned indicating whether the room placed successfully.

The is another version of layout_pools.des. I have rewritten the Gehenna layouts to produce all rotations without mirroring. This turned out to be a good thing anyway, as I was able to compact the previous 9 versions (I think) into 3 with more total variety and less code. The layouts also now place circular boxes instead of rectangles. This is not a patch because I don't want it to be cumulative on my previous Gehenna patch and I am not confident I can make this work with git. The non-Gehenna layouts in the file are unchanged except for a few minor fixes to whitespace.
infiniplex (reporter)
2013-06-14 06:28

In Gehenna, the rooms get larger and more frequent with depth.

The new version of layout_pools.des depends on the you.depth_fraction and make_round_box patches. I do not think it depends on the make_box_with_doors patch, but I guess it could. The make_round_box patch should be added after the make_box_with_doors patch.
mumra (developer)
2013-06-14 12:23

I think you missed the make_round_box patch ...

Everything else is applied in trunk now.
infiniplex (reporter)
2013-06-15 19:52

Sorry. Here is the patch.

Is there any policy on what goes into and what gets its own file? I have noticed that has gotten a lot since I started adding things.
mumra (developer)
2013-06-20 08:18

There's no policy. I've noticed some of those files getting a bit big too; feel free to start a new file or split that one up if you feel like it.
mumra (developer)
2013-06-20 08:49

I've applied all this in trunk now, thanks! I also significantly bumped up the weights for your Gehenna layouts, for some reason they were massively lower than my ones, I thought they were all roughly the same.

I also did a slightly brute-force thing to fill the lava zones, I'll improve this at some point but it works for now.
mumra (developer)
2013-06-20 08:50

Applied, closing

- Issue History
Date Modified Username Field Change
2013-06-04 08:56 infiniplex New Issue
2013-06-04 08:56 infiniplex File Added: 0001-Reimplemented-LUA-dgn_make_box_doors-more-options.patch
2013-06-04 08:57 infiniplex File Added: 0002-Added-LUA-you.depth_fraction-function.patch
2013-06-04 08:57 infiniplex File Added: 0003-Added-rooms-to-Gehenna-pools-layouts.patch
2013-06-04 08:57 infiniplex File Added: 0004-Added-thick-walls-to-some-layout_city-rooms.patch
2013-06-04 08:57 infiniplex File Added: GehennaRooms1.png
2013-06-04 08:57 infiniplex File Added: GehennaRooms2.png
2013-06-04 08:57 infiniplex File Added: LayoutCityThickWalls.png
2013-06-04 09:01 infiniplex Note Added: 0023046
2013-06-04 21:43 mumra Note Added: 0023052
2013-06-05 07:42 infiniplex Note Added: 0023060
2013-06-07 06:53 infiniplex Note Added: 0023091
2013-06-07 06:53 infiniplex File Added: layout_city2.des
2013-06-07 06:53 infiniplex File Added: LayoutCityThickWalls2.png
2013-06-11 01:54 mumra Note Added: 0023148
2013-06-11 19:35 infiniplex Note Added: 0023154
2013-06-12 12:54 mumra Note Added: 0023156
2013-06-14 00:40 infiniplex Note Added: 0023178
2013-06-14 06:23 infiniplex Note Added: 0023183
2013-06-14 06:23 infiniplex File Added: layout_pools.des
2013-06-14 06:23 infiniplex File Added: GehennaCircularRooms.png
2013-06-14 06:28 infiniplex Note Added: 0023184
2013-06-14 12:23 mumra Note Added: 0023185
2013-06-15 19:48 infiniplex File Added: 0001-Added-LUA-make_round_box-function.patch
2013-06-15 19:52 infiniplex Note Added: 0023199
2013-06-20 08:18 mumra Note Added: 0023237
2013-06-20 08:49 mumra Note Added: 0023239
2013-06-20 08:50 mumra Note Added: 0023240
2013-06-20 08:50 mumra Status new => resolved
2013-06-20 08:50 mumra Fixed in Branch => 0.13 development branch
2013-06-20 08:50 mumra Resolution open => done
2013-06-20 08:50 mumra Assigned To => mumra

Mantis 1.1.8[^]
Copyright © 2000 - 2009 Mantis Group
Powered by Mantis Bugtracker