Hi all,
I'm trying to bulletproof the existing code for Sonic so I can tour it on a few more shows. A lot of people have told me they are sad they never got a chance to play. I have a problem that I think I'm on the right track to fixing but I've run out of ideas on how to implement the solution.
Basically, if I load too many assets (over 1000), the mc will freeze and crash. This currently happens at startup because I am preloading all assets. I've had nothing but problems with game performance when trying to load things on_demand and I have certain assets I can't load on demand due to the custom asset manager I'm using. I have a crazy fast m.2 SSD and I've been down that road before. I just want to preload everything and not worry. Anyways, if I remove 30 or so files from loading it stops breaking. File size doesn't matter, only count. I'd just find a way to trim 30 or so files out, but I want to add more. Ive done research and found that 1024 is a common limit on the number of open files an application can access at the os level and that seems to be the issue I'm running into. There is an old post about this being an issue on linux here:
Apparently in Linux this is an easy fix, but is somewhat more complicated in windows. A stack overflow post appears to detail the equivalent setting as win32file._setmaxstdio (image attached) Ive tried adding this to mc.py along with the proper import, and while it didn't crash anything it didn't help either. I've reached the end of my ability to troubleshoot and implement the fix I may have found as I'm just not a software guy even though I pretend to be sometimes.