Daily Screenshot

Daily Screenshot

3.9k Downloads

Investigate cause of lag when exiting farm and taking screenshot

CompSciLauren opened this issue · 2 comments

commented

Is your feature request related to a problem? Please describe.
There has been mention of some significant lag when exiting the farm for the first time each day to take the screenshot. We need to figure out what's causing it so that we can improve it. We don't know if this impacts all systems and all users or only a subset.

Describe the solution you'd like
Look into any significant factors in this and document how it could be improved (comment on this Issue), and/or create a separate GitHub Issue explaining the changes needed specifically.

Describe alternatives you've considered
None.

Additional context
Just one tip, search Discord for "move DailyScreenshot's file moving stuff to a Task", was mentioned as a potential way to reduce lag.

commented

Wow, that writeup was super interesting to read! Thanks for sharing. I'm glad you were able to find ways to improve the speed! And love that you kept going haha. Very cool. I probably won't get to this one too soon, but hoping to a bit down the road and this is all great info to have. Appreciate it!

commented

Hi! So, unrelatedly, I did start taking a look into this (starting about three or so weeks ago?), and my general conclusions are as follows.

The game's screenshot method is just kinda slow, especially on high quality (scale = 1f) or on big maps. It got markedly worse after the move to monogame because monogame's implementation of Texture.GetData is pretty slow. (GetData on a 2048*2048 texture, for example, was usually around 30 ms).

What I ended up doing was, basically, re-implementing the game's screenshot function (and, actually, Texture.GetData as well, although I'm not convinced on the safety of that part, since it relies on internal implementation details in MonoGame). I did a writeup here: https://github.com/atravita-mods/StardewMods/tree/alpha/ScreenshotsMod#optimizations The low-hanging fruit was honestly most of it, I just kept going, haha.