Random dungeon generator...

This is a discussion on Random dungeon generator... within the Game Programming forums, part of the General Programming Boards category; I am creating a text based RPG, which I will eventually add network support to so you can with/against your ...

  1. #1
    Registered User blackwyvern's Avatar
    Join Date
    Jan 2002
    Posts
    60

    Random dungeon generator...

    I am creating a text based RPG, which I will eventually add network support to so you can with/against your friends. But I want to make some random dungeons... Tell me what you think about this idea, or maybe you have a better way of doing things.
    I would make a very large array like map[1000,1000] (or very much larger) From there I dont know how to do it... I guess I would need some recursive function with some simple rules like
    well, I dont really know. It would be easy to make the dungeon manually, but also very time consuming. Can somebody point me in the right direction here?

  2. #2
    Registered User GreenCherry's Avatar
    Join Date
    Mar 2002
    Posts
    65

    Hmm

    I would have to say that i would be extremely hard to make an RPG in it self but i would be almost impossible to make what you want to do.

  3. #3
    Unregistered
    Guest
    Heres what I would do..

    I would create an 80 x 24 array (or however many pixels your screen is, I believe thats what it is in DOS / Console mode). And I would define each outer area as a "wall", and there would be a random amount of entrances / exits against a wall, lets say 3...

    So when you randomize, the outer layer of your array would look like this, when rendered.. * = wall and E = exit

    ******E*****
    * *
    E E
    * *
    ************

    And then, you start filling up the middle part with stuff.. lets say.. X = monster and * = wall again..

    So you could have...

    ******E*****
    * M *
    E M***** E
    * ***** *
    ************

    Then your array would have to put maybe some items in, and it could keep track of the players position for collision detection and combat, etc.

    Then once a player reaches an exit, you just take the proper row / colum in your array, and keep it. then you randomize the next part of the dungeon from that.

    So if they exited to the north exit, keep array[0][0-80]

    Then randomize.

    I hope you could follow that. The hardest part is going to be tweaking the randomness in the middle, so you don't have walls out of place, etc. You could create random "tables", where it picks an item from a table and plops it in at that point. So you could make a little crypt box or something, and if it picks that, then you plop the entire thing in.

    Good luck.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How exactly does the random number generator work?
    By Finchie_88 in forum C++ Programming
    Replies: 6
    Last Post: 08-24-2007, 01:46 AM
  2. NAQ: Everything you never wanted to know about CPP
    By evildave in forum C Programming
    Replies: 21
    Last Post: 12-12-2005, 10:56 AM
  3. Testing Random Number Generator
    By Roaring_Tiger in forum C Programming
    Replies: 7
    Last Post: 08-12-2005, 01:48 AM
  4. Another brain block... Random Numbers
    By DanFraser in forum C# Programming
    Replies: 2
    Last Post: 01-23-2005, 05:51 PM
  5. Random number generator
    By Caze in forum C++ Programming
    Replies: 6
    Last Post: 12-03-2002, 08:10 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21