Mekanism Additions

Mekanism Additions

21M Downloads

Sound issue

SirEndii opened this issue · 16 comments

commented

Issue description:

Hey, a player on my server had over 300 wind turbines and the turbines creates sounds even when i 200 blocks away, but i do not hear anything. We have destroyed all the turbines and the sounds go down (screen). Minecraft has a sound limit of 247 and we do not have any sounds.

Steps to reproduce:

  1. Place over 247 turbines and you will see the turbines will create sounds even when you 200 blocks away(Press F3). Now you can't hear when you destroy blocks, attack mobs and else.
  2. Destroy the turbines and the value get lower

image

So the only issue is, the turbine creates sound when I'm in the same dimension, but i can't hear these sounds. But i can't hear other sounds. I don't know if other machines have the same issue.

Version (make sure you are on the latest version before reporting):

Forge: 34.1.42
Mekanism: 10.0.17.444
Other relevant version:

If a (crash)log is relevant for this issue, link it here: (It's almost always relevant)

The log just spam
"Maximum sound pool size 247 reached
Failed to create new sound handle"

Sorry if my english is bad, it's not my native language.

commented

I’m having the same issue and no one wants to help me, they just close my issue and ban me

commented

@dylan99rhyne because the same issue has already been reported, having a duplicate issue just makes it harder to keep track of things

commented

Also you've given no other information that could be used to deduce the cause of the issue.

commented

Issue description:

Hey, a player on my server had over 300 wind turbines and the turbines creates sounds even when i 200 blocks away, but i do not hear anything. We have destroyed all the turbines and the sounds go down (screen). Minecraft has a sound limit of 247 and we do not have any sounds.

Steps to reproduce:

  1. Place over 247 turbines and you will see the turbines will create sounds even when you 200 blocks away(Press F3). Now you can't hear when you destroy blocks, attack mobs and else.
  2. Destroy the turbines and the value get lower

image

So the only issue is, the turbine creates sound when I'm in the same dimension, but i can't hear these sounds. But i can't hear other sounds. I don't know if other machines have the same issue.

Version (make sure you are on the latest version before reporting):

Forge: 34.1.42
Mekanism: 10.0.17.444
Other relevant version:

If a (crash)log is relevant for this issue, link it here: (It's almost always relevant)

The log just spam
"Maximum sound pool size 247 reached
Failed to create new sound handle"

Sorry if my english is bad, it's not my native language.

Just move the generators further away, it worked for me. Pupnewfster will not help you he only cares about himself. I had to figure it out myself. So try that and see if it works.

commented

@Dylanrhyne lie. Because the same issue has already been reported, having a duplicate issue just makes it harder to keep track of things. You should read before creating an issue. Just read and put the needed information to your issues. You should be smart

commented

Just move the generators further away, it worked for me. Pupnewfster will not help you he only cares about himself. I had to figure it out myself. So try that and see if it works.

Firstly, her/herself. Secondly, I am sorry that you feel so entitled @Dylanrhyne that you expect everyone to jump to your every whim and instantly fix your issues as that is not how the real world works and you won't get far acting as such.

When you made an issue, rather than complaining that you left the majority of the issue format blank providing no information about versions or anything and that you blatantly ignored the

Please use the search functionality before reporting an issue. Also take a look at the closed issues!

message at the top of the issue format... I linked you to this issue given I could tell that it was the same issue, and that we are already aware of it. Instead of that being the end of it you made two more issues (both again without the version information filled in), where I again redirected you to this issue and closed them. I then blocked you from the repository for a day so that you would have time to think and realize that just maybe we are actually aware of the issue. Instead you chose to make another account and make yet another issue still leaving out the versioning information we ask for, and then come and "whine" on this issue that we are closing the duplicate highly undetailed issues that you have been making.

I hate to break it to you, but the vast majority of modders make/maintain mods for free in their free time and often have more important things (real life, such as school or work) to deal with than dropping everything to fix minor bugs that only even occur at edge cases of spamming tons and tons of wind generators in one location (instead of say upgrading your power generation). That is part of the reason why the issue tracker exists, to make it easier for us to keep track of and not forget to look into various issues once we actually have time to work on the mod, and having a ton of duplicate low information issues does not help in any manner (there is a reason GitHub has a "subscribe" button on issues so that you can be notified of updates). If modders do things too slowly for you, feel free to learn to mod yourself and either maintain your own mod or when there is an issue you are annoyed at submit a pull request to fix it for the mod.

And finally, what you listed as a "fix" isn't even as much of a fix as a workaround.

Best of luck to you in navigating life with such a selfish/self centered outlook.

commented
commented
commented

Really professional dumbass lol have a great life failing.

Bruh

commented

At least give an update saying you are too stupid to fix your own issue. 😂👏🏻

What? pupnewfster did not create any issue.

commented

And why should i fix my own issue? I would do it, if i have more time.

Edit: oh, he is blocked

commented

Lol he actually thinks he's a genius because he figured out that they wouldn't make any sounds if they were far away, and he "fixed" the issue "for" pup. I can't make this up.

commented

I looked at this problem today since it also annoys me a bit in my playthrough with a lot of machines.
The only way to get any sounds to work again is to restart the sound engine by lowering and raising the main volume.

If I understand things correctly the sounds get played here once a machine is loaded by the player(being in view distance):
https://github.com/mekanism/Mekanism/blob/1.16.x/src/main/java/mekanism/common/tile/base/TileEntityMekanism.java#L1076

The problem is that with many machines in the view radius the max cap of 247 can quickly be reached shutting down the sound engine.

Checking for the user distance and removing the sound if the user is too far away would be a good idea I think for every active sound.
In addition to that, adding a max cap for mekanism sounds played at a time would also prevent issues.
Here is a POC snippet that I added to updateSound() which reduces the number of active sounds a lot by
not starting to play when the player is too far away.

// In TileEntityMekanism > updateSound()
ClientPlayerEntity player = Minecraft.getInstance().player;
double distance = player.getPositionVec().distanceTo(Vector3d.copyCentered(getPos()));
// Stop playing sound when player too far away
// TODO: Find proper distance value, can probably be lower than 16
if (distance > 16 || SoundHandler.numberOfTileSounds() > MAX_CAP) {
    // TODO: This should/could be moved to SoundHandler
    if (activeSound != null) {
        SoundHandler.stopTileSound(getPos());
        activeSound = null;
        playSoundCooldown = 0;
    }
    return;
}

// In SoundHandler
public static int numberOfTileSounds() {
    return soundMap.size();
}

A better way of stopping a sound is probably in the TileTickableSound.tick() since it wont get checked every tick and every machine and hence save some cpu time.
The only problem I see with that is that when the TileTickableSound finishes playing by calling finishPlaying() from the parent, it wont get removed from the soundMap it is in but I could be wrong in that.

I will try to think a bit more about the design of a proper fix.

commented

Ya I was thinking about this some, and what I will likely end up doing is:

  • Grab the sounds attenuation distance (if it isn't a global sound as our sounds are setup in a way to properly support resource packs changing their settings), and only start playing/stop it when the player is within that range (maybe plus a small configurable buffer range of a couple blocks)
    Depending on how much that improves it, if more is needed:
  • If there are multiple of the same sound playing, only actually have the closest ones play (would be a more complex change)
commented

This issue also seems to happen in versions prior to 1.16, as I play on a 1.12.2 modpack that I created, with the sounds cutting half-way during play.
I have found a workaround for this issue until the developer fixes it.
After reading all of your comments and a lot of googling, I ended up finding a Japanese mod for 1.12.2 called ExtendPolyphonyLimit that increases the normal 247 sound limit of the game to any amount you want up to 1073741824, but I don't know how it affects performance or other parts of the game. I only tested it for some minutes and noticed that the problem went away.
I would like to know if this helped some of you, or if you noticed any problems with this mod.

commented

Fixed this as best as I could for when we release 10.0.18 (I hope sometime this weekend, but depending on how much time I have I may not get around to it). We now only add our sounds if they can be heard based on range from the source, and remove them when the player leaves the range. I also lowered the default attenuation range for wind generators and solar generators from 16 blocks to 8 blocks so that they have less of an impact as they are passive so should be somewhat quite to begin with and also should cause less of an impact with the max number of sounds when near a lot of them.

In theory it still is possible if you are near a ton of machines in a very small area that the sound engine won't be able to handle that many sounds, but I am going to call that remaining part an engine limitation that we can't really do anything about, as the same thing would happen if you had a lot of vanilla sounds in a tiny area.