00:45:27 Monster database of master branch on crawl.develz.org updated to: 0.33-a0-295-g4b1f6b956e 04:32:34 Experimental (bcrawl) branch on underhound.eu updated to: 0.23-a0-5249-g4a8afe7061 09:10:54 Hello.  I am trying to find seeds with certain demonspawn mutations.  Is this possible in Lua?  I do not see any Lua functions to restart the game.  If it cannot be done in Lua, what initialisations do I need to do, and which object files do I need to link, if I want to do it in C++? 09:52:25 Xenflare (L2 NaIE) Crash caused by signal #6: Aborted (D:2) 10:01:12 <05i​coson> Guest53 (if you're still there or read this in the logs): there's a script at crawl-ref/source/scripts/seed_explorer.lua in the repo (with most of the code located in crawl-ref/source/dat/dlua/explorer.lua that could probably be modified to do that. Right now it just searches dungeons and iirc doesn't place a player, though, so I can't promise the modifications are trivial (and it may need some extra support on the c++ side) 10:02:31 Thank you!  I will have a look. 10:03:24 <05i​coson> I think placing a player with at least a species should be possible in one of those scripts. You could also in principle do this in an rc file that taps into those scripts in wizmode, I think (some of the stress tests are implemented that way) 10:04:32 <05i​coson> I think you could pull the ds mutations just by force leveling the player and then getting them via the normal mutation api? it might end up being easier to write c++ code to do introspection on them 10:04:47 <05i​coson> then need to carefully reset the player, seeds, etc 10:06:49 <05i​coson> one thing I'm not immediately sure if is whether the code that resets the dungeon state also resets player state that is seed-dependent properly 10:08:14 Yes, leveling up and checking the mutations was how I had planned to do it in lua, if possible.  The main obstacle to doing it in C++ for me is figuring out what initialisations to do and what the dependencies are.  I find it difficult to quickly get a grip on what exactly needs to be done, because there is a lot of global state. 10:09:01 <05i​coson> there's code I wrote for the seed explorer that resets everything needed for the dungeon 10:12:25 <05i​coson> partly https://github.com/crawl/crawl/blob/master/crawl-ref/source/l-debug.cc#L94 10:13:20 <05i​coson> yeah, doesn't do the player 10:14:57 <05i​coson> I expect somewhere in dlua there's an interface to _reset_game though, which may be useful for this 10:15:31 <05i​coson> hm maybe not 10:17:09 <05i​coson> well, one last thought: given how ds mutations are generated, I could be possible to short circuit a lot of this, since they don't depend very much on state beyond the seed 10:17:19 <05i​coson> would need c++ code 10:18:01 <05i​coson> but I think that would be what I would be tempted to do 10:18:31 <05i​coson> also, lol that ds mutation code still has gotos 10:19:53 <05i​coson> I think it just needs a clear slate of mutations, ds species, and the seed 10:22:53 I thought that in C++ it would be easiest to use `setup_game`.  There are probably some rng calls before the mutations are rolled?  It would be more efficient to isolate the rng manipulations and the mutation rolls, but using a more high-level function seems more robust.  And it's probably performant enough. 10:23:16 On the other hand it probably requires more initialisation. 14:06:30 <05i​coson> for testing, lua debug.reset_rng or equivalent c++ code should do what would be needed 14:06:46 <05i​coson> to isolate the rng, that is 14:08:02 <05i​coson> I actually think there shouldn't be any relevant rng calls before that, though I could be wrong about that 14:08:33 I have not really looked into it; I just assumed that it would not be the very first call. 14:09:02 <05i​coson> it's very very early, but there is stuff that happens before 14:09:55 I am currently leaning towards writing a script like `test/stress/abyss_short_run.rc`, that seems easier than to figure out how to initialise and reset all the state. 14:10:05 <05i​coson> yeah quite possibly 14:10:54 <05i​coson> hm ok initialize_item_sets does happen before ds is rolled and it does look to me like ds mutations aren't as isolated from prior rng as I'd like 14:11:15 <05i​coson> so doing all player setup as written may be safer than trying to mimic it 14:11:33 Can I restart the game from lua with a new seed, or do I have to restart crawl itself? 14:12:50 <05i​coson> from a lua script yes, I'm not 100% sure for an rc script 14:13:37 <05i​coson> you might be able to call lua stuff from one of those scripts to accomplish it 14:13:47 Ah, so lua scripts are more powerful than the latter, although they can embed lua? 14:14:21 <05i​coson> no, it's just that rc scripts are more tailored towards running a single game 14:14:52 <05i​coson> you can call rc from one in wizmode (e.g. fireworks.rc calls some lua code in dlua) so it in principle has access to all that stuff, but I don't know if anyone has ever tested doing that kind of manipulation 14:15:24 <05i​coson> er, *you can call lua 14:15:55 Which approach would you recommend?  Write a lua script that is passed with -script? 14:16:23 <05i​coson> rc scripts are in a way more powerful because they have access to the player's interface if you need it, and also don't need to mimic anything about game setup etc 14:17:15 <05i​coson> I think either is viable, I'd probably do the lua script option still but I'm very familiar with them; tbh this looks a little harder than I initially thought and I don't know how that would be as a first project 14:17:17 What I would like to do is to start a new game as demonspawn, with a specified seed that I iterate through, level up in wizmode, then check the mutations. 14:17:47 <05i​coson> yeah, I think that is doable and pretty concrete, maybe my rec is to start with that in rc form and iterate from there 14:18:04 <05i​coson> oh, I guess the one thing about scripts is that it's easier to have a command line interface to them 14:18:56 <05i​coson> so one starting point would be to write a script that does that at cli once, and then figure out how to do the repeating part 14:19:18 <05i​coson> it would definitely be a nice addition to the seed explorer script if you can get this to work 14:21:22 <05i​coson> hm, one further idea (and then I'm probably out): if you can get the change species code (which is wizmode / dlua) right after a reset_rng call to have the same results as starting a new character at that seed, this would make the lua scripting a lot easier 14:21:57 <05i​coson> I am not sure if it would do that right now 14:22:16 <05i​coson> then you wouldn't have to restart everything; this is more or less what some of the mutation test code does 14:23:56 It would probably be a lot faster, though I suspect that even restarting the game would be kind of fast enough for my purposes.  It would be really nice if the C++ were structured without all that global state, so that I could just instantiate some game object, or subobject therof, with the species and seed, and then read off the mutation 14:23:57 schedule. 14:43:04 Can I tell crawl to run in headless mode?  Right now, running it with --rc starts up the gui and also requires me to "press any key to continue". 14:43:15 Otherwise this approach looks very promising, though. 14:44:47 I think the tests use a `testpty` utility (under util/) 14:45:02 the closest it gets to headless mode is webtiles 14:46:03 sorry, that's fake_pty 14:46:29 crawl source really needs an overhaul, but nobody has the time to do it… 15:41:34 <09g​ammafunk> didn't advil add a headless mode of some kind? 16:16:47 <09g​ammafunk> Guest53: Check out crawl -headless for running crawl without a pty 16:17:41 <09g​ammafunk> And crawl -help in general for other useful commandline options, some of which are really only documented in that help output 16:17:43 That does not actually work, unfortunately.  Not sure if it is only conditionally supported or if it needs to be combined with other options. 16:18:43 It should be supported if compiled for tiles; I am using the flatpak (tiles) version, but somehow that option gives an error. 16:30:20 Ah, --rc is explicitly disallowed for headless, "// TODO: still too crashy in local tiles to enable" 16:35:31 Ok, I installed a tty version of crawl and it works. 16:36:38 The startup is slower than I expected though.  Going through 1000 seeds takes over a minute. 17:31:48 -!- werekitten is now known as misha