Anonymous | Login | 2024-04-26 13:32 CEST |
Main | My View | View Issues | Change Log | Wiki | Tavern | News |
Viewing Issue Simple Details [ Jump to Notes ] [ Wiki ] | [ View Advanced ] [ Issue History ] [ Print ] | |||||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | |||||||
0006184 | [DCSS] Implementables | feature | N/A | 2012-09-07 08:06 | 2012-12-25 06:25 | |||||||
Reporter | brendan | View Status | public | |||||||||
Assigned To | ||||||||||||
Priority | normal | Resolution | open | |||||||||
Status | new | Product Branch | 0.16 ancient branch | |||||||||
Summary | 0006184: Abyss Procedural Level Generators | |||||||||||
Description |
I'm reworking the Abyss (again)! The current Abyss is largely homogenous, monotonous and stale. The new approach is largely inspired by constructive solid geometry (http://en.wikipedia.org/wiki/Constructive_solid_geometry [^] ) and procedural noise (ex. Perlin noise and Worley noise). Rather than constructing the dungeon by generating the whole world in one go, we can instead describe functions that when queried will produce parts of the dungeon. This allows us to have arbitrarily sized levels! A collection of dungeon generators should produce interesting layouts. How do dungeon generators work? Each generator should implement ProceduralLayout: class ProceduralLayout { public: virtual dungeon_feature_type operator()(const coord_def &p, double offset = 0); }; `p` is a coordinate in the dungeon, `offset` is a parameter that will slowly vary as the player explores the dungeon. If the output varies in offset, then the abyss will morph slowly over time. Other generators might be static. What should generators do? Gosh. This one is tricky. I encourage you to look at the examples in dgn-proclayouts.h on the inception branch. Here's an example: class ColumnLayout : public ProceduralLayout { public: ColumnLayout(int cw, int cs = -1, int rw = -1, int rs = -1) { cs = (cs < 0 ? cw : cs); _col_width = cw; _col_space = cs; _row_width = (rw < 0 ? cw : rw); _row_space = (rs < 0 ? cs : rs); } dungeon_feature_type ColumnLayout::operator()(const coord_def &p, double offset) { int x = p.x % (_col_width + _col_space); int y = p.y % (_row_width + _row_space); if (x < _col_width && y < _row_width) return DNGN_MINWALL; return DNGN_FLOOR; } private: int _col_width, _col_space, _row_width, _row_space; }; Suppose we create a ColumnLayout(2). When the x and y coordinates each are less than 2 mod 4, you get a floor, otherwise you get a floor. This gives us a nice, regular grid pattern. Not too exciting, but it can be downright creepy! ColumnLayout(2,6) gives us a similar pattern, but with half as many columns. Perhaps you (yes, you!) could try making a similar layout that produces diamonds instead of squares. Experiment! More complex layouts consume other layouts and blend between them. The attached screenshots show a blended ColumnLayout / ChaoticLayout. |
|||||||||||
Additional Information | ||||||||||||
Tags | No tags attached. | |||||||||||
Attached Files |
Screen Shot 2012-09-06 at 10.57.31 PM.png [^] (72,267 bytes) 2012-09-07 08:06
Screen Shot 2012-09-06 at 10.56.37 PM.png [^] (77,667 bytes) 2012-09-07 08:06 Boxes-2012-10-25.zip [^] (33,711 bytes) 2012-10-26 06:42 example.txt [^] (1,403 bytes) 2012-12-10 07:30 [Show Content] |
|||||||||||
|
Mantis 1.1.8[^] Copyright © 2000 - 2009 Mantis Group |