Python script to generate simple "dungeon maps"
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 1.5KB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
123456789101112131415161718192021
  1. # Simple procedural generation of "dungeon maps"
  2. Basic proof of concept for a "cellular automata" model. No real refinement at this point.
  3. Initial work based on [this tutorial](https://gamedevelopment.tutsplus.com/tutorials/generate-random-cave-levels-using-cellular-automata--gamedev-9664).
  4. It takes the following flags:
  5. * --width *x*: the width of the map. *x* must be a positive integer. See below.
  6. * --height *x*: the height of the map. *x* must be a positive integer. See below.
  7. * --seed *x*: the chance a given cell will be generated as "wall". *x* must be an integer from 1-99.
  8. * --death *x*: if a wall cell has fewer than this many wall cells surrounding it, it becomes empty. *x* must be an integer from 1-8.
  9. * --birth *x*: if an empty cell has more than this many wall cells surrounding it, it becomes a wall. *x* must be an integer from 1-8.
  10. * --reps *x*: the number of smoothing passes to take on the map. *x* must be a positive integer. Large values can significantly extend runtime.
  11. * --out: save the result to an image in the maps/ directory instead of printing it to the screen.
  12. ### A note on width and height
  13. If you use --out, width and height are in pixels.
  14. If you don't, height is lines of text, and width is measured in **chunks of two characters**; "--width 40" will produce a map 80 characters wide. This is because each "wall" cell is represented by a double **I** character and each "empty" cell is represented by a double space; in the font the developer uses, this makes maps where width and height are the same roughly square.