Poll

Should ADD_SPELL memorise recently uninstalled ids entries?

Yes
1 (33.3%)
No
2 (66.7%)

Total Members Voted: 3

Author Topic: Lobbying for an ADD_SPELL improvement  (Read 3216 times)

Offline Galactygon

  • Modding since 2002
  • Planewalker
  • *****
  • Posts: 378
  • Gender: Male
  • Creator of spells
Lobbying for an ADD_SPELL improvement
« on: September 03, 2010, 12:30:41 PM »
A debate in the G3 workroom and the ensuing stalemate prompted me to launch this poll to convince The_Bigg of making ADD_SPELL more useful. We are trying to standardize spell mods so duplicate spells from mods use the same filenames and ids entries - ensuring they are all compatible with each other.

ADD_SPELL right now works the following way (copied from The_Bigg's post) :
Code: [Select]
ADD_SPELL ~mymod/spl/sunscorch.spl~
    1 // 1 = sppr, 2 = spwi, 3 = spin, 4 = spcl
    1 // 1st level
    SUNSCORCH // appended to spell.ids
    SAY NAME1 Sunscorch // list of patches applied to the spell file when copying to the override
    SAY DESC ~blah blah blah~
    // constraint list: stuff like BUT_ONLY. I don't know what I was smoking when I added it; it would cause the IDS to be altered and the file to NOT be copied. Will be completely ignored in 221+.

An important part of ADD_SPELL is if there is an existing ids entry that already is called SUNSCORCH, and it's a level 1 priest spell, then ADD_SPELL will overwrite the actual spell with the new one. With multiple mods adding their own version of Sunscorch, there will be duplicates in the priest scroll, which looks weird. Not to mention one mod's Sunscorch might overwrite another mod's Frost Fingers if they both use the same filename. ADD_SPELL would prevent duplicates from happening, and prevent mod spells from overriding other spells because ADD_SPELL looks for an empty ids if it doesn't find any duplicates.

This sounds really nice, but ADD_SPELLs got one flaw because of its adding-a-new entry nature: If midgame user x decides (s)he doesn't like spell y and uninstalls spell y, then ADD_SPELLs that install after spell y would be searching for and filling the empty slots in. Including the slot that was formerly taken by spell y. Not only that, but spells of the same type and level are also bumped up by one entry - since the next spell would take the entry of the spell that took spell y's entry and so on.

Saved games on the other hand store the RES of the spell. Reloading after uninstall of one component and reinstall of succeeding components will mean the saved game will look for the same spell resources - but now those are different spells! To be blunt, this means that uninstalling even one component that uses ADD_SPELL will break saved games if new spells already appeared in the game. Even a million warning signs won't prevent people from constantly reinstalling individual spells - because - "it's only a single spell".

I've proposed a workaround for this: At the very first ADD_SPELL, the installer would copy a blank text file in the override that will store all of the new entries produced by all the ADD_SPELLs. They key is that this text file would not change when uninstalling the components that use ADD_SPELL - when some of those components are reinstalled later, the ADD_SPELL entries could be recalled from the text file if possible.

The user wouldn't be stuck with the text file - it could be gotten rid of by uninstalling the first component that uses ADD_SPELL *and* exit the setup. The reason I'm saying this is in case the user uninstalls only the first component that uses ADD_SPELL. Then the rest of the components will be reinstalled and thus keep the text file.

I like the idea of this improvement, but it's hit The_Bigg snag - he's not convinced it's such a good idea. If you allow me to quote a part of this discussion from the G3 workroom:
Quote from: The_Bigg
I can't think offhand of what problems could happen, but I tend to trust my gut instinct on this type of issues.
Quote from: Galactygon
All we're doing is storing information from ADD_SPELLs and recalling that information at reinstall. If someone fiddles/manually appends the SPELL.ids which is used by any of the ADD_SPELLs, that ADD_SPELL would work normally, taking a different slot and updating the stored information accordingly. There is no difference between this and storing the information in some other way

I'd buy into ADD_SPELL if this were implemented. More nods from the interested parties in the yes direction might convince The_bigg to do this.
Quote from: The_Bigg
Frankly, it's the idea of storing information across uninstalls thing that is scaring me, not the specifics of how this is done. Modders are way too good at breaking games by abusing corner cases in this sort of thing.

This is what the poll is for: with enough votes and yes nods we can maybe convince The_Bigg this idea is worth trying for ADD_SPELL.

-Galactygon

Offline DavidW

  • Planewalker
  • *****
  • Posts: 316
Re: Lobbying for an ADD_SPELL improvement
« Reply #1 on: September 03, 2010, 01:18:14 PM »
I haven't voted (I'm unpersuaded of the virtues of democracy in this kind of situation), but here's my main worry about components that store information through UNINSTALLs: they create a hysteresis problem, whereby two installs that have the same WEIDU.log actually look different. This really isn't good news for debugging and testing. (Hysteresis already happens with the dialog.tlk file, of course, but there are very good reasons for it, and anyway we're all used to the particular issues it causes.)

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: Lobbying for an ADD_SPELL improvement
« Reply #2 on: September 03, 2010, 01:48:15 PM »
I also rate this one a big "no way."

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: Lobbying for an ADD_SPELL improvement
« Reply #3 on: September 03, 2010, 01:59:15 PM »
I haven't voted (I'm unpersuaded of the virtues of democracy in this kind of situation)
Exactly - this isn't "this is hard to do, so I won't do it unless a lot of people need it", but rather "I can foresee this causing problems, so I won't do it even if I get 30 people asking for this".
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline Galactygon

  • Modding since 2002
  • Planewalker
  • *****
  • Posts: 378
  • Gender: Male
  • Creator of spells
Re: Lobbying for an ADD_SPELL improvement
« Reply #4 on: September 03, 2010, 02:10:46 PM »
This hysteresis problem is easily solvable by asking the bug reporter to post ADD_SPELL.log (or whatever its name would be), in which case the user's install could be replicated by downloading the ADD_SPELL.log and installing the components the way WeiDU.log dictates.

I feel this disadvantage of asking another .log file is outweighed by the advantage of ADD_SPELL not breaking saved games.

-Galactygon

Offline GeN1e

  • Planewalker
  • *****
  • Posts: 267
  • Gender: Male
Re: Lobbying for an ADD_SPELL improvement
« Reply #5 on: October 19, 2010, 02:46:13 PM »
1) Edit savegame upon uninstalling, if that much inclined.
2) People trying to load old saves in new install deserve their share of bugs. It is repeatedly mentioned everywhere not to do so.

Offline Galactygon

  • Modding since 2002
  • Planewalker
  • *****
  • Posts: 378
  • Gender: Male
  • Creator of spells
Re: Lobbying for an ADD_SPELL improvement
« Reply #6 on: October 21, 2010, 01:48:16 AM »
This has been resolved. Mike1072 has developed some code that will preserve savegames by continuously comparing the SPELL.ids with external files when un/reinstalling individual components. The_Bigg said ADD_SPELL will do this behind the scenes starting v221.

-Galactygon

Offline GeN1e

  • Planewalker
  • *****
  • Posts: 267
  • Gender: Male
Re: Lobbying for an ADD_SPELL improvement
« Reply #7 on: October 21, 2010, 01:54:43 PM »
That's cool, but do you guys realise what's the problem's core here? It's not about ADD_SPELL in particular, but about adding new resource into game, storing a reference to it inside a savegame, then uninstalling the resource. ADD_SPELL is only one of the many, same happens if you uninstall kits, items, NPCs, etc. in the middle of your play.

Turambar90

  • Guest
Re: Lobbying for an ADD_SPELL improvement
« Reply #8 on: October 22, 2010, 10:26:49 AM »
I'm glad a solution's been found, as this new function will probably be really useful, considering the fact that spell names can't be prefixed easily.

Another thing I noticed in all ADD_KIT, ADD_SPELL, ... is that the name/ids number of the new resource is not returned by the function. For example, if I use ADD_KIT and then want to apply that kit, I have to read kitlist.2da again and read the last number, before writing it.
Wouldn't it be useful to be able to write a variable name, where the name automatically given by the function is stored?

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: Lobbying for an ADD_SPELL improvement
« Reply #9 on: October 22, 2010, 11:42:20 AM »
ADD_KIT ~C!Selune~ sets a ~%C!Selune%~ variable, etc.
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: