-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dimensional Height Offset #35
base: releases/1.18.1
Are you sure you want to change the base?
Conversation
Added distribution of different dimensions over positional audio height range. - This means that players that are in different dimensions should not hear each other if they are in a Vanilla dimension and otherwise are rather unlikely to hear each other. - DIM0 (Overworld) remains on offset 0 so positional audio for the Overworld does not change. - All players must use the same version of the mod for positional audio to work at all in non-Overworld dimensions. - Changed version number accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering if we should get rid of the “y“ reference in the variable and function names and use height or no designation instead. Because in mumble height is Z axis while in Minecraft it is Y axis. This could lead to confusion when reading the code.
mod/src/main/java/zsawyer/mods/mumblelink/mumble/UpdateData.java
Outdated
Show resolved
Hide resolved
mod/src/main/java/zsawyer/mods/mumblelink/mumble/UpdateData.java
Outdated
Show resolved
Hide resolved
int dimID = game.world.dimension.getType().getId(); | ||
|
||
switch (dimID) { | ||
case 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there maybe an enum that we can use here?
Like
Dimension.overworld.getId()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In MC 1.16 there is an enum that can be used, but this pull request is for MC 1.15
In MC 1.15 there are functions Dimension.isNether and Dimension.isSurfaceWorld however the ID would still be needed to identify the End.
So it is better to leave it this way in my honest opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, Now I get it. Please use named constants though -> DIM_ID_NETHER, DIM_ID_END, DIM_ID_OVERWORLD
(maybe even remove the comments because it becomes self-explanatory)
mod/src/main/java/zsawyer/mods/mumblelink/mumble/UpdateData.java
Outdated
Show resolved
Hide resolved
mod/src/main/java/zsawyer/mods/mumblelink/mumble/UpdateData.java
Outdated
Show resolved
Hide resolved
- Since MC and Mumble use a different coordinate for height, use the term Height instead of Y in functions and variables. - Remove superfluous comments - Remove superfluous "optimization" for Overworld - Expanded the height-space a little bit to make the height offset calculation slightly easier to understand.
We should aim for unison. To me it looks like it stays at 0 or can be configured. But I don't know who/when the config would get changed. |
The way I did it is definitely super hacky, and could probably be done better. Some issues with it that I see currently:
Some things to keep in mind with a new implementation:
|
We had a look at the 1.15 MC API and it looks like we should use constants for -1, 0, 1 (vanilla Minecraft dimensions).
|
@Robijnvogel figured that if we would get a number as an identifier we could use some custom hash function distribution for all other dimension and would distribute them across the height axis. |
I would love to avoid this dependency on this kind of integration. It is more robust and easier to maintain if it is only a client. Could you elaborate on the benefit? |
Yeah, those constants have been around for ages but they've been replaced with registry keys now. We can switch on those keys and return an integer like in the past, but that doesn't support modded dimensions as easily.
A custom hash function would be a possibility as long as it's consistent across different mod loading setups and JVMs and doesn't have collisions for common values. Another possibility I was considering was creating an arbitrary (and unique) mapping from world registry keys to integers and syncing that to all clients. That would require server integration though.
The benefit I see is it alleviates responsibility from myself and server admins to help users troubleshoot configuration mismatches. I've handled several issues, both on GitHub and over Discord, where clients had mismatched dimensional offset values. The other configuration technique in my mod (sending a packet to the client with server info) is server-side, and I haven't had any issues with users of the client having issues connecting, just with server admins not understanding string templating. |
Maybe it would be easier if we would provide better server tools: Give them a mumo module similar to bf2 to use. All that is need then is provide the data in |
The base version of the module would provide only basic dimension based moving (read dimension from identity -> move to channel). However it would get a little tricky to support custom aspects like teams/guilds/factions/squads/parties or what ever I cannot think of right now:
Edit: Maybe the source module gives a hint on how to solve it. |
I agree, Mumo is definitely the "correct" way to do this. Personally though I just don't want to manage plugins on my Mumble server 😄. I'm also not keen on maintaining a Murmur plugin alongside my mod, so if we can fit Minecraft data into an existing plugin's support, that would be great. Supporting teams would be pretty difficult I think. I've never used teams, so I don't know what options they support. We also have to keep in mind the 255-wchar limit on the |
I somehow forgot about the 255 limit on identity. The Forge mod code already does validate and throw an error before sending too long data. |
I just stumbled upon a request where someone wanted dead people to be muted: https://forums.mumble.info/topic/2375-paid-request-mumble-minecraft-plugin/?do=getNewComment |
@magneticflux- I see that you did a similar Y adjustment to what I did, but I am not quite sure in what range the values of the dimension hash code could be. For as far as I see it, there are two options here and I do not see why we would not support both:
If y-offset is going to be used, numbers -256 to 256 are allowed and the numbers should just be multiplied by 256 to get the y-offset. 512 dimensions is a lot for preregistered dimensions. I am ignoring dynamic dimension registration like RFTools and Mystcraft for now.
Should the client-sided mods include the server-sided solution to support the Open to LAN functionality? I've used this in combination with a Virtual LAN before, so I think it is a valid use-case. |
I am inclined to post-pone this into a release after #41 - I'd first like to get the context unision in. Eventhough both Forge and Fabric mod might provide different height data. @magneticflux- : is that dimension-based height-offset active? I cannot tell from your code (it looks like it gets set to 0 everytime :?). |
That's correct; the dimension-based height offset is disabled (set to 0) by default. It can however be enabled in the configuration. I typically recommend people set up channel switching rather than a dimension offset since it helps Mumble/Teamspeak reduce network traffic, so I don't think there are many people using the feature (I intended it as more of a backup solution for when you don't have access to the Minecraft server). |
Ok I have updated to 1.17.
|
@magneticflux- can we agree on an approach here? See my previous post. |
I think the idea of distributing the worlds like this is good, but I have two issues:
|
@Robijnvogel Here's what I found for older versions if you want to backport to 1.15 instead of rebasing to 1.18:
|
@Robijnvogel I started a prototype of such a stable hash function that you can use here: magneticflux-/fabric-mumblelink-mod@3866317 I checked that the three vanilla worlds all result in different values mod 2048. I also chose 2048 so that there would be at least 4 bits of intra-block precision since 32-bit floats have 24 bits of precision. ( |
I'm releasing a 1.18 version of my mod soon, so my proposed world ID hash will become harder to change. I don't plan on backporting to any other versions unless requested, so you're safe to just update directly to 1.18. |
@magneticflux- can you please explain to me what an example value of I cannot relate this to anything other than Also note that for me there exists |
// Make people in other dimensions far away so that they're muted. val yAxisAdjuster = (world.registryKey.value.stableHash % 2048) * config.clientDimensionYAxisAdjust camPos[1] += yAxisAdjuster /** * A stable hash function designed for world IDs. * Different clients should be able to run this on the same world ID and get the same result. * * Based on the `djb2` hash function: [Hash Functions](http://www.cse.yorku.ca/~oz/hash.html) */ val Identifier.stableHash: Int get() { var hash = 5381 for (c in this.toString()) { hash += (hash shl 5) + c.code } return hash } fixes #35
replaced by #63 |
hello I would like to know if you plan to update Mumble Link for Macs which has a version above 10.13 soon ? |
Added distribution of different dimensions over positional audio height range.