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 2.2KB

7 yıl önce
7 yıl önce
7 yıl önce
7 yıl önce
7 yıl önce
7 yıl önce
7 yıl önce
7 yıl önce
7 yıl önce
1234567891011121314151617181920212223242526272829303132333435
  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. ## Installation
  5. This script requires the Pillow package. You can install it with
  6. `pip3 install Pillow`
  7. ## Running
  8. It takes the following flags:
  9. * --width *x*: the width of the map. *x* must be a positive integer. See below.
  10. * --height *x*: the height of the map. *x* must be a positive integer. See below.
  11. * --seed *x*: the chance a given cell will be generated as "wall". *x* must be an integer from 1-99.
  12. * --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.
  13. * --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.
  14. * --reps *x*: the number of smoothing passes to take on the map. *x* must be a positive integer. Large values can significantly extend runtime.
  15. * --out: save the result to an image in the maps/ directory instead of printing it to the screen.
  16. * --color: uses random complementary colors in the saved image instead of black and white. *Does nothing if not used with the --out flag.*
  17. * --chunky: makes each cell 2x2 instead of 1x1. *Does nothing if not used with the --out flag.*
  18. ### A note on width and height
  19. If you use --out, width and height are in pixels.
  20. 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 it so that if a map's width and height are the same, the map is roughly square.
  21. ### Chunky cells
  22. Smaller maps blown up to a larger size sometimes look better than larger maps, for some reason. The --chunky flag doubles the size of each cell, which makes the raw output twice as big and slightly more attractive. Use with caution on larger image sizes.