Stardew Valley
0 of 0

File information

Last updated

Original upload

Created by

spajus

Uploaded by

spajus

Virus scan

Safe to use

About this mod

Fix the load times / freezes of Stardew Valley when multiple large extension mods are used.

Requirements
Permissions and credits
Changelogs
Donations
Warning: This mod is incompatible with SpriteMaster, which modifies the same core StardewValley code that has the performance bottleneck. You have to use either SpriteMaster or this mod, but not both.

How It Works: This mod patches a couple of very inefficient methods in Stardew Valley core. These methods were accounting for more than a half of total game load time. The methods are used to generate NPC routes, so the more NPCs you'd have, the slower the game would load. This mod builds an efficient cache by hashing all routes, then patches the route rebuild logic to use the cache. This performance issue seems to be fixed in Stardew Valley v1.6.

Twitter thread discussing the details of this mod: https://twitter.com/dev_spajus/status/1733122991943250182

How Did I Find This Bottleneck: I used Superluminal profiler to capture what modded Stardew Valley was doing and analyzed the data. If you make mods, games, or any kind of software, please use tools like this and take performance seriously, don't make the players suffer long wait times and don't waste electricity. Computers are extremely fast, and there is no excuse for loading times that take more than a few seconds! There are many more inefficiencies in modded Stardew Valley, and loading times could be brought down to a few seconds for most hardware, but unfortunately it won't be as easy as fixing two small methods like I did here, and each developer should do it individually in their own code.

What This Mod Does Not Do: It does not improve game boot time. It does not improve overall performance. It only affects start of new game, load of saved game, and certain screen to screen transitions that involve rebuilding NPC routes in the background.

Potential Side Effects: Depending on the number and type of mods you have, there is a low chance (less than 0.001%) for two NPC routes to have a hash collision in the cache. If that happens, some NPCs may get missing. There are built-in debugging options to ensure this does not happen, but you have to enable them through the configuration. See next section.

Configuration: You can enable "Detect Collisions" and "Abort On Collision" configuration options to ensure there are no missing NPC behaviors. The game could load slightly slower with collision detection on low-end hardware.

Source code: https://github.com/spajus/stardew-valley-fast-loads

Misc:
The game I'm working on full time: Stardeus - a sci-fi space colony simulator where you can also grow crops.