-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bog monster generated inside a statue #15
Comments
I think the issue arises from Architect.c:796, in the function spawnHorde, which makes the call randomMatchingLocation(&(loc[0]), &(loc[1]), FLOOR, NOTHING, (hordeCatalog[hordeID].spawnsIn ? hordeCatalog[hordeID].spawnsIn : -1) This function is defined at Architect.c:3732: // fills (*x, *y) with the coordinates of a random cell with
// no creatures, items or stairs and with either a matching liquid and dungeon type
// or at least one layer of type terrainType.
// A dungeon, liquid type of -1 will match anything.
boolean randomMatchingLocation(short *x, short *y, short dungeonType, short liquidType, short terrainType) { Because the bog monster horde definition has a spawnsIn entry of MUD, randomMatchingLocation only looks for a cell with MUD on one of its layers; it disregards the condition that dungeon layer should be FLOOR, which would be used if spawnsIn were 0. This means the marble statue is a matching location as it has MUD on the liquid layer, despite it having STATUE_INERT on the dungeon layer. Adding an extra condition that monsters cannot spawn on obstructing tiles wouldn't work, as turrets are specified to spawn in WALL, dormant monster spawn in STATUE_DORMANT, etc. |
Your theory looks right to me. Additionally all uses of
..which means we're free to change the meaning of a non-
Another part of the solution seems to include either making the In the second, we could ask ourselves how important it is to us for |
As a concrete realization of those ideas, it is tempting to change Then of course bog monster would request To act on these flags |
There might be a simpler way. I'm looking at the Then, the That idea rests on the To help with that check, here are the
|
I scanned all floors of the first 300 seeds and counted which layers the above tile types appear in. For speed I omitted The others all had hits in the chosen seeds, and each seems to be restricted to exactly one of
|
..with this patch
we can run the repro seed catalog to see a match:
However, if we then run the first 1000 seeds, we get no hits :sad:. This is therefore pretty rare. I will scan the first 20k soon. |
I thought I could do 150K overnight, but it's only to 93K. Within those, I see 56 hits, for a ~0.06% repro rate:
Will inspect these for validity shortly. |
Alright, I think #254 will fix this. Try running your brute force tests on top of it. Sorry for mixing posts in between threads, but I just wanted to say that my previous testing was with the normal statue autogenerator, which comes before the swamp and prevents mud from spawning within the statue. There's an autogenerator after it ("remnant area," carpet with statues) that comes after the swamp, which is how this bug actually happened and why I couldn't recreate it. Tested it with the remnant, with and without the changed monster generation, it seems to work: https://imgur.com/a/FMHMYSP In the upper left there's some burned carpet next to the bog, and bog monsters that have all dodged the statues |
No worries. When your branch is in a good state, I'll run the brute check again too against it. It seems 100K seeds is enough to get a trust-worthy signal. |
The catalog for the first 14 depths of 150K seeds rendered in 14 hours 45 min on one of these 1.8 GHz laptop cores (the process is single-threaded right now.) There were 82 hits, for a final repro rate of 0.055%
I'd attach the file, but after gzip compression it's still 54 MiB 🤷 |
Seed 739002545, depth 11. The bog monster is fully visible and shows on the sidebar as hunting.
Any monster that spawns in a statue should be dormant and activated when the player is near. I'm fairly sure it's impossible for a creature to coincidentally be generated inside an inert statue, but this needs to be checked. Perhaps this is an edge case of a creature statue being generated in a bog.
The text was updated successfully, but these errors were encountered: