I am creating a dungeon crawler, based off of Dungeon Crawl Stone Soup, and I want to know how I would create a method that generates a 2d char array that when printed out, resembles a dungeon map. I want to use the following chars.
# for walls
. for floors
> for stairs going down
< for stairs going up
* for items
How would I accomplish this? I am completely new to random generation, so I don't know. I am using JavaFX, so I don't know how that would affect the process.
Well, first of all I would draw rooms, both square and round. Then I would draw paths between those rooms. Then, I would create paths between the already existing paths . Finally I would Clean it up and make it look better.
I have no experience with AI, and if I need to learn it, could you direct me to a tutorial? I have looked myself, but I haven't found any good one for Java.
Right, so the first step is to define the basic shapes of the rooms, and to make sure that the rooms don't overlap. I suggest you use the shape classes in the java.awt sub-packages for this task. You can easily create basic shapes with java.awt.geom.Rectangle2D.Double and java.awt.geom.Ellipse2D.Double, and move them around by their x and y coordinates. To check that rooms don't overlap, you construct java.awt.geom.Area instances from their shapes, intersect() those areas and check if the resulting area is empty.
I advise running a google search "rogue dungeon generator code java"
It will turn up lots of useful links, tutorials and code samples which should assist you in this task.
I also advise just getting the system to work with a text string or text file output that spits out your sample generated dungeons.
Once you have verified that that is working, then try integrating it into a graphical display system such as JavaFX and rendering as you wish.