MrJake222 / AUNIS

Stargate-inspired Minecraft Mod
GNU General Public License v3.0
44 stars 20 forks source link

Dedicated server - Stargate-spin lagging #172

Open TheRedCreations opened 4 years ago

TheRedCreations commented 4 years ago

The Uni-gate is lagging while spin https://youtu.be/Jpvc6qGgsNI I aborted the dial befor Chevron 1 locks

ShicKla commented 4 years ago

Is the video taking place before or after the abort?

TheRedCreations commented 4 years ago

I started dialling and aborted before chevron 1 locked

NovaXeros commented 4 years ago

Could you please confirm if the inner ring of the Milky Way gate lags whilst spinning on the same server?

I've been noticing the inner ring of mine lagging as well and wondering if it's related before I start trying to ascertain why it may be happening.

TheRedCreations commented 4 years ago

i'm not able to confirm milky inner ring lag. we have no oc

NovaXeros commented 4 years ago

That's fair, if you don't have the ability to spawn one in etc.

Are you the server admin? Could you give me a list of the mods on your server?

TheRedCreations commented 4 years ago

grafik I have a milkyway gate but no computer to let the ring spin.

MarcCrams commented 4 years ago

I confirm for the Milky Way gate.

NovaXeros commented 4 years ago

Thanks.

I've observed the same behaviour on my dedicated server too. It doesn't appear to be related to network lag as the dedicated server is local to me and my players connect via internet, yet we all observe the same ring lag.

I suspect that this is related to some kind of helper in which the server is ensuring that the ring is spinning in sync on the server and all players observing, but is being slowed by a reduced tick rate of the server due to overloading/demand/etc.

I've not looked too much into the dialling animation code so far so not sure if there's anything I'll be able to suggest, but hopefully someone more knowledgable than I in Java/forge can use this to come up with a solution before I do?

MrJake222 commented 4 years ago

I'm unable to replicate the issue with Universe Dialer and the UN gate on a locally-hosted dedicated server. I'm using only Aunis+OC(and required dependencies). It's perfectly smooth. Can you replicate it with minimal mods required?

NovaXeros commented 4 years ago

I imagine removing mods will reduce the issue, but not because of the individual mods per se, but because less mods = less server load.

Very few of the mods listed by @RedstoneSucht are used on my server, and yet I'm experiencing similar issues for both Universe and Milky Way gates. I note that the animation for the transport rings isn't choppy, however, so I'm wondering if the rotation render of the stargates is somehow linked to ticks, and it's the reduced tickrate from a heavily worked server that is causing this slow-down.

Is it possible to entirely decouple the stargate rotational render from anything server-related, make it all client side only, then it will be the individual user's PC speed that determines how "smooth" the render occurs?

Presumably the server "guides" every player's rotation render to ensure everyone completes the dial at the same pace to avoid someone with a faster PC getting ahead in the dialling sequence from everyone else, but would it not be possible to have the server simply tell people when a chevron is locked, as opposed to slowing everyone's render down?

EDIT: On review of the code, it doesn't appear that the rendering of the gate is actually guided by server code. It's handled by the tickrate on the client's end which appears to be being slowed for one reason or another. Linking the animation with ticks probably needs review, if there's even an alternative.

Going to experiment with milliseconds instead of ticks.

MrJake222 commented 4 years ago

The spinning is done entirely client side. The server only gets a finished signal (The spin time is calculated at the beginning of the spin and a task is set to fire after that time). Spinning only uses world.getTotalWorldTime()(ticks since the creation of the world) and partialTicks.

Can one of you provide me with your modpack? Is it reproducible with just this mods and a new world, no fancy testing setup required? Or I need 100 players to lower the tickrate of the server? But this should cause some flickering or so, not straight up chopping.

NovaXeros commented 4 years ago

Yeah, I stepped through the code yesterday and saw that it's all clientside. I checked the tickrate for our server and it came out as a very disappointing 4t/s, so if the animation is tied to the ticks then what we're seeing is 1/5 animation speed, hence the choppiness.

Unfortunately, giving you the modpack won't do it as the animations were incredibly smooth on this modpack until my players explored and increased the world size and complexity, causing my server to slow down.

The only thing I could suggest is either sending you our custom modpack and world file (7.5gb uncompressed) to see if it also slows your machine down enough to test, or whitelisting you on our server so you can witness it yourself.

MrJake222 commented 4 years ago

Whitelisting is not the solution here. I need a reliable dev environment :/

NovaXeros commented 4 years ago

So, I upgraded our server machine yesterday and with some careful profiling and tweaking, we now have our server running at 20 ticks per second.

The gate, however, continues to lag as it spins.

If I make our customised modpack and our world available for you to download, will that help you diagnose this issue? I was certain it was linked to the tickrate of the servers but when the issue wasn't resolved once the tickrate was restored, that theory has been heavily damaged.

LokeYourC3PH commented 4 years ago

I can contribute to this as well I guess, having the same issue. However, I think the issue comes from the ping in my case, I have a constant 20 TPS on my server, but the ping to the server I play on is about 180ms (because I need to host it in Singapore since I am in South Korea and my friends in Germany and the US, so Singapore was the best location). So in my case it seems to be the ping that is the issue.

MrJake222 commented 4 years ago

But @NovaXeros said that they have their problematic server locally :/

NovaXeros commented 4 years ago

But @NovaXeros said that they have their problematic server locally :/

Yeah can't be ping related unless it's affected by any ping higher than the effective 0ms of the server running on the same machine as the client - my dedicated server is hosted on my own personal network, literally 2 meters away from my personal computer and served on the same 1gb switch. My ping is consistently negligible.

@MrJake222 do you want our world and modpack to see if you can emulate our setup and replicate the issue?

MrJake222 commented 4 years ago

I could try I guess, upload it ;)

LokeYourC3PH commented 4 years ago

Since @NovaXeros doesn't seem to bother uploading his pack, I will upload you mine @MrJake222 . My Universe Gate is located at these coordinates: -10646 17 19485 You can dial the Nether Gate, the issue seems to appear Dialling that one (check the PC with the Dialling Program next to the Gate).

Client pack is also included, but since you can mod Minecraft I am sure you know how to install both client and server yourself.

Here the download link: https://mega.nz/file/txd3RYqC#veDrakFyP6om_0v8hRkuitCb8JZjIds0MH4u6jmcWuc

NovaXeros commented 4 years ago

@LokeYourLord @MrJake222 apologies, I have been incredibly busy with personal life matters so I haven't had chance to upload my pack.

If I get chance later today I'll upload so that @MrJake222 has a couple of packs to compare and ensure he's looking at the same issue.

MrJake222 commented 4 years ago

Hey I've got maybe not the same issue, but similar, on my survival world. The gate didn't go straight into chopping mode but started lagging. Like animation got down to 20fps. I think this is related to the world total time in ticks got too large for floats to handle and I should switch to doubles. It already fixed one of the DHD's issues near the world's border. Maybe your world times are much higher than mine and it results in sth like this. I'll investigate, I hope your pack @LokeYourLord contains a world save also.

TheRedCreations commented 4 years ago

i looked quickly through the zip file. he put in the zip a client and a server folder there is an world included

LokeYourC3PH commented 4 years ago

Yes server includes the world save as well, that's why I mentioned the coordinates of the Universe Gate.

NovaXeros commented 4 years ago

https://mega.nz/file/mX5xFBya#WPlG3ffrFDsOhx7ykmr3sqAnSKgso6pO82GidbkIqvM

Additional Server+Client file here.

Be warned, the server part is over 3gb big after compression as the players on my server are absolute monsters and love exploring.

Go North from the worldspawn point to find our first house. Computer inside is linked to the gate via a program aptly named dial.lua.

Gate there spins slowly as per this issue. The gate in the End is a universe gate for testing that too.

LokeYourC3PH commented 3 years ago

Any update on this @MrJake222 ? Has this been fixed by itself when you did some updates to the mod, or is it still an existing issue?