Jump to content

Alternatives to WeiDU? Or, how to write a smarter sound set installer?


Recommended Posts

@kjeron Why not use SNDSLOT.IDS when it tells me which symbolic name corresponds to which integer index? No need to create one's own mappings. A sound set can define a WAV file for BATTLE_CRY1, SELECT_COMMON1, etc., and it will be automatically translated to the correct integer index based on the SNDSLOT.IDS of the game for which you're installing the sound set.

Link to comment
4 hours ago, kjeron said:

You're better off ignoring what's in SNDSLOT.IDS, and mapping it yourself with custom labels (per game) for each sound.  Use CHARSND.2da to determine if a slot is used by the game, not SNDSLOTS.IDS.

Partially disagreeing with this one - the IWD1 slot restorations are not used in any of the new voicesets (thereby dummied out in CHARSND.2DA on all characters), but they are part of the game and they function and one's only aware of this if said one looked at SNDSLOT.IDS. I do agree one should use custom labels though and not what it provides, which is why in the EE soundset tool has human-readable variable names for the slots as well.

Link to comment
6 hours ago, Graion Dilach said:

Partially disagreeing with this one - the IWD1 slot restorations are not used in any of the new voicesets (thereby dummied out in CHARSND.2DA on all characters), but they are part of the game and they function and one's only aware of this if said one looked at SNDSLOT.IDS. I do agree one should use custom labels though and not what it provides, which is why in the EE soundset tool has human-readable variable names for the slots as well.

Not sure what you mean, only one sound slot is currently (v2.6) omitted from CHARSND.2d - slot #0.  Every other slot is listed.

Link to comment
8 hours ago, Taylan said:

@kjeron Why not use SNDSLOT.IDS when it tells me which symbolic name corresponds to which integer index? No need to create one's own mappings. A sound set can define a WAV file for BATTLE_CRY1, SELECT_COMMON1, etc., and it will be automatically translated to the correct integer index based on the SNDSLOT.IDS of the game for which you're installing the sound set.

The issue is that the game engine (mostly) doesn't care what the symbolic names are. Take class.ids - it assigns a numeric value to each class, so that class 1 is labeled MAGE and so forth, but the engine (mostly) doesn't store or manipulate the symbolic names, only the numeric values. If you changed 'MAGE' to 'WIZARD' in class.ids, it would (mostly) leave the game unaffected.

(The 'mostly' caveat is because dialog files store their fragments of script uncompiled and compile it at run-time. So if there's a trigger in a dialog that checks if you're a mage, that change will confuse it.)

So if you change the label on sndslot 9 (currently BATTLE_CRY1) to SELECT_COMMON1, it won't make any difference to how the sound in slot 9 is used by the engine; it'll just mean it's labelled misleadingly. More seriously, if IWDEE uses BATTLECRY1 rather than BATTLE_CRY1, you still want your first battle-cry to be put in that slot.

Usually the various EE games are consistent across their ids files so that you can write multi-game code that refers to the ids symbols, at least if we're talking about BG2EE, BGEE, and IWDEE, all of which use the same engine. But there are exceptions, and I don't have much experience modding PSTEE, which has a different version of the engine. (My code above was to make a general point about WEIDU capabilities, not actually to thrash out what a working soundset program would be.) My advice here would probably be to standardize on the BG2EE version of sndslot.ids and just read the symbolic names in from a local copy in your mod folder rather than relying on the in-game version. In WEIDU I'd just read them into an array; I assume you can do something similar in Python (which I think is probably Turing-complete).

Link to comment
7 hours ago, kjeron said:

Not sure what you mean, only one sound slot is currently (v2.6) omitted from CHARSND.2d - slot #0.  Every other slot is listed.

My point was that CHARSND.2da alone doesn't tell what a slot does because not all slots have example usage cases in the games and SNDSLOT.IDS gives a description to start from.

Link to comment

I still don't see why it would be an issue to use the names from SNDSLOT.IDS. That the game engine doesn't actually read that file isn't important, so long as the mapping in it is accurate. I'm not proposing to write to the file, only to use it as a reference. And if for instance IWDEE uses BATTLECRY1 but BG2EE uses BATTLE_CRY_1 then all your sound set mod has to do to support both games is to list both of those entries (pointing to the same WAV file), like:

BATTLECRY1 = my_fancy_battle_cry.wav

BATTLE_CRY_1 = my_fancy_battle_cry.wav.

Tell me if I'm still missing something.

1 hour ago, DavidW said:

On the question of whether WEIDU is Turing-complete: see here.

Neat! :D

I still think a language like Python would be beneficial in the long term, but to each their own. We'll have to see if my project goes anywhere; it depends mostly on whether I actually find enough time and energy to put into it.

Link to comment
29 minutes ago, Taylan said:

I still think a language like Python would be beneficial in the long term, but to each their own. We'll have to see if my project goes anywhere; it depends mostly on whether I actually find enough time and energy to put into it.

Oh, you might well be right (though the backwards-compatibility issues are serious). WEIDU is a lot more powerful than it looks, and I actually really enjoy programming in it, but I don't think anyone thinks it's the language that you'd build from scratch for modding.

 

Link to comment
51 minutes ago, Taylan said:

I still don't see why it would be an issue to use the names from SNDSLOT.IDS. That the game engine doesn't actually read that file isn't important, so long as the mapping in it is accurate. I'm not proposing to write to the file, only to use it as a reference.

How about SELECT_ACTION4 (and 5-7), same label and slot in all games.

In BG2EE their slots represent ordering an action.

In BGEE/IWDEE their slots represent selecting a character.

Link to comment

@kjeron If that really is the case, that's a problem indeed. Quoting my previous post:

On 7/1/2021 at 12:21 AM, Taylan said:

What would pose a significant annoyance:

- The same symbolic name is used for completely different purposes in two games. E.g. if the name "DAMAGE" is used by one game for the generic sound whenever a character is hit, but another game uses it for the "critical damage reached" sound where the character asks for help. (This particular example is surely not the case, it's just an example of what could be.) Solutions might be: 1. use a symbolic name that exists in none of the games, the installer translates it to the correct real name; 2. sound set definition must specify which game is meant with the symbolic name, by specifying it as e.g. "DAMAGE/BG2EE" and "DAMAGE/IWDEE" and the installer interprets it the right way.

A third option might be to expect the sound set mod to contain one SoundID->WAV mapping table per supported game. So the contents of the definitions file could look like:

[sounds/bgee]
battle_cry1 = bc1.wav
battle_cry2 = bc2.wav
...
select_action4 = select4.wav
select_action5 = select5.wav
...

[sounds/bg2ee]
battle_cry1 = bc1.wav
battle_cry2 = bc2.wav
...
select_action4 = action4.wav
select_action5 = action5.wav
...

(I'm using the names from SNDSLOT.IDS, just lowercase.)

There would be lots of duplication because those sections will be 90% the same, but at least there's no chance of confusion.

Although I think I like solution nr. 1 in my quoted post better. There would be a small number of "special" names which the sound set installer automatically translates to a different name, based on the game. Consider:

[sounds]
battle_cry1 = bc1.wav
battle_cry2 = bc2.wav
...
select4 = select4.wav # Translated to select_action4 for BGEE, select_common4 for BG2EE
select5 = select5.wav # Likewise
...
action4 = action4.wav # Translated to (???) for BGEE, (???) for BG2EE
action5 = action5.wav # Likewise
...

(I'm not sure what the "(???)" should be in the last example. Is this what those game-prefixed IDs are for? E.g. within BGEE, there are IDs like BG2EE_SELECT_RARE1.)

So this half-half solution might be best. It allows using mostly the IDs defined in SNDSLOT, and only requires the sound set installer to assume special knowledge over a small number of incompatibilities between the games. Doesn't require defining a whole table of our own IDs per game.

Link to comment

Sorry for triple-posting / bumping, but I feel like I should provide an update since it's the end of August now: I had to take care of my grandmother for a big chunk of my vacation, since she has dementia and can barely move. From 3-4 different projects I had lined up for my vacation and was enthusiastic about, I was able to complete just one. T_T

Please don't expect any quick progress, though I really don't want to let this project idea die. I'll probably work on it on and off as time goes.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...