gemrb / gemrb

GemRB is a portable open-source implementation of Bioware’s Infinity Engine.
https://gemrb.org
GNU General Public License v2.0
983 stars 184 forks source link

Are all actor overlays displayed properly for invisible enemies? #461

Closed lynxlynxlynx closed 4 years ago

lynxlynxlynx commented 4 years ago

Which overlays are hidden for invisible enemies? Current lore says bg1-style hardcoded ones (globe of invulnerability, protection from missiles, sanctuary), while bg2 ones aren't (turning). GemRB holds a list of all the hardcoded overlays in gemrb/unhardcoded/*/overlay.2da and the last column tells the engine whether the overlay should be hidden (1) or not if the enemy is invisible. Most of the values default to 0, but the correct values need to be found.

caillean7 commented 4 years ago

Is it a viable test to open up some weak enemy in NI, add a permanent invisibility effect to it, plus some other effect, start up IE, console in a copy of the creature and see if the spell effects are visible? I tried that with a handful of effects, and in BG2 none of them showed so far. Also, concerning overlay.2da, we're talking about the FLAGS column, which is currently empty, or the UNDER column?

lynxlynxlynx commented 4 years ago

It's the last column, yes (but it's not empty).

the testing plan sounds fine — the question is whether gemrb behaves the same as the original.

caillean7 commented 4 years ago

Uh, then the column heads are misaligned maybe.

Cool, then I'd make this my next job, unless you'd prefer me doing something else? If I gotta check all the games, then it might take a bit - don't have so much free time like last year anymore, but a week or two should be okay?

lynxlynxlynx commented 4 years ago

Looking at bg2 is enough and there's no rush at all. :)

caillean7 commented 4 years ago

Just in the process of testing the different overlays, and noticed the following: On the original, if I use the above described method, I create a skeleton that has an invisibility plus another effect added via NI. As soon as the skeleton attacks the party, invisibility wears out and the other overlay becomes visible. On GemRB, however, it doesn't. After the skeleton gets visible, it has the effect active when I check with Ctrl.+M, but the overlay is not drawn subsequently for some reason.

And also, BG2s overlay.2da contains some entries for VVCs not available in this game, so do you want it sorted out or don't you mind them being in there?

lynxlynxlynx commented 4 years ago

Other entries can stay.

How are you adding the effect? Not by an item, equipping effect, right?

caillean7 commented 4 years ago

No, not by item.

lynxlynxlynx commented 4 years ago

Which timing mode did you use?

caillean7 commented 4 years ago

Instant / Permanent.

lynxlynxlynx commented 4 years ago

Hmpf, everything looks fine with fx_cure_invisible_state and what it calls. And it has to work or they wouldn't appear, so it's like the actual effect removal line doesn't do it, but I can't see how that'd be possible (fxqueue.RemoveAllEffects). Can you try breaking on it and stepping through (instead of "next", use "step")? The loop in the next function should set the effect to expired.

caillean7 commented 4 years ago

In which file is this?

lynxlynxlynx commented 4 years ago

FXOpcodes.cpp, but it doesn't matter, just: b fx_cure_invisible_state

caillean7 commented 4 years ago

Uh, bear with me... in the console?

lynxlynxlynx commented 4 years ago

after you run gdb with gemrb (however you do it, from the build dir you can run ../admin/run.gdb someconfig.cfg). Then b above and r to run.

caillean7 commented 4 years ago

Ah, okay, sorry for being daft.

So what's supposed to happen when it hits that breaking point? Right now, nothing happens, the game just keeps running.

lynxlynxlynx commented 4 years ago

you're supposed to next until the RemoveAllEffects line then step there, which will take you to a different file. Just next there until exit and note if any effect got their timing changed — since it appears that it's somehow getting skipped. It's that one obvious line, did it get executed or not.

caillean7 commented 4 years ago

I'm not familiar with gdb, but I think my problem is that the breaking point doesn't work.

lynxlynxlynx commented 4 years ago

Hmm, tell me everything you type after gdb starts.

caillean7 commented 4 years ago
break fx_cure_invisible_state
r

That should stop execution when this function is called and give me the gdb prompt, right?

lynxlynxlynx commented 4 years ago

Actually no, since the plugin is loaded later — you probably get a warning about that breakpoint. Try r for gemrb to start up, then ctrl-c in the console to get back to gdb, and then the break and then c to continue.

caillean7 commented 4 years ago

No change, still doesn't 'break'.

lynxlynxlynx commented 4 years ago

It doesn't break when the skelly goes visible again?

caillean7 commented 4 years ago

Nope.

lynxlynxlynx commented 4 years ago

how about "b Actor::ResetState"?

caillean7 commented 4 years ago

Sorry, had to go...

No breaking with this, either. Did the running, Ctrl.+C, then b, then c. Said:

Function "Actor::ResetState" not defined.                                                   
Make breakpoint pending on future shared library load? (y or [n])

Tried with yes and no.

lynxlynxlynx commented 4 years ago

how about "b GemRB::Actor::ResetState"?

caillean7 commented 4 years ago

Some progress:

(gdb) next                                                                                  
Single stepping until exit from function _ZN5GemRB5Actor10ResetStateEv@plt,                 
which has no line number information.                                                       
0x00007ffff7a93470 in ?? ()                                                                 
   from /home/nadia/Software/Games/gemrb2020_1_20/build/gemrb/core/libgemrb_core.so.0.8.6-git                                                                                           
(gdb) n                                                                                     
Cannot find bounds of current function  
lynxlynxlynx commented 4 years ago

Ah, it looks like you don't have a debug build — you'd have to rerun cmake with -DCMAKE_BUILD_TYPE=Debug for all the symbols to get included and being able to use gdb for anything helpful.

caillean7 commented 4 years ago

KK, I'll do that tomorrow afternoon, repeat above steps and post any progress (hopefully!) then.

bradallred commented 4 years ago

FYI, you can do b File:Line so you don't have to remember all the namespacing.

Actor.cpp is part of the core, so breakpoints inside it shouldn't generate warnings anyway 🤷‍♂

lynxlynxlynx commented 4 years ago

Actually for me the namespacing isn't needed any more. Either gdb improved or the dwarf info from the compiler is better.

caillean7 commented 4 years ago

Tried with the debug build, but I'm still getting this "Cannot find bounds of current function" with it.

lynxlynxlynx commented 4 years ago

Eh, please just upload the modified CRE then.

caillean7 commented 4 years ago

Ah, sorry about that.

SKELET01.cre has currently Minor Globe Overlay and Invisibility active:

skelet01.zip

lynxlynxlynx commented 4 years ago

When I try it, once they attack they only have the overlay effect in their queue.

caillean7 commented 4 years ago

Here, too, same on the original. I thought that was due to the attack dispelling invisibility.

I checked all BG2 overlays now, and everyone I was able to test didn't show while invisibility was active, so I'd assume the same value for the others (additional ones mentioned above) and just set all the flags to 1. Also sampled some on IWD1 to see how it looks there: the same. So can we just assume 'Invisibility = no overlays drawn' for all games? Then I could go over the 2da's tomorrow.

lynxlynxlynx commented 4 years ago

Haha, what a misunderstanding! I thought you were saying the invisibility effect is still in the queue, but you meant the overlay one.

re flags: it's also true for spell turning? Interesting. Which weren't you able to test? Maybe I played it too many times in gemrb, but I thought some of the protections from the lich contingency remained visible, while they go invisible through mislead or projected image.

Since it appears then they're always hidden, it's better to rework 942c1a16 than to set the flags in the table. It could likely be just partially reverted, but let's first see if we need the flags col for anything else — like the sound issue still open.

caillean7 commented 4 years ago

Some that BG2 doesn't have at all, like e. g. Death Armor, Flame Shroud, Seven Eyes, and a few I couldn't find in NIs drop-down list, where you select the effects. E. g. Insect Plague or Globe of Invulnerability (might use the Minor Globe overlay instead?).

I'll start up the IE and pay a visit to some liches then.

caillean7 commented 4 years ago

Side note, before I forget: On IWD1 it looks as if the overlays are drawn just slightly too low compared to the original:

GemRB: overlay_gemrb

IE: overlay_ie

Probably not so noticeable for human or elves, but this armored skeleton is somewhat bigger. Just caught my eye with this one yesterday, so we might take a look at some other of the overlays too.

caillean7 commented 4 years ago

I thought some of the protections from the lich contingency remained visible, while they go invisible through mislead or projected image

Sorry about the delay, you're right here. Spell turning and spell deflection overlays are indeed drawn for the lich's mislead:

lich

I wanted to test them with my skeleton, too, but strangely they aren't drawn if I just add the effect with NI. Even when I removed the invisibility, it drew no overlay for both 200 and 201 opcodes.

lynxlynxlynx commented 4 years ago

So, they're drawn on the actual actor, not the mislead illusion, which is good.

Too bad our testing approach isn't bulletproof. Maybe just illusions are special, but can you try testing turning and deflection via a script? ForceSpell them and invisibility ...

caillean7 commented 4 years ago

Yep, I'll get to it on Monday.

caillean7 commented 4 years ago

Testing with a combat script showed that Spell Turning and Spell Deflection do show while Invisibility is active. I then tried with some other spells previously tested with the other method, and results were consistent with the previous ones. So looks like Spell Turning and Deflection are somewhat special, since they're drawn for invisible actors; so far everything else I tested was not.

Are there any other spells I could test while I'm at it, something not in overlay.2da maybe? Right now nothing comes to my mind...

lynxlynxlynx commented 4 years ago

Thanks, so then is this it? http://sprunge.us/c9o2Cu?diff

caillean7 commented 4 years ago

Yep, looks good.

lynxlynxlynx commented 4 years ago

Since most other games don't have anything like that, I'll just suppose they don't display anything and transpose the changes.

caillean7 commented 4 years ago

I could take a look at IWD1 - gotta test the overlays for #623 anyway, and I'll do it with a script, it's much quicker than adding effects to the creature. Could use the same like for this test, some spell plus invisibility.

lynxlynxlynx commented 4 years ago

Sure, better coverage is always good, but iwd doesn't have turning or deflection, so I don't expect deviations.

caillean7 commented 4 years ago

Checked out Invisibility along with the overlays for IWD1 now, and everything except for Insect Plague was invisible on the original. However, testing them on GemRB showed the opposite behavior - looks like HOWs overlay.2da is missing from https://github.com/gemrb/gemrb/commit/f9de9f23203c78838a675825f63afdeb68847a2c

Updated the 2da - https://github.com/gemrb/gemrb/compare/master...caillean7:master - but I still get to see supposed to be invisible overlays with it :frowning_woman:

lynxlynxlynx commented 4 years ago

Nice catch! Are you sure you didn't misplace a file into our override or something like that? Check the log to see where it found overlay.2da, just to rule that out.