Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  Dungeon generation 2d array  (Read 934 times)
0 Members and 2 Guests are viewing this topic.
Offline lordberzerker97

JGO n00b
*

Posts: 34



« on: 2012-01-12 22:59:16 »

 Hello guys. I need help with my game again. I am currently trying to figure out how to create randomized dungeons. I currently know how to tile map games and what I really want to know is how to create dungeons. Please give me some steps on how to do it. Or some code will be nice.
Offline sproingie

JGO Strike Force
***

Posts: 894
Medals: 55



« Reply #1 on: 2012-01-13 00:09:04 »

What have you looked at so far?  Because there are a whole *lot* of resources out there that I can find if I simply google the first two words of your post.  It's easier to help if there's a starting point, i.e. some actual code you've started to write or an algorithm you're interested in.
Offline lordberzerker97

JGO n00b
*

Posts: 34



« Reply #2 on: 2012-01-13 00:17:56 »

 Well I don't have an actual code for random dungeon generation. Usually when searching through google i see most dungeons using BSP trees. The one thing I am really wondering is if BSP trees are compatible with 2D arrays...
Games published by our own members! Go get 'em!
Offline ra4king

JGO Kernel
*****

Posts: 3153
Medals: 196


I'm the King!


« Reply #3 on: 2012-01-13 00:27:35 »

Why don't you try it? Wink

Offline tackman

JGO n00b
*

Posts: 14



« Reply #4 on: 2012-01-13 05:40:48 »

What have you looked at so far?  Because there are a whole *lot* of resources out there that I can find if I simply google the first two words of your post.

Yeah, "hello guys" returns 152 000 000 results!

But seriously;
Why don't you try it? Wink

If you hit walls with trying that BSP tree method then ask, maybe we can be of further help. (Well, others, I'm not really smart when it comes to random dungeons.)
Offline kevglass
« League of Dukes »

JGO Kernel
*****

Posts: 5214
Medals: 49


Mentally unstable, best avoided.


« Reply #5 on: 2012-01-13 05:44:21 »

Here's some stuff i wrote up about dungeon generation:

http://old.cokeandcode.com/node/1363
http://old.cokeandcode.com/node/1444

And some source code:

http://old.cokeandcode.com/node/1445

Anywhere you get a 404 just change www.cokeandcode.com to old.cokeandcode.com

Cheers,

Kev

Offline evilfrenchguy

Jr. Member
**

Posts: 80
Medals: 3



« Reply #6 on: 2012-02-03 16:35:43 »

If I were to do it, I'd generate a random number between x and y equal to the number of "rooms" initially to fit in the array. Then I'd loop through for each room and pick a random size (maybe in tile units), accounting for the number of rooms I have to fit. At that point it's up to you to generate each room based on your game.

Or, as another option, you could have a 2d DungeonRoom array. Before you generate each specific room, place them in the array first (randomly of course ^_^), so that when a room is being generated it knows that there might need to be doors placed on a particular wall.
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.106 seconds with 19 queries.