I'm trying to create a randomized dungeon.
-
An accessible approach might be to make your dungeon grid-based, and have every tile of that grid be a random one of various elements (e.g. items, chests, enemies etc.).
It might be worth checking out the "Level" tutorial to see what I mean. You will have to do a bit of work, though, to have everything make sense.
That is just one idea of course! -
Okay, thanks! I will go try that now!
-
@OrangePeel Just some general advice. Don't try to run before you can walk. At least work through the tutorials first before diving right in (apologies if you have already done so)
-
Welcome @OrangePeel I wish you luck with your game because I like games like that. For the record Fuze has a superb and incredibly friendly discord server if you're interested. (I think the white icon at the top is the link)
-
@CasualTie5 recommended I use a grid like in the level tutorial, and I’ve been working on something like that on and off, however I created a single variable, rng, which I set to a random of five different tiles for the ground, but now whenever it rolls that randomly it sets it to just whatever it rolled first, so all the ground will be bare, or chests, or spawn enemies. I attempted to stick it all into a loop, however this caused it to do the same thing, but it would just random roll it multiple times and they would all still be the same. I just wanted to ask here if there was any way to do it besides making separate variables for every single space on the map. Does anyone have any solution other than that? I will be willing to do anything lower maintenance than making 100s of separate variables.
-
@pianofire. Yeah no I did do the tutorials, but thanks anyways, I appreciate just the attempt.
-
@SteveZX81 Thanks! I don’t really do discords and stuff though. :)
-
Share your code, you should be able to do it with an array, something must be going wrong somewhere...
-
@OrangePeel I would assume that is necessary - particularly, because you might want to compare the values of different tiles (for example, you might not want to have a group of four items right next to each other)
And if you use an array, it should be managable (using for-loops) -
If u want use the same random(number) just put in the loop instead of making 100 variables out of it in the loop the number will be always changing i hope this helps :)
-
@CasualTie5 thanks. I’ll go do that now.
-
@landein207 I tried that, but because it was all the same variable in the end of the loop it ended up being the same still.
-
Post a screenshot of the bit that’s giving you trouble :)
-
This post is deleted! -
This post is deleted! -
@DomDom Okay, I'll try it.
-
@DomDom surely 6 or greater
-
This post is deleted! -
No thanks kept clear of sprites and the map. But I believe you.
-
This is indeed a bug in the current (live) implementation of multi-deminsional arrays. The 2nd dimension (presumably 3rd+ too) will inherit the size of the first. I remember raising this issue previously.
I just checked and it is already fixed in the upcoming 2.15.0 release. So in 2.15.0 the sample will work as you expect.
It's a bit dirty, but as a workaround for now use this:
int MAX_COL = 26 int MAX_ROW = 6 array level[MAX_COL][MAX_COL] for row = 0 to MAX_ROW loop for col = 0 to MAX_COL loop // or len(level[0]) will work too here level[row][col] = random(5) repeat repeat
This is of course wasteful because it defines a 26 x 26 array, but at least it works