qouteall / ImmersivePortalsModForForge

Apache License 2.0
53 stars 21 forks source link

Enhancement: Animation when the portal is opening to give the game time to load so you dont lag spike #298

Open Mr-Syntax opened 2 years ago

Mr-Syntax commented 2 years ago

my idea is that everytime you open a portal it could display some cool effect instead that has atleast 10sec animation time, then the dimension can load in the background and have a little lowered priority so it doesent lag spike you evertime you open a portal

it could also be nice to be able to reverse it with some item so you can turn off the portal again or just leave it with some idle animation and then push a button to make it open again

another idea ive had is that, you could have only the 3 nearest chunks to the portal load, and the chunks around that are just place holders of some sort like really low LOD and no entities untill you travel through, or atleast freeze their AI or something..

anyway thanks for the mod, built my whole pack around it cause i think the effect is damn cool :D

Mr-Syntax commented 2 years ago

https://www.curseforge.com/minecraft/modpacks/chosencraft

qouteall commented 2 years ago
  1. Some people have good PC and they probably not want it to delay 10 seconds
  2. A dispenser with water bucket can turn off the nether portal and a dispenser with fireball can turn on the nether portal. the portal can also be managed by commands.
  3. You can change "indirectLoadingRadiusCap" in the config (by editing the config file) so that it will limit the loading range through portal

About lag spike: last time I tried to optimize the lag spike and profiled that sometimes the lag spike comes from client light update. You can try to install phosphor and see whether the lag spike reduces (compatibility issues may occur).

Mr-Syntax commented 2 years ago

1: okay but maybe it could be for like servers and low end machines, a configurable option for if you want animation or not, and how long the animation should take. then if you could put a small comment next to the option that explains that the longer you allow the animation to run the smaller the chance of a lag spike.

2: ahh okay i did not know that, maybe if you could just place a button on the portal and it could turn it on and off? would be a little more intuitive i think

3: i did actually all ready and it definently helped with the lag but there is still one large spike when you open it

i have optifine G7 and performant and a bunch of other mods in the pack, tried to install roadrunner but its incompatible at the moment.

qouteall commented 2 years ago

I don't know which thing causes the lag spike that you encoutered. If the lag spike is caused by GC then delay loading won't work. There is a hardcoded value in this mod that controls how fast the server sends chunk data to client and I am going to make it configuable

Mr-Syntax commented 2 years ago

well im pretty certain the lag spike happens when you open the portal because of it having to load so many chunks that fast on the other side of the portal. thats why i thought of the animation so this could be done slower and partioned so it doesent lag. the reason i suspect this is because when i had the "indirect_loading_radius_cap" set to 8 it was a crazy lag spike which made me have 0,5 fps for 20 sec but now when its set to 3 its just 1 big 2 sec spike.

and then when you fly far enough away from the portal and it has to unload it, it gives you one more of those big lag spikes

i recently found out farsight was contributing to this, i have no clue why but im gonna try to do some testing later on to 100% confirm this, but since i removed it i only get the first spike when i open the first portal on a map but the second time i did it there was only lowered fps no spike which was a first since having that installed.

qouteall commented 2 years ago

"farsight" is a mod? Are you sure that "farsight" makes the lag spike more severe? Then please make another issue.

Mr-Syntax commented 2 years ago

it still occurs even without farsight, and i cannot confirm that it made it worse, but im pretty certain it has a memory leak cause it would cause builds up which would lead to horrible stuttering untill you restart the game

ive just had something similiar with immersive, tho its been a while since ive seen this bug. i just added "Get it together Drops" all tho i hardly think it has something to do with that i flew on the nether roof in spectator to let the mod "falling through" teleport me to the overworld by going into survival then i had a huge spike and when it finally loaded the overworld it keeps lagging permanently with full world stop for 1 sec then 1 sec gameplay and it just keeps looping like this

i have this fatal crash from the console, but since it doesent crash in the game oddly enough it doesent give me a real crash report sorry :-/

Error executing task on Client java.lang.IllegalStateException: Creating Client World ResourceKey[minecraft:dimension / minecraft:the_nether] [ResourceKey[minecraft:dimension / minecraft:overworld]] at com.qouteall.immersive_portals.ClientWorldLoader.createSecondaryClientWorld(ClientWorldLoader.java:294) at com.qouteall.immersive_portals.ClientWorldLoader.getWorld(ClientWorldLoader.java:198) at com.qouteall.immersive_portals.network.CommonNetworkClient.lambda$processRedirectedPacket$0(CommonNetworkClient.java:44) at com.qouteall.immersive_portals.network.CommonNetworkClient$$Lambda$44665/984047754.run(Unknown Source) at com.qouteall.immersive_portals.CHelper.executeOnRenderThread(CHelper.java:152) at com.qouteall.immersive_portals.network.CommonNetworkClient.processRedirectedPacket(CommonNetworkClient.java:53) at com.qouteall.hiding_in_the_bushes.network.StcRedirected.doProcessRedirectedPacket(StcRedirected.java:55) at com.qouteall.hiding_in_the_bushes.network.StcRedirected.lambda$handle$0(StcRedirected.java:77) at com.qouteall.hiding_in_the_bushes.network.StcRedirected$$Lambda$44664/1994055281.run(Unknown Source) at net.minecraftforge.fml.network.NetworkEvent$Context.enqueueWork(NetworkEvent.java:215) at com.qouteall.hiding_in_the_bushes.network.StcRedirected.handle(StcRedirected.java:77) at com.qouteall.hiding_in_the_bushes.network.NetworkMain$$Lambda$34334/325250044.accept(Unknown Source) at net.minecraftforge.fml.network.simple.IndexedMessageCodec.lambda$tryDecode$3(IndexedMessageCodec.java:128) at net.minecraftforge.fml.network.simple.IndexedMessageCodec$$Lambda$43377/1360480782.accept(Unknown Source) at java.util.Optional.ifPresent(Optional.java:159) at net.minecraftforge.fml.network.simple.IndexedMessageCodec.tryDecode(IndexedMessageCodec.java:128) at net.minecraftforge.fml.network.simple.IndexedMessageCodec.consume(IndexedMessageCodec.java:162) at net.minecraftforge.fml.network.simple.SimpleChannel.networkEventListener(SimpleChannel.java:80) at net.minecraftforge.fml.network.simple.SimpleChannel$$Lambda$2537/571813280.accept(Unknown Source) at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:247) at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:239) at net.minecraftforge.eventbus.EventBus$$Lambda$2539/755934121.invoke(Unknown Source) at net.minecraftforge.eventbus.EventBus$$Lambda$2129/392519018.invoke(Unknown Source) at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) at net.minecraftforge.fml.network.NetworkInstance.dispatch(NetworkInstance.java:86) at net.minecraftforge.fml.network.NetworkHooks.lambda$onCustomPayload$1(NetworkHooks.java:91) at net.minecraftforge.fml.network.NetworkHooks$$Lambda$43365/730969032.apply(Unknown Source) at java.util.Optional.map(Optional.java:215) at net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(NetworkHooks.java:91) at net.minecraft.client.network.play.ClientPlayNetHandler.func_147240_a(ClientPlayNetHandler.java:1904) at net.minecraft.network.play.server.SCustomPayloadPlayPacket.func_148833_a(SCustomPayloadPlayPacket.java:59) at net.minecraft.network.play.server.SCustomPayloadPlayPacket.func_148833_a(SCustomPayloadPlayPacket.java:11) at net.minecraft.network.PacketThreadUtil.lambda$checkThreadAndEnqueue$0(PacketThreadUtil.java:34) at net.minecraft.network.PacketThreadUtil$$Lambda$43625/29945045.run(Unknown Source) at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213166_h(ThreadTaskExecutor.java:191) at net.minecraft.util.concurrent.RecursiveEventLoop.func_213166_h(SourceFile:23) at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213168_p(ThreadTaskExecutor.java:153) at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213160_bf(ThreadTaskExecutor.java:130) at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:947) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:607) at net.minecraft.client.main.Main.main(Main.java:184) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:51) at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$492/1900447251.call(Unknown Source) at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) Caused by: java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901) at java.util.ArrayList$Itr.next(ArrayList.java:851) at com.mojang.serialization.codecs.ListCodec.encode(ListCodec.java:30) at com.mojang.serialization.codecs.ListCodec.encode(ListCodec.java:19) at com.mojang.serialization.Encoder$1.encode(Encoder.java:25) at com.mojang.serialization.Codec$2.encode(Codec.java:76) at com.mojang.serialization.Encoder$1.encode(Encoder.java:25) at com.mojang.serialization.Codec$2.encode(Codec.java:76) at com.mojang.serialization.Encoder.encodeStart(Encoder.java:14) at com.mojang.serialization.codecs.FieldEncoder.encode(FieldEncoder.java:24) at com.mojang.serialization.MapCodec$1.encode(MapCodec.java:39) at com.mojang.serialization.codecs.KeyDispatchCodec.encode(KeyDispatchCodec.java:92) at com.mojang.serialization.MapCodec$MapCodecCodec.encode(MapCodec.java:96) at com.mojang.serialization.Encoder.encodeStart(Encoder.java:14) at com.mojang.serialization.codecs.FieldEncoder.encode(FieldEncoder.java:24) at com.mojang.serialization.MapCodec$1.encode(MapCodec.java:39) at com.mojang.serialization.codecs.RecordCodecBuilder$Instance$6.encode(RecordCodecBuilder.java:295) at com.mojang.serialization.codecs.RecordCodecBuilder$Instance$6.encode(RecordCodecBuilder.java:298) at com.mojang.serialization.codecs.RecordCodecBuilder$Instance$9.encode(RecordCodecBuilder.java:443) at com.mojang.serialization.codecs.RecordCodecBuilder$Instance$6.encode(RecordCodecBuilder.java:298) at com.mojang.serialization.codecs.RecordCodecBuilder$Instance$6.encode(RecordCodecBuilder.java:298) at com.mojang.serialization.codecs.RecordCodecBuilder$2.encode(RecordCodecBuilder.java:112) at com.mojang.serialization.MapCodec$MapCodecCodec.encode(MapCodec.java:96) at com.mojang.serialization.Codec$1.encode(Codec.java:40) at com.mojang.serialization.Encoder.encodeStart(Encoder.java:14) at com.mojang.serialization.codecs.FieldEncoder.encode(FieldEncoder.java:24) at com.mojang.serialization.MapCodec$1.encode(MapCodec.java:39) at com.mojang.serialization.MapEncoder$1.encode(MapEncoder.java:26) at com.mojang.serialization.MapCodec$1.encode(MapCodec.java:39) at com.mojang.serialization.codecs.KeyDispatchCodec.encode(KeyDispatchCodec.java:92) at com.mojang.serialization.MapCodec$MapCodecCodec.encode(MapCodec.java:96) at net.minecraft.util.registry.RegistryKeyCodec.encode(SourceFile:44) at net.minecraft.util.registry.RegistryKeyCodec.encode(SourceFile:13) at com.mojang.serialization.Encoder.encodeStart(Encoder.java:14) at com.mojang.serialization.codecs.FieldEncoder.encode(FieldEncoder.java:24) at com.mojang.serialization.MapCodec$1.encode(MapCodec.java:39) at com.mojang.serialization.codecs.RecordCodecBuilder$Instance$4.encode(RecordCodecBuilder.java:222) at com.mojang.serialization.codecs.RecordCodecBuilder$2.encode(RecordCodecBuilder.java:112) at com.mojang.serialization.MapCodec$MapCodecCodec.encode(MapCodec.java:96) at com.mojang.serialization.Encoder.encodeStart(Encoder.java:14) at com.mojang.serialization.codecs.FieldEncoder.encode(FieldEncoder.java:24) at com.mojang.serialization.MapCodec$1.encode(MapCodec.java:39) at com.mojang.serialization.MapEncoder$1.encode(MapEncoder.java:26) at com.mojang.serialization.MapCodec$1.encode(MapCodec.java:39) at com.mojang.serialization.codecs.KeyDispatchCodec.encode(KeyDispatchCodec.java:92) at com.mojang.serialization.MapCodec$MapCodecCodec.encode(MapCodec.java:96) at net.minecraft.util.registry.RegistryKeyCodec.encode(SourceFile:44) at net.minecraft.util.registry.RegistryKeyCodec.encode(SourceFile:13) at com.mojang.serialization.Encoder.encodeStart(Encoder.java:14) at com.mojang.serialization.codecs.FieldEncoder.encode(FieldEncoder.java:24) at com.mojang.serialization.MapCodec$1.encode(MapCodec.java:39) at com.mojang.serialization.codecs.RecordCodecBuilder$Instance$4.encode(RecordCodecBuilder.java:222) at com.mojang.serialization.codecs.RecordCodecBuilder$2.encode(RecordCodecBuilder.java:112) at com.mojang.serialization.MapCodec$MapCodecCodec.encode(MapCodec.java:96) at com.mojang.serialization.Encoder.encodeStart(Encoder.java:14) at com.mojang.serialization.codecs.FieldEncoder.encode(FieldEncoder.java:24) at com.mojang.serialization.MapCodec$1.encode(MapCodec.java:39) at com.mojang.serialization.MapEncoder$1.encode(MapEncoder.java:26) at com.mojang.serialization.MapCodec$1.encode(MapCodec.java:39) at com.mojang.serialization.codecs.KeyDispatchCodec.encode(KeyDispatchCodec.java:92) at com.mojang.serialization.MapCodec$MapCodecCodec.encode(MapCodec.java:96) at net.minecraft.util.registry.RegistryKeyCodec.encode(SourceFile:44) at net.minecraft.util.registry.RegistryKeyCodec.encode(SourceFile:13) at com.mojang.serialization.Encoder.encodeStart(Encoder.java:14) at com.mojang.serialization.codecs.FieldEncoder.encode(FieldEncoder.java:24) at com.mojang.serialization.MapCodec$1.encode(MapCodec.java:39) at com.mojang.serialization.codecs.RecordCodecBuilder$Instance$4.encode(RecordCodecBuilder.java:222) at com.mojang.serialization.codecs.RecordCodecBuilder$2.encode(RecordCodecBuilder.java:112) at com.mojang.serialization.MapCodec$MapCodecCodec.encode(MapCodec.java:96) at com.mojang.serialization.Encoder.encodeStart(Encoder.java:14) at com.mojang.serialization.codecs.FieldEncoder.encode(FieldEncoder.java:24) at com.mojang.serialization.MapCodec$1.encode(MapCodec.java:39) at com.mojang.serialization.MapEncoder$1.encode(MapEncoder.java:26) at com.mojang.serialization.MapCodec$1.encode(MapCodec.java:39) at com.mojang.serialization.codecs.KeyDispatchCodec.encode(KeyDispatchCodec.java:92) at com.mojang.serialization.MapCodec$MapCodecCodec.encode(MapCodec.java:96) at vazkii.quark.base.world.WorldGenHandler.onBiomesLoaded(WorldGenHandler.java:161) at net.minecraftforge.eventbus.ASMEventHandler_5323_WorldGenHandler_onBiomesLoaded_BiomeLoadingEvent.invoke(.dynamic) at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) at net.minecraftforge.eventbus.EventBus$$Lambda$2129/392519018.invoke(Unknown Source) at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) at net.minecraftforge.common.ForgeHooks.enhanceBiome(ForgeHooks.java:945) at net.minecraft.world.biome.Biome.lambda$null$8(Biome.java:75) at net.minecraft.world.biome.Biome$$Lambda$1713/1416872116.apply(Unknown Source) at com.mojang.datafixers.util.Function8.lambda$null$6(Function8.java:22) at com.mojang.datafixers.util.Function8$$Lambda$38291/772493780.apply(Unknown Source) at com.mojang.datafixers.util.Function4.lambda$null$2(Function4.java:14) at com.mojang.datafixers.util.Function4$$Lambda$34593/1976809245.apply(Unknown Source) at com.mojang.serialization.DataResult$Instance.ap2(DataResult.java:315) at com.mojang.datafixers.kinds.Applicative.ap4(Applicative.java:84) at com.mojang.serialization.codecs.RecordCodecBuilder$Instance$7.decode(RecordCodecBuilder.java:404) at com.mojang.serialization.codecs.RecordCodecBuilder$2.decode(RecordCodecBuilder.java:107) at com.mojang.serialization.MapDecoder.lambda$compressedDecode$0(MapDecoder.java:52) at com.mojang.serialization.MapDecoder$$Lambda$23779/760643135.apply(Unknown Source) at com.mojang.serialization.DataResult.lambda$flatMap$10(DataResult.java:138) at com.mojang.serialization.DataResult$$Lambda$23780/952725774.apply(Unknown Source) at com.mojang.datafixers.util.Either$Left.map(Either.java:38) at com.mojang.serialization.DataResult.flatMap(DataResult.java:136) at com.mojang.serialization.MapDecoder.compressedDecode(MapDecoder.java:52) at com.mojang.serialization.MapCodec$MapCodecCodec.decode(MapCodec.java:91) at com.mojang.serialization.Decoder.parse(Decoder.java:18) at net.minecraft.util.registry.WorldSettingsImport$IResourceAccess$RegistryAccess.func_241879_a(WorldSettingsImport.java:236) at net.minecraft.util.registry.WorldSettingsImport.func_241805a(WorldSettingsImport.java:131) at net.minecraft.util.registry.WorldSettingsImport.func_240885a(WorldSettingsImport.java:105) at net.minecraft.util.registry.WorldSettingsImport$$Lambda$38286/947177651.apply(Unknown Source) at com.mojang.serialization.DataResult.lambda$flatMap$10(DataResult.java:138) at com.mojang.serialization.DataResult$$Lambda$23780/952725774.apply(Unknown Source) at com.mojang.datafixers.util.Either$Left.map(Either.java:38) at com.mojang.serialization.DataResult.flatMap(DataResult.java:136) at net.minecraft.util.registry.WorldSettingsImport.func_241797a(WorldSettingsImport.java:104) at net.minecraft.util.registry.DynamicRegistries.func_243610_a(DynamicRegistries.java:144) at net.minecraft.util.registry.DynamicRegistries.func_243608_a(DynamicRegistries.java:132) at net.minecraft.util.registry.WorldSettingsImport.func_244336_a(WorldSettingsImport.java:53) at net.minecraft.util.registry.DynamicRegistries.func_239770b(DynamicRegistries.java:85) at net.minecraft.client.network.play.ClientPlayNetHandler.(ClientPlayNetHandler.java:334) at com.qouteall.immersive_portals.ClientWorldLoader.createSecondaryClientWorld(ClientWorldLoader.java:254) ... 52 more