# Thread: [How?] Random dungeon generator (like Binding of Isaac)

1. Member
Join Date
Mar 2012
Location
Sweden
Posts
88
Rep Power
0

## [How?] Random dungeon generator (like Binding of Isaac)

I'm programming a game like Binding of Isaac and right now I'm stuck at creating a random dungeon generator. I've looked through Google pretty much all day and I just can't find anything that could work like I want to. I've tried the A* path finding alg but I didn't like the results. Right now I barely have any code for the generator, just an ID array that contains Zeros. If it is by any help I want the spawn room to be a 2 in my array, the dungeon halls to be 1 and boss room to be 3. The array is 11 in width and 7 in height right now.

Thanks for spending time on me :D

2. Member
Join Date
Mar 2012
Location
Sweden
Posts
88
Rep Power
0

## Re: [How?] Random dungeon generator (like Binding of Isaac)

I've fixed this now. Can't edit my post for some reason though.

3. ## Re: [How?] Random dungeon generator (like Binding of Isaac)

If you tell us how you solved it, it might help someone who finds your question in a search.

4. Member
Join Date
Mar 2012
Location
Sweden
Posts
88
Rep Power
0

## Re: [How?] Random dungeon generator (like Binding of Isaac)

sorry didn't see the comment. Here is the code explained:

Java Code:
```//generate a random spawn position
int x = rand.nextInt(width);
int y = rand.nextInt(height);
ID[x + y * width] = 2;

//generating rooms
for (int i = 0; i < 14; i++) {
boolean done = false;
while (!done) {

//this is a method that generates two random positions and put them into a Point.
Point p = generateNewRoom();

//Here I check if the room at the given point is occupied.
//if it is it won't continue and restart the while loop
if (getRoomAt(p.x, p.y) == 0) {

/*
getRoomsBeside(x,y) returns the amount of rooms there is beside the given point.
doesn't check diagonal. since I don't want room with 4 adjacent rooms it doesn't
continue if the method returns 3 or over. Same if there is no room beside.
*/
if (getRoomsBeside(p.x, p.y) < 3 && getRoomsBeside(p.x, p.y) > 0) {
ID[p.x + p.y * width] = 1;
done = true;
}
}
}
}```
If you need more explanation just ask :D

5. ## Re: [How?] Random dungeon generator (like Binding of Isaac)

This would be very useful for my game in the future, so some explanation would be nice. Thank you!
Please PM/message me when you have!
Last edited by CadeLegallow; 06-10-2013 at 06:46 PM.

6. Member
Join Date
May 2014
Posts
2
Rep Power
0

## Re: [How?] Random dungeon generator (like Binding of Isaac)

Originally Posted by totalspelnerd
I'm programming a game like Binding of Isaac and right now I'm stuck at creating a random dungeon generator. I've looked through Google pretty much all day and I just can't find anything that could work like I want to. I've tried the A* path finding alg but I didn't like the results. Right now I barely have any code for the generator, just an ID array that contains Zeros. If it is by any help I want the spawn room to be a 2 in my array, the dungeon halls to be 1 and boss room to be 3. The array is 11 in width and 7 in height right now.

Thanks for spending time on me :D
PLEASE SIR, I BEG YOU! PLEASE DO A TUTORIAL FOR HOW TO CREATE A GAME LIKE BINDING OF ISAAC . Please ... i really want to create a game like binding of isaac, except, you know... other sprites,textures, etc..please contact me or post here a tutorial or anything :(.Im new to Java btw.

7. Member
Join Date
Jan 2012
Posts
13
Rep Power
0

## Re: [How?] Random dungeon generator (like Binding of Isaac)

PLEASE SIR, I BEG YOU! PLEASE DO A TUTORIAL FOR HOW TO CREATE A GAME LIKE BINDING OF ISAAC . Please ... i really want to create a game like binding of isaac, except, you know... other sprites,textures, etc..please contact me or post here a tutorial or anything :(.Im new to Java btw.

Depending on how new you are, I would really recommend spending some time getting familiar with Java before jumping into a project like that, 'cause from what you said it sounds like you'd need a lot of handholding at this point (which is OK!) but that's no fun and it won't be as good a product. No one's going to be able to give you a step by step guide on how to make your OWN game. Email me at pankakeshannon@gmail.com if you really want to go ahead with this and feel like you're capable, and I might be able to help you with little things here and there when I get time.

Have a good day.

8. Member
Join Date
May 2014
Posts
2
Rep Power
0

## Re: [How?] Random dungeon generator (like Binding of Isaac)

Originally Posted by ruben381
Depending on how new you are, I would really recommend spending some time getting familiar with Java before jumping into a project like that, 'cause from what you said it sounds like you'd need a lot of handholding at this point (which is OK!) but that's no fun and it won't be as good a product. No one's going to be able to give you a step by step guide on how to make your OWN game. Email me at pankakeshannon@gmail.com if you really want to go ahead with this and feel like you're capable, and I might be able to help you with little things here and there when I get time.

Have a good day.
sadly ive already gave up Java... its too hard for me... since ive never done this in school or anywhere,But i started making a game in Unity3D, and im on half of the road.The only sad thing on unity3d is that there arent many free stuff (models,animations,etc)... and since i have a 10h job... i barely open unity3d...
But thank you for replying , i really appreciate someone actually tried to help me :)

9. Member
Join Date
Jan 2012
Posts
13
Rep Power
0

## Re: [How?] Random dungeon generator (like Binding of Isaac)

sadly ive already gave up Java... its too hard for me... since ive never done this in school or anywhere,But i started making a game in Unity3D, and im on half of the road.The only sad thing on unity3d is that there arent many free stuff (models,animations,etc)... and since i have a 10h job... i barely open unity3d...
But thank you for replying , i really appreciate someone actually tried to help me :)

Haha that's ok man. Good luck with Unity.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•