Jump to content

Game freeze followed by gas render reset on timelapse screenshot


Herbungo
  • Branch: Live Branch Version: Windows Pending

Whenever the game takes the snapshot of the asteroid for the Timelapse of the base in the colony summary, the game freezes for a moment, followed by the gasses being re rendered. The pause is non existent in the first 10 cycles normally, but becomes very apparent when multiple asteroids are discovered and more of the map is revealed.

 

The attached gif, although blurry, shows the screenshots being logged to the console at the same time the render reset happens.

ONITimelapseBug.gif

DxDiag.txt


Steps to Reproduce

1. Make any colony in Spaced Out DLC

2.Discover another asteroid / majority of starting asteroid

3. Wait for the game to take a snapshot of the colony to save for the colony timelapse

  • Like 1



User Feedback


there is 3 commands what causes this

texture2D.ReadPixels(new Rect(0f, 0f, (float)renderTex.width, (float)renderTex.height), 0, 0);
byte[] bytes = texture2D.EncodeToPNG();
File.WriteAllBytes(text4, bytes);

first two comes at unity self

soo we can blame them

last one is c# self

that is  mostikley possibe add to the thread. i not know yet about those 2 unity ones

the whole WriteToPng functon may take over 200 milisec. that is enoh for see the game freeze

---

soo i made some tests

everything at inside WriteToPng  after the command

UnityEngine.Object.Destroy(texture2D);

is possible add to the thread without crashing the game

that does decrease the freeze time allot.

 

Edited by gabberworld

Share this comment


Link to comment
Share on other sites

ok i made more tests

seems like

            byte[] bytes = texture2D.EncodeToPNG();
            UnityEngine.Object.Destroy(texture2D);

is possible add thread as well

now doing that it removes the most freeze

because only by toning that you remove over 100 miliseg freeze at main thread what is used by unity game self

 

ReadPixels not possibe add. i try that as well but it crashes

those tests are done directly inside game dll. i not see why i should make mod when its game code fault

 

i think there is also possible somehow write custom ReadPixels i read at unity forum that they originally use the glReadPixels and some other functions

 

Edited by gabberworld

Share this comment


Link to comment
Share on other sites

soo. i minimize the WriteToPng  to very low time.  but then i i found there is another "ReadPixels"

JUST TORLLORORORLLLLLL

that sits inside "IEnumerator Render()"

that is another 200 mil-sec time loss

i not even know how to fix this "IEnumerator Render()" atm by make mod because they are freaking private command stuff

 

Edited by gabberworld

Share this comment


Link to comment
Share on other sites

anyway as you now use the Unity 2020

you can fix those ReadPixels with command called AsyncGPUReadback.Request

this is good example how use them instead off the ReadPixels

https://light11.hatenadiary.com/entry/2021/01/18/203431

also if scroll back in history then this command not existed at kind off very old Unity Engines soo its understandable why it still not fixed

 

Edited by gabberworld

Share this comment


Link to comment
Share on other sites

if talk about the "AsyncGPUReadback.Request"  then it little act like Thread as it not have code pause in main thread soo you to need also change some IEnumerator Render() functions

this stuff is affected also when game does autosaves. you decrease allot freeze time both off them when you change them correctly

 

Edited by gabberworld

Share this comment


Link to comment
Share on other sites

ah yeah . i posted that also in other thread but

also add the "File.WriteAllBytes" to inside Try catch command . i to seen before that code may crash at time when it saves file to hdd

i not even talk about only your code, but my own app back off old days todo that when i saved file to hdd

Edited by gabberworld

Share this comment


Link to comment
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...