• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Best way for players to input dungeon seed?

hdarren

Member
Hi!

I am making a roguelike and I want players to be able to input their own seed. I've got all seed code working in terms of creating the dungeon but what I need to know is the best approach in terms of asking the player to input the seed and turn that into a seed number.

For example in Binding of Isaac players can input 8 letters.

I want to do a similar approach where players can input 5 letters. I was then thinking I would take each letter and convert it to a number (a=1, b=2, c=3). Then multiply all the letters together.

But I noticed when I use random_get_seed() the numbers are very high so I don't know what the best numbers to use are.

Any help please?
 

jo-thijs

Member
You don't multiply the numbers together, you do this:
(((((digit1) * 26 + digit2) * 26 + digit3) * 26 + digit4) * 26 + digit5) * 26
and a=0, b=1, c=2, ...
 

hdarren

Member
Will that work with 5 letters or am I better off using 8 letters like The Binding of Isaac? And I assume A=1 otherwise if it is 0 then there is a chance no number will be generated? Perhaps I should allow numbers as well to add greater variety?
 

jo-thijs

Member
What I wrote is for 5 letters and no, A=0.

You're setting a value for the seed, you're not determining how many random numbers are being generated.
This is something your code determins.

If you allow numbers as well, you have to multiply with 36 every time instead of with 26.
Also, in that case, A=10, B=11, ...
 
Top