authorblues / bizhawk-shuffler-2

A script to randomly shuffle between games played in Bizhawk, with plugins to enhance the experience
MIT License
58 stars 21 forks source link

Slowdown in DS games only with Shuffler on #67

Closed lovelydumpling closed 1 year ago

lovelydumpling commented 1 year ago

Describe the bug Not sure if this is the right place to bring it up but I don't know where else to ask. DS games have a lot of stuttering, only when using the Shuffler. Running them in Bizhawk without the shuffler runs at full speed.

Environment (please complete the following information):

Additional context I have a Ryzen 2700X, RTX 3080, and 32 GB RAM. I'm not sure why I'd struggle to run this. Is there anything I can do? Encountering stuttering in Dawn of Sorrow and Portrait of Ruin.

Logs Please attach message.log and shuffler-src/config.lua. message.log Github doesn't support uploading lua. Here's a link from Discord.

kalimag commented 1 year ago

You don't have any plugins enabled, so the shuffler shouldn't cause a significant performance hit beyond what Lua in general has.

  1. Without the shuffler running and with the Lua console closed, how many FPS do you get while turboing (Shift+Tab by default)

  2. Open the Lua console without loading the shuffler, and create and enable a new default script (Ctrl+N). How many FPS do you get?

  3. Close the shuffler, and edit the shuffler-src/config.lua in a text editor and replace the line ["output_timers"] = true, with ["output_timers"] = false,. Then resume the shuffler session. Does that make any difference?

  4. This shouldn't exclusively affect the shuffler, but does disabling rewind make a difference (Config -> Rewind & States)?

lovelydumpling commented 1 year ago

Ooooh, we hold shift tab for turbo. I was having a hard time doing this at first because I couldn't figure out why turbo wasn't doing anything lol.

  1. On average, I get 95 FPS while turboing without shuffler/lua console.
  2. With a new default script enabled, it ranges from around 85 - 90 fps jumping around the same room. I have the same framerate when running the shuffler still on the setup screen, before resuming or beginning a session. With a session running, it's unstable running anywhere from 40 - 55 fps, and audio hitches as a result.
  3. Changing output_timers does make a difference. It is a stable 60fps again, and turbos to 68 - 70 FPS.
  4. Disabling rewind makes no difference.

EDIT: When streaming on Discord, even with output_timers off it's down to about 50 FPS and stutters again. Stopping the stream and its around 58fps with audio stuttering and won't go higher, in the same room I tested before :(

kalimag commented 1 year ago

Curious that writing the timer files would make such a big difference in your case. Well, I can add that option to the setup screen.

Other than that, I have no idea what the issue might be. The shuffler script doesn't really do much until it's time for a swap.

I'll see about optimizing a few things in the main loop, but I'd be surprised if it made a measurable difference.

kalimag commented 1 year ago

I added an option to turn off the timers or all output files, and made another minor change to the main loop. Unfortunately I think that's all I can do here. I can't reproduce the slowdown, and the shuffler script isn't doing anything else except checking the hotkey and updating some counters while waiting for the swap timer.

lovelydumpling commented 1 year ago

Yeah unfortunately still can't run the games at full speed with the shuffler on. It is wild that a whopping 30 FPS is lost from the shuffler being on for some reason. Oh well, I appreciate the effort in trying to help.