thorwin99 / SEWorldGenPlugin

A world generation plugin for space engineers
36 stars 8 forks source link

Game freezes at around 20 minutes in any save, no issues in log tho #147

Closed anthoam closed 1 year ago

anthoam commented 1 year ago

When the SEWorldGenPlugin is enabled in my save, after 20 minutes ingame whatever I am doing the game freezes and doesn't respond anymore. But I can still see particles effects and grass moving for example...

In this save, I'm using the "Khurakan System" which has files expected to be used with this plugin. This is the last thing in my log. Seems to be related to asteroid generation but I don't see any error here.

2023-02-25 22:19:43.339 - Thread: 1 -> SEWorldGenPlugin - INFO Asteroid object manager saving 2023-02-25 22:19:43.339 - Thread: 1 -> SEWorldGenPlugin - INFO Saving asteroid provider AsteroidHollowSphere 2023-02-25 22:19:43.339 - Thread: 1 -> SEWorldGenPlugin - INFO Server: Saving asteroid objects. 2023-02-25 22:19:43.340 - Thread: 1 -> SEWorldGenPlugin - INFO Server: Asteroid objects saved for provider AsteroidHollowSphere 2023-02-25 22:19:43.340 - Thread: 1 -> SEWorldGenPlugin - INFO Saving asteroid provider AsteroidRing 2023-02-25 22:19:43.340 - Thread: 1 -> SEWorldGenPlugin - INFO Server: Saving asteroid objects. 2023-02-25 22:19:43.342 - Thread: 1 -> SEWorldGenPlugin - INFO Server: Asteroid objects saved for provider AsteroidRing 2023-02-25 22:19:43.342 - Thread: 1 -> SEWorldGenPlugin - INFO Saving asteroid provider AsteroidCluster 2023-02-25 22:19:43.342 - Thread: 1 -> SEWorldGenPlugin - INFO Server: Saving asteroid objects. 2023-02-25 22:19:43.344 - Thread: 1 -> SEWorldGenPlugin - INFO Server: Asteroid objects saved for provider AsteroidCluster 2023-02-25 22:19:43.344 - Thread: 1 -> SEWorldGenPlugin - INFO Asteroid object manager saving complete 2023-02-25 22:19:43.344 - Thread: 1 -> SEWorldGenPlugin - INFO Saving GPS manager data 2023-02-25 22:19:43.345 - Thread: 1 -> SEWorldGenPlugin - INFO Saving GPS manager data completed 2023-02-25 22:19:43.346 - Thread: 1 -> SEWorldGenPlugin - INFO Saving system data 2023-02-25 22:19:43.347 - Thread: 1 -> Directory cleanup: GC Memory: 3,774 B 2023-02-25 22:19:43.347 - Thread: 1 -> Saving world - END 2023-02-25 22:19:43.348 - Thread: 11 -> Session snapshot save - START 2023-02-25 22:19:43.348 - Thread: 11 -> Checking file access for files in target dir. 2023-02-25 22:19:43.944 - Thread: 1 -> GUI Stats: Update 0.127126388888889, Draw 0.589172444444446 2023-02-25 22:19:48.843 - Thread: 11 -> Saving Sandbox world configuration file C:\Users\main\AppData\Roaming\SpaceEngineers\Saves\*USERID*\The Khurakan System\.new\Sandbox_config.sbc 2023-02-25 22:19:49.697 - Thread: 11 -> Session snapshot save - END 2023-02-25 22:19:52.826 - Thread: 11 -> MySteamWorkshop.GetSubscribedModsBlocking - START 2023-02-25 22:19:55.085 - Thread: 1 -> Query successful. 2023-02-25 22:19:55.085 - Thread: 11 -> ModIo: Authentication started 2023-02-25 22:19:55.349 - Thread: 1 -> Query successful. 2023-02-25 22:19:55.349 - Thread: 11 -> MySteamWorkshop.GetSubscribedModsBlocking - END 2023-02-25 22:20:09.240 - Thread: 1 -> MyGuiBlueprintScreen_Reworked MyGuiScreenBase.UnloadContent - START 2023-02-25 22:20:09.240 - Thread: 1 -> MyGuiBlueprintScreen_Reworked MyGuiScreenBase.UnloadContent - END 2023-02-25 22:20:13.259 - Thread: 1 -> GC Memory: 4425.26 / 4425.26 MB 2023-02-25 22:20:14.359 - Thread: 1 -> GUI Stats: Update 1.39364311111111, Draw 0.77339738888889 2023-02-25 22:20:19.352 - Thread: 1 -> STATISTICS LEGEND,time,ReceivedPerSecond,SentPerSecond,PeakReceivedPerSecond,PeakSentPerSecond,OverallReceived,OverallSent,CPULoadSmooth,ThreadLoadSmooth,GetOnlinePlayerCount,Ping,GCMemoryUsed,ProcessMemory,PCUBuilt,PCU,GridsCount,RenderCPULoadSmooth,RenderGPULoadSmooth,HardwareCPULoad,HardwareAvailableMemory,FrameTime,LowSimQuality,FrameTimeLimit,FrameTimeCPU,FrameTimeGPU,CPULoadLimit,TrackedMemory,GCMemoryAllocated,PersistedEncounters,EncounterEntities 2023-02-25 22:20:19.362 - Thread: 1 -> STATISTICS,1680.46666671323,0,0,0,0,0,0,48.88715,39.42409,1,0,4505.974,15473.14,202451,433592,81,56.12016,39.70134,0.1776319,21175,8.332252,0,16.66667,4.676073,3.308015,100,9047038335,4505.974,0,0 2023-02-25 22:20:19.362 - Thread: 1 -> MEMORY LEGEND,Srv,Uav,Read,Debug,Index,Audio,SrvUav,Vertex,Buffers,Physics,Planets,Systems,Textures,Indirect,Constant,RwTextures,Dx11Render,MeshBuffers,FileTextures,DepthStencil,TileTextures,Voxels-Native,CustomTextures,HeightmapFaces,Mesh GPU Buffers,BitStreamBuffers,GeneratedTextures,FileArrayTextures,NativeDictionaries,CubemapDataBuffers,HeightDetailTexture,MyDeviceWriteBuffers,ShadowCascadesStatsBuffers,AI_PathFinding,EpicOnlineServices,EpicOnlineServicesWrapper 2023-02-25 22:20:19.362 - Thread: 1 -> MEMORY VALUES,1,1,0,1,62,1069,56,298,492,474,1229,8627,4544,0,0,197,5037,0,3641,28,0,48,28,490,40,0,0,649,768,728,10,30,0,0,0,0

thorwin99 commented 1 year ago

Will look into it. Where in the Khurakan were youw hen it freezed?

anthoam commented 1 year ago

Most of the time I was on planet called Celaeno, but the freeze happen anywhere in the system, on planets as well inside asteroid clusters created by the plugin.

thorwin99 commented 1 year ago

Regarding the log, that is a session save, but that goes through and didnt freeze

anthoam commented 1 year ago

Yeah that's really weird, I can reproduce the freeze all the time but I don't know how I can provide you the best informations regarding this bug...

thorwin99 commented 1 year ago

Is your RAM full when the freeze happens? I know Khurakan requires SEWorldgen for asteroids, but did you try to copy your world, disable the plugin in the copy and try if it still crashes?

thorwin99 commented 1 year ago

Okay, i just got the freeze myself

thorwin99 commented 1 year ago

And i found the reason for the freeze. The patch that generates asteroids while jumping also affects contract generation, where the SE code is badly written and goes into an infinite loop for some reason. Just need to fix that

thorwin99 commented 1 year ago

Its an SE bug, In MyContractTypeRapairStrategy, in GenerateContract, it tries to generate a contract within a sphere around the station. For that, it overlaps all asteroid seeds in a sphere, which means it tries to get all asteroids within the sphere mentioned above. However, since this contract tries to generate within the Lost_Hope_Cluster, there will always be asteroids in there. The code assumes some cell must not have any asteroid in it. But that's not the case, since the plugin generates asteroids there. So, the SE code now infinitely tries to find a cell where no asteroid is in, within the asteroid cluster.

This is not a problem i can solve currently, as my asteroid generator works as expected. However, you can try to either remove the cluster that creates the problem, or disable patching, or the long way, to create a bug report on Keens support site, as it is a bit weird that the contract generator can run into an infinite loop.

anthoam commented 1 year ago

Ok I might just try to remove the cluster the time being. Is there any reason I should let patching enabled ? What are the advantages when using the plugin ?

thorwin99 commented 1 year ago

The plugin works without patching, but it fixes some bugs with the plugin and SE that cannot be fixed without modifying SE code. In this case, a patch to fix jumpdrive jumping into asteroid fields, where you might end up within an asteroid. With patching enabled, the plugin will give SE all locations of the asteroids, so it can avoid then when jumping. The same method, however, is used when creating a contract. The contract creation doesnt abort though and tries to brute force a location for the contract, even if there is none. In that case, the loop runs infinite.

anthoam commented 1 year ago

Ok I understand everything. Thank you for all the answers.

thorwin99 commented 1 year ago

Actually, i might just have found out the fix, if everything works out i will publish an update tomorrow.

thorwin99 commented 1 year ago

There was a bug in the plugin, where it returned all asteroids of the cell that overlapped the contract area, instead of the asteroids within the contract area. This might fix the issue.

thorwin99 commented 1 year ago

The fix is live on the github, pluginhub still needs to approve it

anthoam commented 1 year ago

Oh great ! I'll give it a try then.

anthoam commented 1 year ago

I played for a bit more than 20 minutes and no freeze so far. Thanks for everything !

thorwin99 commented 1 year ago

I will close the issue for now