tapahob/BG2RadarOverlay

Missing immunities?

Closed this issue ยท 45 comments

This is absolutely fantastic. Very cool and nice looking! Going to try it out tomorrow.

One quick question, how come the golem does not show immunities like charm? They are immune to that, if I'm not mistaken. Or maybe the demo is outdated and I haven't seen the whole thing?

Yes the demo is a little dated and I got that fixed.

The issue is - the patch 2.6 made the game 64bit so all the memory addresses are invalid now.

I'll make a fresh 2.5 install and give it a try, then. Let me say that again, this is awesome.

I'll make a fresh 2.5 install and give it a try, then. Let me say that again, this is awesome.

In that case, there might be some immunities missing which are coming from the gear - some of the immunities are managed by invisible rings e.g. Lich immunities.

Oh, those are not displayed? Pity! I guess item-based immunities are out of the scope of this project?

Also, this is exclusively for BG2EE and not BGEE, right?

Yes the project is far from completion and I stopped working on that after 2.6
I wanted to have all the immunities and magical defenses in real-time.

If the EeEx docs were to be updated for x64 I'd continue the project.

I did not test it with BG1 but honestly, you don't need such tool for BG1

Hey, so your project was mentioned in the gibberlings3 discord and apparently EEEx does support 2.6, it's the documentation that's outdated (done by different people). But very likely the structures with the memory offsets and such are present in the source code itself.

Hey, so your project was mentioned in the gibberlings3 discord and apparently EEEx does support 2.6, it's the documentation that's outdated (done by different people). But very likely the structures with the memory offsets and such are present in the source code itself.

Yep, I don't use EEEx itself, only its documentation as a reference.
I tried to have a look into its sources but it looks too complicated for me.

new_offsets (1).txt

unsure if this helps you? these are the 2.6 data structures with the field offsets

new_offsets (1).txt

unsure if this helps you? these are the 2.6 data structures with the field offsets

Wow, yes that sure will be of help, whered you get those?
Are there memory patterns for these classes by any chance?

suy commented

To make a long story short, we talked about the issue with Bubb on the G3 Discord.

Note that both the 2.5 and 2.6 versions have available PDB files. Beamdog was very kind of providing them again after we requested them.

Bubb is the one who is more active in reverse engineering and understanding the decompilation of the engine, and the developer of EEex. I've done some toys with Frida scripts which work on both Windows and Linux (I use the latter). My understanding of the internals and my ability to understand reversed assembly/decompilation is very limited, but I got very very interested in how your program works, so I'd be willing to give it a shot in hooking into the game with Frida and writing something that works cross platform, if I find the time. :)

To make a long story short, we talked about the issue with Bubb on the G3 Discord.

Note that both the 2.5 and 2.6 versions have available PDB files. Beamdog was very kind of providing them again after we requested them.

Bubb is the one who is more active in reverse engineering and understanding the decompilation of the engine, and the developer of EEex. I've done some toys with Frida scripts which work on both Windows and Linux (I use the latter). My understanding of the internals and my ability to understand reversed assembly/decompilation is very limited, but I got very very interested in how your program works, so I'd be willing to give it a shot in hooking into the game with Frida and writing something that works cross platform, if I find the time. :)

Oh I did not know that! What I did was just tinkering with Cheat Engine and the docs I found in google for the file formats.
Personally, its my first memory hacking project, I was inspired by CS cheat makers' videos :)

Honestly, I feel it would be best if someone could integrate this tool with EE Ex lua binding

So I'm trying to get it working but something's not right.

  • Got BG2 2.5.16.6, fresh install.
  • Downloaded the BG2RadarOverlay release with BGOverlayUI.exe and extracted to the game folder.
  • Start BG2, then swapped windows, started the .exe. Then back to BG2.
  • Load a saved game. Mimicking your youtube video, so in Irenicus Dungeon right next to the golem.
  • Can't really see the list on the top left. Right-clicking the golem just issues the creature's sound.

I did install .NET core 3.1, so in the shell dotnet --version returns 3.1.419.

The config.cfg file (this was auto-generated) seems to point to the right location:

GameFolder=C:\nirvana\Baldur's Gate II Enhanced Edition
Locale=en_US

Any idea where I might be going wrong?

So I'm trying to get it working but something's not right.

  • Got BG2 2.5.16.6, fresh install.
  • Downloaded the BG2RadarOverlay release with BGOverlayUI.exe and extracted to the game folder.
  • Start BG2, then swapped windows, started the .exe. Then back to BG2.
  • Load a saved game. Mimicking your youtube video, so in Irenicus Dungeon right next to the golem.
  • Can't really see the list on the top left. Right-clicking the golem just issues the creature's sound.

I did install .NET core 3.1, so in the shell dotnet --version returns 3.1.419.

The config.cfg file (this was auto-generated) seems to point to the right location:

GameFolder=C:\nirvana\Baldur's Gate II Enhanced Edition
Locale=en_US

Any idea where I might be going wrong?

Hard to say without any kind of a message or logs but .. make sure you are using window mode.

I've checked it for myself and it does not seem to be able find anyone. Need to check the addresses

Nah, no luck. Tried several things, windowed mode, starting BG2RadarOverlay before loading, after loading, changed the game path to BG2EE and updated config.cfg in case that caused issues, also moving away from the golem so it disappears in the fog of war, then move back to it...

The only difference I can see is in your demo the executable is inside the folder netcoreapp3.1 and it's called WPFFrontend.exe while mine is in the game folder (next to Baldur.exe) and it's called BGOverlayUI.exe.

I can see a tiny, tiny window when in windowed mode that contains an orange dot (?) but it never does anything. I can drag it around though.

Anyway, was worth a shot!

Nah, no luck. Tried several things, windowed mode, starting BG2RadarOverlay before loading, after loading, changed the game path to BG2EE and updated config.cfg in case that caused issues, also moving away from the golem so it disappears in the fog of war, then move back to it...

The only difference I can see is in your demo the executable is inside the folder netcoreapp3.1 and it's called WPFFrontend.exe while mine is in the game folder (next to Baldur.exe) and it's called BGOverlayUI.exe.

I can see a tiny, tiny window when in windowed mode that contains an orange dot (?) but it never does anything. I can drag it around though.

Anyway, was worth a shot!

I'll notify you once I get that fixed

suy commented

Recently on the EEEx thread someone reported the launcher being blocked by the antivirus. From the experience of Project Infinity, this is a very common problem, as Windows Defender and some other AV software just blocks the whole thing from starting, silently.

@gatperdut could you please check the new release?

@suy I do use a mouse hooker here which is a system level hook so the antivirus has all the rights to blame it

I just tried it quickly with the same results. However, from the commits, it'd look like it's an identical release to the previous one?

Maybe missed pushing something?

I just tried it quickly with the same results. However, from the commits, it'd look like it's an identical release to the previous one?

Nope its the new binary, I just did not push the changes.
Looks like I do not understand something about the memory allocations.

Like, the previous release was working for me back then, but now the addresses seem to be very different even though I use the same game version and I have static pointer as an origin.

Wonder if I actually have to do the full process memory scan for it. Sounds wrong

@gatperdut Quick question, do you use a proper new character or a predefined one?
There is a bug currently with a predefined character

@gatperdut Quick question, do you use a proper new character or a predefined one? There is a bug currently with a predefined character

Hah, that was it. Amazing! I used a newly created character and started seeing stuff ๐Ÿ˜ Definitely not while on fullscreen, I was wondering why mouse-scrolling wasn't working ๐Ÿ˜…

The list on the top left displayed a few strange things (like Branwen), but I don't think I would be using it too much since it's enough to right-click on the character that I want to know more about.

I teleported to the Crooked Crane for a quick test with the Lich there but couldn't see any immunities (except against +X weapons and up to 5th spell level), I wonder why the ones from the items aren't displayed anywhere (charm, confusion, etc). I also noticed that the Lich's elemental resistances were all 0 (though Ctrl+Q shows it's 127 against fire, for example).

Super excited about the possibilities of this.

Oh thats nice to hear!

I disabled the list filtering for this build for you to be more likely to see at least anything :)
Could you share the save with the Lich you are talking about?

Yep, here it is, just before going through the door at the back of the inn. You can also get there with the cheat console, it's area
AR0021.

I can't always get the overlay working though, but it was fine a couple of times. I think it had trouble when loading a game.
000000001-Quick-Save-3.zip

@gatperdut got it fixed in the new release

As for individual spell immunities - its not yet implemented

Awesome, I'm going to check it out tomorrow morning!

It's definitely more reliable! I was able to reload a game several times and it kept working fine ๐Ÿ‘

Here's some feedback:

  • I think the top-left list gets a little in the way, personally I find the individual targeting to be enough. Another ease-of-use thing I can think of is to display the info only while hovering an enemy and pressing a key, Ctrl for example, and hide it as soon as the key is released or the mouse moves away. This would also avoid the "swapping" to a different application that occurs when you click on the overlay (which makes the music from the game stop).
  • Resistance to magical fire and to magical cold is, to the best of my knowledge, never used in the game. Probably could be removed from the information card?
  • I couldn't quite get more info on any Lich immunities; it'll display immunity against up to level 5 spells and needing +X weapons to be hurt, but nothing else like state immunities from its equipped ring. Same for the golems, I have never seen the immunities your screenshot shows like Protection from Poison, paralyze, etc.
  • Many enemies show a small amount of cold resistance (7, 13, something like that) which doesn't show up when I Ctrl+Q them.
  • Do you think the overlay could be used in fullscreen somehow? In the meantime I learned you can also navigate the map with the mouse middle button!
  • Some creatures don't show in the list or react to being right-clicked. For example, the goblins behind Aataqah in the corridor to the north. This is mostly minor, though.

I want to try this next with SCS, which gives enemies weapon proeficiencies - so I think I should be able to see them on characters other than PCs. Like, they show for Imoen (Shortsword +, e.g.) but not for anyone else, but I think this is just how the vanilla game was made.

I also want to give this a try together with EEEx, for the spell buff effects list it has integrated (shift + hover over an enemy displays stuff like Minor Globe of Invulnerability, Spell Turning, etc. which is very useful). Though I am not so sure about it, since EEEx needs a different executable to be run to start the game, but maybe the process name is the same?
Edit: They didn't work together.

  • As for fullscreen, if you are to check my demo video - it was run in borderless fullscreen and it looks okay imho. Guess I can add an option to force the game window into borderless fullscreen.
  • For scrolling, I used to scroll with mouse dragging. I think I'll do the minimize button for the list.
  • Magic Fire / Cold are never used, right, I left those just to have an even distribution between columns :)
  • Regarding Spell Immunities, I need some help there
  • Regarding Spell Immunities, I need some help there

Oh I see. I'm a little lost on the exact words. Spell immunities are against specific spells, e.g. immunity against spell levels 1-5, or against "Pierce Shield" specifically? And status effect immunities are against stuff like charm, paralyze, blindness, stun, etc? Did I get that right?

In any case the guys at G3 will know a lot for sure. Thanks a lot!

  • Regarding Spell Immunities, I need some help there

Oh I see. I'm a little lost on the exact words. Spell immunities are against specific spells, e.g. immunity against spell levels 1-5, or against "Pierce Shield" specifically? And status effect immunities are against stuff like charm, paralyze, blindness, stun, etc? Did I get that right?

In any case the guys at G3 will know a lot for sure. Thanks a lot!

There are multiple kinds of immunities, if you are to open CDerivedStats you'll see CImmunitiesSpellList, CImmunitiesEffect etc, and I don't have the docs of how its stored there

@gatperdut could you please check the new release?
Its better to remove the existing config file beforehand.

I've changed the memory scan algorithm - if it would work - it should be much more efficient.
Added a Borderless fullscreen option (its On by default)

Oh and Radar Radius is also configurable now (via config file)

Nice! It didn't show anything in my first try (even though I had removed config.cfg beforehand) but, after closing the overlay and opening it again, it was back there. Something odd was that, now, the Golem in the starting dungeon wasn't recognized. I used the previous release to double-check and, oddly enough, it wasn't recognized there either. Weird!

I am not sure what the Borderless option is doing but I'm running the game in maximized windowed mode anyway while running your overlay, so can't provide much feedback on that, unfortunately.

I did a bit more of testing with the Lich from the Crooked Crane. In the screenshot you can see some discrepancies I found with the elemental resistances to illustrate better what I meant before. Maybe the overlay is reading from the wrong positions? Like I mentioned, the "Cold resistance" value is off in nearly every character I examined. In the case of this Lich, the "Magic fire resistance" is off as well (though it's not very relevant), and "Poison resistance" is missing. Might be worth a look?
lich_elemental_discrepancy

If you look at this forum thread page 37 and search for my post there (username gatperdut, can't link to the post directly), you'll find the answer to it from Bubb/Eeks, the author of EEEx, a few posts down. Apparently he was stuck with the interface for showing all the information with a nice interface. I think yours looks great! He seemed to have a pretty good idea on how to deal with the item-based immunities which you mentioned having trouble with.

Have you seen EEEx's Spell Effect module? It's running "inside" the game (don't know the right word, but if you have used it you'll know what I mean). Merging your overlay information card with what he has would basically mean complete information on any character is available on realtime.

@gatperdut We took very different approaches to the problem.
He made an EEEx injector library which intercepts the game engines internal Lua calls so he can manipulate the engine from the inside.
What I do is basically dumpster diving into the process memory poking it like a blind kitten hoping for the best.
So I can't interact with EEEx in any way. I just use its documentation to find out which exact data structure I stumble upon

Got the effect resistances to work @gatperdut
Its kinda funny seeing Imoen's immunities with the belt :))

screen

Got the effect resistances to work @gatperdut

jonah-hill-yay

I'm going to check this out when you release it.

I'm trying my hand at replicating EEEx's spell effect menu, with a different key binding, and something simple for the moment... resistance to a single status effect, like stun. I'm wondering if it does the calculation for me of which status effects apply, so I wouldn't need to manually traverse the equipped items to check for it.

@gatperdut here it is - new release

@gatperdut here it is - new release

Hmm... I'm starting it like before, and I see a green-ish thing on the top left. When I click it though the mouse becomes a bit unresponsive and then the overlay process crashes, I believe. It disappears from the running processes for sure.

@gatperdut here it is - new release

Hmm... I'm starting it like before, and I see a green-ish thing on the top left. When I click it though the mouse becomes a bit unresponsive and then the overlay process crashes, I believe. It disappears from the running processes for sure.

Is it with SCS installed?

Is it with SCS installed?

It's me being a dummy :) I downloaded the 2.6 for some tests and forgot to replace it with 2.5 before using your overlay. Will get back to you.

Is SCS needed?

Is it with SCS installed?

It's me being a dummy :) I downloaded the 2.6 for some tests and forgot to replace it with 2.5 before using your overlay. Will get back to you.

Is SCS needed?

No but it would be nice to know how it behaves with SCS.
e.g. with spell protections - if you are to check my old screenshot it shows spell protections for lesser clay golem (pierce magic\lower resist) and now I don't see those. But now I am without SCS and backthen it was with SCS.

How smooth are the animations for you?

Ok, this is amazing. Reloaded and tried to break it a few times but couldn't. Here's some feedback:

  • With the animations you mean the sliding up and down when opening the top-left list? They were very smooth.

  • I'm installing SCS while I type to do some more testing. It'll be interesting to see Weapon Proficiencies in enemies, since, I think, SCS assigns those to characters based on the weapons they are carrying. This should also fix those THAC0 values of 18 for 8th level Fighters that the vanilla game has in some places (:

  • Speaking of Weapon Proficiencies, maybe it'd look a bit nicer if they were all in one line? They seem to take a lot of room. Something like WPs: Longsword 1, Dual-Wielding 2.

  • Weird, I do see the entries for Pierce Magic, Lower Resistance, etc. for the Lesser Clay Golem. But those are immunities to specific spells, no? Spell protections are things like Spell Turning, Minor Globe of Invulnerability, etc. In my opinion showing that would be the next big step.

  • An idea for that: only display the card when hovering over a character and holding a key (Shift?). Then, when hovering away or releasing the key, the card closes itself, so no need for the X button on the top right or switching apps. It would be less intrusive. In fact, since there can be quite a few Spell Protections going on for powerful spellcasters, there could be two keys:

    • Shift + Hover: show the current card.
    • Control + Hover: show the spell protections card. Showing the duration in rounds until the effect wears off as well would be the icing on the cake.
  • Bundled together with the Elemental Resistances (Fire, Cold, etc.) it'd be nice to show the Poison Resistance too. Imoen in particular is a prime easy candidate for testing this, since her belt provides 100%. I recruited Jaheira and leveled her up to the point where she became immune to the Poison Status Effect (which is different to Poison Resistance, as far as I know) thanks to her Druid levels, and it indeed appears in the immunities list, so that's awesome (see screenshot below). Also, I still think Magical Fire and Magical Cold should go away :P

jaheira_poison

  • Speaking of Jaheira, her level seems off. She was at max level but the card shows Lvl. 6 on the top left. The card was opened after the level up.

Last release of the week - ding @gatperdut

Removed Magic Fire / Magic Cold
Added Resist Magic Damage / Poison
Class kits are now displayed instead of base classes when possible
Added backstab immunity info
Added See invisible info
Fixed Level display
Proficiencies now take one line.

Proficiencies are not realtime now - its the data from the archive which will be outdated for your party members but will be correct for the enemies

Guess what was implemented?
screen

New release

That looks awesome! The lack of feedback is what frustrates me the most about BG and your project solves that perfectly :D

I'm going to give it a thorough try later today when I'm done with work (silly mondays...) and get back to you with detailed feedback. I'm thinking it might be better to open separate issues? This one became huge.

Okki - Im closing this one then