Repository navigation
Store cell memory on discovery, so cells discovered unseen aren't a "chilly void" - #871
MildlyMeticulous wants to merge 16 commits into
Conversation
Collection of small fixes for recent issues (part 2)
…ewett#798) Previously, automatically eating food when starving would not only eat the food without using a turn, it would give the player a free turn afterwards. In addition, becoming hungry/weak/etc no longer consumes an extra turn of food. This simplifies the code and should have minimal effect on gameplay.
|
I'm not opposed to centralizing the In any case, the existing callsites in Time.c and Movement.c should be removed in conjunction with this change. Otherwise, I think they'll be doing redundant writes. |
|
You're right, and thank you for pushing on it. I did not reproduce this in a live game. I found it by reading, and my rationale in the PR description is wrong. Telepathy and clairvoyance are fine on master. What I think is still real is narrower: cells that become Three paths reach
On removing the existing callsites: I don't think they are redundant, and I'd rather not touch them. They fire when a cell stops being visible, which captures whatever the terrain looks like at that moment. A cell you watched change while it was in view, a door that opened, something that burned or flooded, needs that later write to update its memory. If discovery were the only write, memory would freeze at first sight. What my change adds is only the initial write for cells that would otherwise never get one, so for a normally seen cell it is one extra write at discovery rather than a replacement. If that reading is still off, or the three cases above aren't worth the extra write on every discovery, I'm happy to narrow this to just |
|
Do either of you know of any cases where I wouldn't worry too much about redundant writes; If we choose this PR instead of the other one: the PR/commit title and the comment in the code will need to be updated to reflect that this applies to stairs/alarm traps/etc instead of telepathy/clairvoyance, and it should probably have a changes file. |
b359f7a to
e0f0258
Compare
I went looking for one and could not find any that causes harm. Working through what it writes: pmap[x][y].rememberedTerrainFlags = terrainFlags((pos){ x, y });
pmap[x][y].rememberedTMFlags = terrainMechFlags((pos){ x, y });
pmap[x][y].rememberedCellFlags = pmap[x][y].flags;
pmap[x][y].rememberedTerrain = pmap[x][y].layers[highestPriorityLayer(x, y, false)];The one worth a second look is Two things make me think that is acceptable rather than a problem:
The only readers of the remembered flag word are There is also a small argument the other way, which surprised me. pmap[i][j].rememberedTerrainFlags = (T_OBSTRUCTS_EVERYTHING);so a cell that is On the two PRs, the difference in coverage is one case. #870 patches I have pushed the changes you asked for:
The branch is still named |
A cell stores its memory in storeMemories() when it stops being visible. A cell that becomes DISCOVERED without ever having been visible reaches no such transition, so it keeps rememberedTerrain as NOTHING, which describes as "a chilly void". Three call sites discover a cell that way: bumping into an obstruction in the dark (Movement.c), the cells around the up-stairs on arrival (RogueMain.c), and an alarm trap sprung out of sight (Items.c). Calling storeMemories() from discoverCell() covers all of them at once, including any future caller, rather than patching each site.
e0f0258 to
c32ec4f
Compare
|
Thanks! I don't think the branch name is a big deal. Tiles no longer always being considered obstructions probably isn't an issue, or at least it wasn't in the (limited) testing I did. After testing this with a chasm+stairs, I feel it's a little odd that tiles are described with text like "You remember seeing the ground here" when the player hasn't technically seen that tile. I wonder if it would sound more natural if in these cases, such tiles were marked as magic mapped instead of discovered, so it would be printed as "You expect the ground to be here"? If this would be difficult to implement, or would cause other issues, don't worry about it; it's already much better than the "chilly void" text. |
|
Thanks for testing it, especially the chasm and stairs case. I looked into the magic-mapped idea and I think it pulls against the centralising, so I'd lean towards leaving it, but here is what I found so you can decide. The wording comes from if (pmap[x][y].flags & DISCOVERED) { // "you remember seeing %s here."
...
} else if (pmap[x][y].flags & MAGIC_MAPPED) { // "you expect %s to be here."
That is the part that causes trouble. So the distinction has to be made by the caller, since only the caller knows whether the player actually laid eyes on the cell. Which puts us back at enumerating each site, the thing #870 does and the reason you were leaning this way instead. Two ways forward that keep the centralised fix:
My preference is 1 for this PR and 2 later if it still bothers anyone, but I am happy to attempt 2 here if you would rather it landed in one go. |
|
Thanks for looking into the magic mapping idea. I agree with your conclusion: let's keep this PR as it is rather than trying the magic mapping version. After thinking about it a bit more, I'm not sure if the magic mapping idea is worth pursuing, since there's so many other issues that seem higher priority than a small wording improvement (though you can work on it if you want, of course). For this PR we should still test the other 2 cases: the alarm trap, and walking into a wall you can't see. |
|
Agreed on leaving the magic mapping alone. It was a wording nicety and you clearly have higher priorities in the queue. That leaves the alarm trap and the unseen wall bump to test. I'd rather set those up properly than poke at them and report something half-checked, so let me come back to it. The trap case needs one triggered while it's off screen, and the bump case needs an unlit dead end, so both want a seeded run rather than a quick look. I'll post what I actually see, including if either of them turns out not to behave the way I described. Thanks for the testing you've already put into this one. |
|
@MildlyMeticulous I'd personally appreciate it if you avoid copy-pasting Claude output in these comment chains. I'm not criticizing your usage (I recognize it because I use it myself), but it's exceedingly verbose and I'd rather hear your direct takes. As for the other callsites, I agree with your assessment that they are not redundant. I support this PR over #870, and I have a setup for testing the alarm trap case. I'll report back once I have a chance to check it against this branch. |
|
Tested it out on both alarms and stairs and it looks good to me 👍 |
|
Hectocotylus has covered alarms and stairs. I said I'd test the wall bump myself and I haven't — no working build on this machine, so I'd rather say so than leave it hanging. Both cases go through the single |
|
Thanks, as you all discussed, let's go with this PR. Please could you rebase onto 'release'? And please could you disclose AI usage in the description or commit message, such as in a co-authored-by tag? |
|
@MildlyMeticulous - please rebase to drop the unrelated commits. Thanks! Confirmed that bumping into unseen walls is not described as chilly void. |
|
Looks abandoned, marking it for attention. |
Fixes the "a chilly void" case from #200 for cells that are discovered without ever being visible.
Correction to the original description of this PR: I first wrote that telepathy and clairvoyance were affected. That was wrong.
updateFieldOfViewDisplay()already callsstoreMemorieswhen a cell ceases to be clairvoyantly or telepathically visible, so both systems work correctly on master. See the discussion below.The remaining case
rememberedTerrainstarts asNOTHING(Architect.c:2770), andNOTHINGrenders and describes as"a chilly void"(Globals.c:321). The only routine that normally writes it isstoreMemories(Movement.c:2233), which runs on the transitions where a cell stops being visible.A cell that becomes
DISCOVEREDwhile never having been visible in any sense reaches none of those transitions, so it keepsNOTHING.Three call sites do that:
Movement.c:1237RogueMain.c:881connectingStairsDiscoveredis set on arrivalItems.c:3397!playerCanSee(x, y)The change
One
storeMemories(x, y)call inside the!DISCOVEREDguard indiscoverCell(), so a cell gets its memory written the moment it is discovered.This adds to rather than replaces the existing calls. Those fire when a cell leaves view and capture the terrain as it stands at that moment, which is what keeps memory current for a cell that changed while you were watching it. For a normally seen cell this change means one extra write at discovery.
Not verified in a live game
I found this by reading the code, not by playing. The mechanism above is traceable statically, but I have not sat down and bumped into a wall in the dark to confirm the message. Worth someone doing before this lands.