[SOLVED]Pushed sounds to the limit.

Started by 1ИCΘ6И17Θ, October 19, 2018, 08:28:17 AM

Previous topic - Next topic
October 19, 2018, 08:28:17 AM Last Edit: December 18, 2018, 02:51:59 AM by 1ИC06И170
Hey, this week I've been furiously working on my mod, constantly adding in new sounds and I stumbled upon some wierd issue, maps with 3 sides and vehicles will load either my custom sound file or the game's common sounds, but for some really odd reason, the music is still loaded from the file. Changing the sound loading order in the mission.lvl file switches from one sound bank to another, but won't load both.

My mod adds over 200 sounds and 37 music tracks in the custom file as of now, could it come from a limit I shouldn't have crossed ?
Also, check out my total conversion for BF1: Ferocious Battlefront
http://www.moddb.com/mods/ferocious-battlefront

RELEASE INCOMING

October 19, 2018, 10:16:34 AM #1 Last Edit: October 19, 2018, 10:18:22 AM by Giftheck
There's a limit as to how many sound effects can be loaded at once. If you breach that limit the game will ignore all but the last bank file loaded (be it the stock .lvl/common.bnk or your custom modID.asfx files).

You can try any of the following to remedy the issue:

-Cut down on the number of custom SFX you're using.
-Cut down the length of the custom SFX, eradicating any silence or tail-off that you won't need.
-Resample your sound effects - the higher it is in frequency, the more space in memory it takes up. For instance, stock blaster sounds are at 44kHz, while other sounds are commonly at 22kHz. Personally, I would use 22kHz for all new sounds.
In Progress:
--Star Wars: Battlefront - Anniversary Edition (formerly Star Wars: Battlefront - Legacy Edition)
--Endor: Imperial Base

On Hold:
--Star Wars Battlefront: Elite Squadron For SWBF1

October 19, 2018, 12:02:25 PM #2 Last Edit: October 19, 2018, 12:16:03 PM by RepComm
#SpeculationAhead

Quote from: 1ИC06И170 on October 19, 2018, 08:28:17 AM
...
Changing the sound loading order in the mission.lvl file switches from one sound bank to another, but won't load both.
...

My mod adds over 200 sounds and 37 music tracks ...
That sounds like something close to a byte's possible unique values 0-255.. Hmm

Quote from: Giftheck on October 19, 2018, 10:16:34 AM
There's a limit as to how many sound effects can be loaded at once. If you breach that limit the game will ignore all but the last bank file loaded (be it the stock .lvl/common.bnk or your custom modID.asfx files).
I don't know that modifying the memory consumed would make much a difference (but I don't know anything about swbf's system for it, either).

I'd bet you that when music is loaded it is assigned an ID (possibly a BYTE?), and when the id gets past its ID binary type's length that it overflows and does the whole (255+1 == 0) == true thing

edit- Like this: https://www.doc.ic.ac.uk/~eedwards/compsys/arithmetic/index.html

edit- It could be possible that there isn't a limit on the IDs, and its just how the lua values get parsed over.
For example, if the sounds are stored in an array/list/vector/etc and the game needs to get/set them via index, if that index variable is a small enough finite length, you could be accessing the array at the binary adding overflow index (in this case, probably 0, since you described it as the last element loaded).

If the last two are the case, then it is likely that the sounds get loaded just fine, but stored in the array goofy because of the binary overflow, which, when the limit is reached, the next value stored would end up in index 0 (or 1, in lua's case).

I bet it is that, I removed over 30 "unused" sound from the alpha and bat versions of the game and went as far as reducing the music from 44khz to 22khz, (reducing the mod size by half) and it made nothing, it ain't about the size nor the numbers either, since I optimized the older's architecture as far as I could.

I noticed it happens whenever a third side is loaded Alongside Vehicles, such as Dune See, and Plains, and the issue showed itself on the Sereja maps I managed to make work with my mod.
Now I wonder what can trigger that. I did so much in a week that I forgot to deeply test each and every feature I added during the course of this week and I cannot roll back my changes. I suspect it has something with the amount of music files as it is the biggest change I can think of that I added over the course of the last two weeks, although the maps the problem manifests itself one are maps that I sadly rarely use for tests, so I can't tell since when this issue has been overlying in my work.
But I heavily suspect the last two weeks and what I have done in that time.
I think I have managed to think of a way to fix it And at the same time get a rid of the shall I say inconveniences caused by the weight of my modifications.
I'll keep you guys updated on the matter from PMs or Discord, if my thoughts are right and the solution I found good, I'll post my results here.

Also @Giftheck I don't think there's a true limit on the amount of sound effects you can add or modify, but it is all about the way the tasks are attributed and sorted by the game.
Also, check out my total conversion for BF1: Ferocious Battlefront
http://www.moddb.com/mods/ferocious-battlefront

RELEASE INCOMING

Now that I come to think of it, solved, it was and wasn't a .sfx issue, it was due to maps loading too many groups of sounds because of em wookiees.
Also, check out my total conversion for BF1: Ferocious Battlefront
http://www.moddb.com/mods/ferocious-battlefront

RELEASE INCOMING