Author Topic: Idea: Game Engine Alteration: Weapon Visuals  (Read 2842 times)

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
Idea: Game Engine Alteration: Weapon Visuals
« on: August 02, 2011, 07:51:11 pm »


               I do not know if anyone out there has the skill to alter the NWN game engine in the way I'm thinking of (I certainly don't have the skill), but I thought I'd throw this out there as an idea someone might be able to implement someday.

Problem: The visual effects for weapons (such as flaming and dripping acid) are limited to the 7 existing types, with no ability to really add any new types.

Idea: Alter the game engine to actually USE iprp_visualfx.2da to determine the effects models used so custom content makers can add new effects.

Right now, iprp_visualfx.2da is mostly a reference for lines from dialog.tlk to name the property in the toolset.  It can also be modified slightly to add a "none" visual effect type (which seems to work by calling a non-existant/non-specified model in-game).

If the game engine/graphical displays were able to be modified to use an additional column from this file (example follows), it would allow builders/content makers to add brand new visuals instead of just replacing existing ones.  The game already uses different models, with the correct files picked based on the weapon type (base model names specified in baseitems.2da) and a suffix.

Example modification to iprp_visualfx.2da:

        Label       Name        ModelSuffix
0       Acid        83393       acid
1       Cold        83394       cold
2       Electrical  83395       elec
3       Fire        83396       fire
4       Sonic       83397       sonc
5       Holy        83398       holy
6       Evil        83399       evil
7       None        202         none
8       Shadow      16872207    shad
9       Psionic     16872208    psnc
10      FireGreen   16872209    fgrn
11      FireBlue    16872210    fblu
12      FireRed     16872211    fred
13      GlowBlue    16872212    gblu
14      GlowYellow  16872213    gyel

I have no idea if this would be possible.  I just figured with things like the camera modifications and NWShader floating around, there'd be a small chance this would work.  It's just too bad I didn't think of this back when NWN was still being patched by BioWare.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Idea: Game Engine Alteration: Weapon Visuals
« Reply #1 on: August 03, 2011, 01:14:59 am »


               We lobbied heavily for bioware to do this before 1.69 went live. It would've been a simple enough change, but it requires a client hack, meaning a new patch. Perhaps with the client extender from ElgarL...

Funky
               
               

               


                     Modifié par FunkySwerve, 03 août 2011 - 03:25 .
                     
                  


            

Legacy_Greyfort

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0
Idea: Game Engine Alteration: Weapon Visuals
« Reply #2 on: August 03, 2011, 01:59:29 am »


               Client extender??? from ElgarL could you go into more detail about that Funky if you have time?

Oh and shadow might be intrested in the idea for his 170patch Amth-dragon
               
               

               


                     Modifié par Greyfort, 03 août 2011 - 01:00 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Idea: Game Engine Alteration: Weapon Visuals
« Reply #3 on: August 03, 2011, 04:26:38 am »


               Shad is using ElgarL's work in the 'patch'. He hasn't tackled anything like exe edits, though, so far as I know.

Funky
               
               

               
            

Legacy_Calvinthesneak

  • Hero Member
  • *****
  • Posts: 1159
  • Karma: +0/-0
Idea: Game Engine Alteration: Weapon Visuals
« Reply #4 on: August 03, 2011, 05:21:56 am »


               Has anyone heard from Elgar since oh about Christmas.  I was involved with it for a bit, but Elgar sorta dropped off face of the world.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Idea: Game Engine Alteration: Weapon Visuals
« Reply #5 on: August 03, 2011, 05:46:33 am »


               @Gray Fort.

Most of the information about ElgarL's project come from:  Coming to a screen near you soon!
               
               

               
            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
Idea: Game Engine Alteration: Weapon Visuals
« Reply #6 on: August 03, 2011, 08:16:04 am »


               I wrote to ElgarL about an unrelated matter a few weeks ago and he indicated that he had moved on to modding Minecraft.   He will be missed and I hope he decides to come back to NWN.

In the mean time, I had decided to try out an idea I've been kicking around.  I'll state at the outset that it failed but maybe someone with more experience in hex editing knows where I might have gone wrong. 

Looking at the strings from NWMain.exe, I can see that while the suffixes for weapon vfx are hardcoded (_fxacid, _fxholy, etc.), iprp_visualfx (the .2da) is not.  My definition of hardcoded means the string for (whatever) is actually contained in the nwmain.exe (or nwtoolset.exe, etc.).  If it's not in the string dump, it's not hardcoded.  That's a little misleading but you get the idea.  For instance, the iprp_visualfx.2da isn't hardcoded by my definition but it is invoked in itempropdef.2da, whose loading is.

Anyway, thanks to AD's description it was really easy for me to understand the problem though, of course, it didn't work for me either.  So I figured I'd crack open a Hex editor.  I noticed the following:
'Posted
The names of the suffixes that it looks for are a total of 8 bytes (A) unless the name runs long (B) in which case there are 4 bytes of padding between the suffix and the next entry.  My idea was, if I can shorten the long suffixes, I might be able to squeeze in one extra weapons vfx suffix to search for, like so (C):
'Posted
If you look at the above you'll see I shortened _fxsonic to _fxsonc and a couple of others to get the extra space.  Unfortunately, it didn't pan out like I hoped and the edited executable displayed the weapon vfx fine until it came to my shortened entries and, starting at _fxsonc, wouldn't display any suffix after that point, though _fxneg and _fxholy worked because they came before the first of my edits.

Maybe something like that is possible but I was just doing it wrong?  One extra VFX is probably not going to rock the world but if the idea works, there are other things in the executable's strings I'd like to apply it to.

BTW,  I saw a modification either on the NWVault or on here where someone had edited the toolset.exe (I believe) to make the combo box window wider so viewing CEP appearance names was easier.  That sort of thing seems promising in lots of different ways- does anyone have  a link to that?  I forgot where it was posted/uploaded.
               
               

               


                     Modifié par OldTimeRadio, 03 août 2011 - 07:16 .
                     
                  


            

Legacy_virusman

  • Sr. Member
  • ****
  • Posts: 448
  • Karma: +0/-0
Idea: Game Engine Alteration: Weapon Visuals
« Reply #7 on: August 03, 2011, 10:30:57 am »


               

OldTimeRadio wrote...

I wrote to ElgarL about an unrelated matter a few weeks ago and he indicated that he had moved on to modding Minecraft.   He will be missed and I hope he decides to come back to NWN.

Could you ask him if he could at least release the sources for his modification? It'd be pity to see all this work lost. I or anyone else at NWNX could continue this work and merge with NWNCX.

In the mean time, I had decided to try out an idea I've been kicking around.  I'll state at the outset that it failed but maybe someone with more experience in hex editing knows where I might have gone wrong. 

Looking at the strings from NWMain.exe, I can see that while the suffixes for weapon vfx are hardcoded (_fxacid, _fxholy, etc.), iprp_visualfx (the .2da) is not.  My definition of hardcoded means the string for (whatever) is actually contained in the nwmain.exe (or nwtoolset.exe, etc.).  If it's not in the string dump, it's not hardcoded.  That's a little misleading but you get the idea.  For instance, the iprp_visualfx.2da isn't hardcoded by my definition but it is invoked in itempropdef.2da, whose loading is.

Anyway, thanks to AD's description it was really easy for me to understand the problem though, of course, it didn't work for me either.  So I figured I'd crack open a Hex editor.  I noticed the following:
'Posted
The names of the suffixes that it looks for are a total of 8 bytes (A) unless the name runs long (B) in which case there are 4 bytes of padding between the suffix and the next entry.  My idea was, if I can shorten the long suffixes, I might be able to squeeze in one extra weapons vfx suffix to search for, like so (C):
'Posted
If you look at the above you'll see I shortened _fxsonic to _fxsonc and a couple of others to get the extra space.  Unfortunately, it didn't pan out like I hoped and the edited executable displayed the weapon vfx fine until it came to my shortened entries and, starting at _fxsonc, wouldn't display any suffix after that point, though _fxneg and _fxholy worked because they came before the first of my edits.

Maybe something like that is possible but I was just doing it wrong?  One extra VFX is probably not going to rock the world but if the idea works, there are other things in the executable's strings I'd like to apply it to.

The location you found is data section. You can modify the text values, but you won't be able to add more effect types because it's controlled by code, where they're hardcoded to 7 types.
The code references these values by absolute address, that means you can't move them, only modify in-place.

BTW,  I saw a modification either on the NWVault or on here where
someone had edited the toolset.exe (I believe) to make the combo box
window wider so viewing CEP appearance names was easier.  That sort of
thing seems promising in lots of different ways- does anyone have  a
link to that?  I forgot where it was posted/uploaded.

http://www.nwnx.org/...opic.php?t=1798
               
               

               


                     Modifié par virusman, 03 août 2011 - 09:59 .
                     
                  


            

Legacy_virusman

  • Sr. Member
  • ****
  • Posts: 448
  • Karma: +0/-0
Idea: Game Engine Alteration: Weapon Visuals
« Reply #8 on: August 03, 2011, 10:49:13 pm »


               Done.
http://data.virusman...x/nwncx-0.1.rar
http://data.virusman..._tweaks-0.1.rar
(Visual C++ 2010 runtime is required)
               
               

               


                     Modifié par virusman, 03 août 2011 - 09:59 .
                     
                  


            

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
Idea: Game Engine Alteration: Weapon Visuals
« Reply #9 on: August 04, 2011, 02:33:33 am »


               

virusman wrote...

Done.
http://data.virusman...x/nwncx-0.1.rar
http://data.virusman..._tweaks-0.1.rar
(Visual C++ 2010 runtime is required)

Wow.  That was fast!  I'm going to test it out in a couple hours when I get some time. '<img'>


Quick question before I get started:

Is this something each player needs to have installed on their computer (it is called a "client extender", after all), or can it just be run server-side (like other NWNX2 plugins)?

I know PCs would need the models, but that's something I could just load into a hak for them once I get this running.
               
               

               
            

Legacy_virusman

  • Sr. Member
  • ****
  • Posts: 448
  • Karma: +0/-0
Idea: Game Engine Alteration: Weapon Visuals
« Reply #10 on: August 04, 2011, 09:23:34 am »


               

The Amethyst Dragon wrote...

Quick question before I get started:

Is this something each player needs to have installed on their computer (it is called a "client extender", after all), or can it just be run server-side (like other NWNX2 plugins)?

This is a client plugin, so players will have to install NWNCX to see the visuals.
               
               

               
            

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
Idea: Game Engine Alteration: Weapon Visuals
« Reply #11 on: August 04, 2011, 09:30:54 am »


               I'll have to play around with this some more.  Can't seem to get the extender to work on my game (Windows Vista).

I've tried the loader version - pops up a blank little window titled "Cmd", then looks like it starts to load nwmain.exe, but doesn't.

Then tried the "patch" version - updated nwmain.exe just immediately crashes.

I'll take another crack at it tomorrow when I'm not tired, to see if there's something I've missed.  And yes, I did download and install Visual C++ 2010 runtime before starting.
               
               

               
            

Legacy_virusman

  • Sr. Member
  • ****
  • Posts: 448
  • Karma: +0/-0
Idea: Game Engine Alteration: Weapon Visuals
« Reply #12 on: August 04, 2011, 12:48:14 pm »


               Try this version:
http://data.virusman...x/nwncx-0.2.rar
               
               

               
            

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
Idea: Game Engine Alteration: Weapon Visuals
« Reply #13 on: August 05, 2011, 08:27:29 am »


               Version 0.2 didn't work for me either...right away.  Then I thought I might be having problems since my nwmain.exe had previously been altered adding a camera hak.  So, I backed it up and copied over a "fresh" copy from one of my other computers.

1) "loader version" - same result as before, except the delay was longer before it popped up the Cmd Line window thing, then shut down when I clicked Ok.

2) "patch version" - This one works for me. ':wizard:'  Of course, now I need to update my PW's hak file so that I can see the regular weapon visuals (since they now properly read from the 2da!).

Now, I'm off to do some more experimenting to see if there's anything that this breaks for me.  I'll let you know the results.

Thanks, virusman! 
               
               

               
            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
Idea: Game Engine Alteration: Weapon Visuals
« Reply #14 on: August 05, 2011, 09:06:54 pm »


               Thank you very much for the explanation, Virusman!  Also, thanks for the additions to CX.  I wrote ElgarL a day or so ago, BTW.  I'll let you know if I hear back.  I gave this a try and had errors similar to Amethyst Dragon but in my case (I needed to reinstall the critical update to get a clean NWMain) but now it's complaining about me missing a jvm.dll.

I'm about 99% sure that has nothing to do with your stuff but probably either something from Remigus or Elven in the way of a Java plugin.  I'm going to try to clean up my installation a bit more because this would be an incredibly useful addition to the game!

Virusman, would this work for both servers and clients, as long as both had ther required plugins, etc?  To imagine something like this would be available in both single and multiplayer leaves my head spinning with possibilities.