Jump to content


Photo

Enemy item shattering and standard AI scripts


  • Please log in to reply
28 replies to this topic

#21 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 01 January 2009 - 01:54 PM

Spent quite some time with this interesting problem. I've attached my approach to solve it.
The tp2 was able to find a solution in about 5 iterations on my vanilla BGT install. (~ 5300 CREs)

Unfortunately, the code is a bit nasty and I did not include much (any?) debugging information.
But the general structure is similar to your approach.

Looks funky, and I think its shorter than mine. Would you mind summarising the major differences between yours and mine because I'll have to include something into the next Tweak Pack. I'm still thinking of only extending existing for the 5 script CREs and making all other CREs use new scripts so long as they don't share a script with the 5 script CREs that is already extended. Maybe that is what your code does.

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)


#22 Taimon

Taimon
  • Member
  • 387 posts

Posted 01 January 2009 - 02:52 PM

Looks funky, and I think its shorter than mine. Would you mind summarising the major differences between yours and mine because I'll have to include something into the next Tweak Pack. I'm still thinking of only extending existing for the 5 script CREs and making all other CREs use new scripts so long as they don't share a script with the 5 script CREs that is already extended. Maybe that is what your code does.

That's exactly what it does.
The major difference is that I try to select the most specific script when extending to minimize conflicts.
If there are any conflicts, the problematic CRE is processed earlier in the next iteration.
I don't think the code is shorter or cleaner, but it might be able to find a better solution.

What isn't implemented is your removal of duplicated scripts (really necessary?) and the CRE blacklisting. (But I don't think that you'd have any problems in adding those.)

And I haven't tested this on a mega-install.

#23 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 01 January 2009 - 10:37 PM

Looks funky, and I think its shorter than mine. Would you mind summarising the major differences between yours and mine because I'll have to include something into the next Tweak Pack. I'm still thinking of only extending existing for the 5 script CREs and making all other CREs use new scripts so long as they don't share a script with the 5 script CREs that is already extended. Maybe that is what your code does.

That's exactly what it does.
The major difference is that I try to select the most specific script when extending to minimize conflicts.
If there are any conflicts, the problematic CRE is processed earlier in the next iteration.
I don't think the code is shorter or cleaner, but it might be able to find a better solution.

What isn't implemented is your removal of duplicated scripts (really necessary?) and the CRE blacklisting. (But I don't think that you'd have any problems in adding those.)

And I haven't tested this on a mega-install.

Yep, I noticed the script counts, though I don't know how much of an advantage it gives, although at a probabilistic level it makes sense.

One thing I can't find in your script is if a priority CRE with 5 scripts will be processed twice, because it will be part of borth five_scripts_cre and prio_cre. It won't have any real effect but to save processing time because the CRE will be detected to have been already extended.

Duplicated scripts automatically blacklist certain scripts from being used as a basis for extension, which probably isn't desirable, and also may cause in-game bugs by themselves, so it is more of a fix to the game itself by removing them. There certainly is no benefit in having two of the same script.

CRE blacklisting is necessary - simplifying the process and ensuring that what you don't need to patch irrelevant CREs (in this case, all BG2-specific CREs). The scripts themselves have an ENDOFBG1 check to prevent them activating in BG2 as well.

Edited by Ascension64, 01 January 2009 - 10:38 PM.

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)


#24 Taimon

Taimon
  • Member
  • 387 posts

Posted 02 January 2009 - 02:36 AM

Yep, I noticed the script counts, though I don't know how much of an advantage it gives, although at a probabilistic level it makes sense.

The downside is, that it takes rather long.

One thing I can't find in your script is if a priority CRE with 5 scripts will be processed twice, because it will be part of borth five_scripts_cre and prio_cre. It won't have any real effect but to save processing time because the CRE will be detected to have been already extended.

The script itself isn't optimized in any way. There are more parts where a CRE is processed more than once.
Will check if there is any notable speedup if I skip already processed CREs.

CRE blacklisting is necessary - simplifying the process and ensuring that what you don't need to patch irrelevant CREs (in this case, all BG2-specific CREs). The scripts themselves have an ENDOFBG1 check to prevent them activating in BG2 as well.

Yes, I know it's necessary. I was only curious if the script can handle all CREs in a BGT install.
Could you attach your CREExcl.txt?

#25 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 02 January 2009 - 02:00 PM

Yep, basically it is (!({all BG2 CREs} n {all BG1 CREs}) u {CHARBASE}), where {} specifies a set.

Attached Files


Edited by Ascension64, 02 January 2009 - 02:02 PM.

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)


#26 Taimon

Taimon
  • Member
  • 387 posts

Posted 03 January 2009 - 04:49 AM

I've added the missing parts (cre exclusion, script removal, skipping over already processed cres) and added some debugging output.
It needs your CREExcl.txt in the working directory.

Takes roughly two minutes on my really old pc.

Attached Files



#27 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 04 January 2009 - 09:21 PM

I've added the missing parts (cre exclusion, script removal, skipping over already processed cres) and added some debugging output.
It needs your CREExcl.txt in the working directory.

Takes roughly two minutes on my really old pc.

Thanks. Will see what I can do with including this code in.

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)


#28 Taimon

Taimon
  • Member
  • 387 posts

Posted 05 January 2009 - 06:09 AM

Maybe someone from the megamod group could check if it installs fine on a large installation.

#29 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 06 January 2009 - 12:43 AM

Maybe someone from the megamod group could check if it installs fine on a large installation.

erebusant tested my old code on his install (see pinned thread). It worked in 5 iterations, surprisingly, although the DEBUG shows that the installation took 990 seconds (16.5 minutes)! No doubt yours would install quicker.

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)