Seeded runs?


If it doesn't fit anywhere else, it belongs here. Also, come here if you just need to get hammered.

Dungeon Dilettante

Posts: 2

Joined: Monday, 12th May 2014, 00:06

Post Monday, 12th May 2014, 00:07

Seeded runs?

Is there a file I can fiddle with or a mod that's been created that lets me and a friend run the same dungeon?

Ziggurat Zagger

Posts: 8786

Joined: Sunday, 5th May 2013, 08:25

Post Monday, 12th May 2014, 00:16

Re: Seeded runs?

Levels in Crawl are generated as-needed, not as soon as the game is begun (otherwise, how would Abyss and Pandemonium be infinite?) So I think unless you set the state of the RNG every time a level is generated, you won't be getting the same dungeon.

Dungeon Dilettante

Posts: 2

Joined: Monday, 12th May 2014, 00:06

Post Monday, 12th May 2014, 00:21

Re: Seeded runs?

duvessa wrote:Levels in Crawl are generated as-needed, not as soon as the game is begun (otherwise, how would Abyss and Pandemonium be infinite?) So I think unless you set the state of the RNG every time a level is generated, you won't be getting the same dungeon.


So is it possible?

Tartarus Sorceror

Posts: 1888

Joined: Saturday, 9th July 2011, 20:57

Post Monday, 12th May 2014, 00:36

Re: Seeded runs?

Leadpainter wrote:
duvessa wrote:Levels in Crawl are generated as-needed, not as soon as the game is begun (otherwise, how would Abyss and Pandemonium be infinite?) So I think unless you set the state of the RNG every time a level is generated, you won't be getting the same dungeon.


So is it possible?


It's not been done yet, so whether it's possible depends on how eager you are to make a lot of changes to Crawl's random number generation code.
User avatar

Pandemonium Purger

Posts: 1298

Joined: Wednesday, 11th April 2012, 02:42

Location: Sydney, Australia

Post Monday, 12th May 2014, 00:48

Re: Seeded runs?

Leadpainter wrote:
duvessa wrote:Levels in Crawl are generated as-needed, not as soon as the game is begun (otherwise, how would Abyss and Pandemonium be infinite?) So I think unless you set the state of the RNG every time a level is generated, you won't be getting the same dungeon.


So is it possible?

It would require modification of the source code. And I suspect the devs are not interested in doing it, because they want the RNG of the game to be harder to predict, not easier. (There used to be a problem in Nethack online servers where you could generate games locally with timestamps around the timestamp you suspect your new online game was made at, and if you find one that looks the same, you can explore the dungeon locally then play online with perfect foresight, aka cheating)

A good example of a roguelike with seeded dungeons is Brogue. You can pass it a seed and the entire dungeon is generated based on that seed the same for everyone. (There were even some bugs that made it not generate the same way that have since been fixed, so seeds working is a priority.)

Dungeon Master

Posts: 1613

Joined: Thursday, 16th December 2010, 21:54

Post Monday, 12th May 2014, 02:45

Re: Seeded runs?

Command line options:
-seed <num> init the rng to a given sequence (a hex number > 0)

The functionality has existed for a while (for debugging purposes mainly, and I don't think it actually worked properly until pretty recently). It's been used a bit for testing bots, but not for much other than that as far as I know.
User avatar

Pandemonium Purger

Posts: 1298

Joined: Wednesday, 11th April 2012, 02:42

Location: Sydney, Australia

Post Monday, 12th May 2014, 03:11

Re: Seeded runs?

MarvinPA wrote:
Command line options:
-seed <num> init the rng to a given sequence (a hex number > 0)

The functionality has existed for a while (for debugging purposes mainly, and I don't think it actually worked properly until pretty recently). It's been used a bit for testing bots, but not for much other than that as far as I know.

But is the RNG used for developing levels separate from the RNG used to produce in-game results separate from the RNG used for purely aesthetic/non-gameplay randomness? (Brogue does this, Crawl I suspect does not)

Ziggurat Zagger

Posts: 8786

Joined: Sunday, 5th May 2013, 08:25

Post Monday, 12th May 2014, 03:17

Re: Seeded runs?

No. The levels generated will diverge as soon as there is almost any different action between the two games. Even navigating the species/background selection changes the RNG state - you can start two HuCjs with the same seed and still get different D:1s.
User avatar

Dungeon Master

Posts: 762

Joined: Thursday, 25th April 2013, 02:43

Post Monday, 12th May 2014, 03:29

Re: Seeded runs?

Patashu wrote:
MarvinPA wrote:
Command line options:
-seed <num> init the rng to a given sequence (a hex number > 0)

The functionality has existed for a while (for debugging purposes mainly, and I don't think it actually worked properly until pretty recently). It's been used a bit for testing bots, but not for much other than that as far as I know.

But is the RNG used for developing levels separate from the RNG used to produce in-game results separate from the RNG used for purely aesthetic/non-gameplay randomness? (Brogue does this, Crawl I suspect does not)
The RNG used to do aesthetic stuff is separate from the gameplay one. (ui_random).

However, the normal gameplay one is not separate from the level generation one.

I actually tried this - I took a save file, copied it, went downstairs, restored and did it again. The resultant levels were different, I don't know why. From the rng conservation MarvinPA mentioned I would of expected the levels to be the same.
EDIT: from what duvessa said, there is a possibility I was was subtly changing the RNG state. Ideally I should have done this with an rc file which automatically moves downstairs without player involvement.

I think it would be pretty easy to hack in a global which swapped out the RNG seed when level generation started and stopped. Then it would be a matter for finding the few cases this isn't enough. (Acquirement, species specific troves, etc.) and this feature could become a reality.
On IRC my nick is reaverb. I play online under the name reaver, though.

Dungeon Master

Posts: 1613

Joined: Thursday, 16th December 2010, 21:54

Post Monday, 12th May 2014, 04:22

Re: Seeded runs?

Right, I should have been clearer in that for bot testing the bots would always give the exact same input (and some recent bugfixes were what made it actually work for that purpose, IIRC). Like it says in the initial commit implementing it, seeding doesn't pre-generate levels and I have no clue how easy or hard that'd be to make work.
User avatar

Pandemonium Purger

Posts: 1298

Joined: Wednesday, 11th April 2012, 02:42

Location: Sydney, Australia

Post Monday, 12th May 2014, 05:03

Re: Seeded runs?

MarvinPA wrote:Right, I should have been clearer in that for bot testing the bots would always give the exact same input (and some recent bugfixes were what made it actually work for that purpose, IIRC). Like it says in the initial commit implementing it, seeding doesn't pre-generate levels and I have no clue how easy or hard that'd be to make work.

You don't have to pre-generate levels to have deterministic dungeons from a seed, but you do have to store the seed you started the game with in the save file and bring that seed back every time you need it to generate a level.

Lair Larrikin

Posts: 18

Joined: Tuesday, 14th January 2014, 20:24

Post Tuesday, 13th May 2014, 14:47

Re: Seeded runs?

How about adding a random generator: one, seed-able for the generation of the dungeon and the existing one for everything else ?

Return to Crazy Yiuf's Corner

Who is online

Users browsing this forum: Google [Bot] and 21 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.