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

Weighted shuffle #56

Open qadan opened 2 years ago

qadan commented 2 years ago

Adds a Random (Boost Unpicked) option to the list of swap modes. This fudges the randomness a bit such that the longer a game goes without being picked, the more likely it is to get picked.

Why?

For casual sessions, it can be desirable provide/showcase a broad variety that "feels" more random, even though it isn't.

How?

Picking the Random (Boost Unpicked) swap mode will cause the shuffler to hang onto a game_weights table in the config. All game weights are initialized to 0. When picking a game, the list of games to choose from is padded with copies of each game, based on its current game weight - except for the previously selected game, which is reset to 0. All games then have their weight increased by one.

New games should be accounted for, and games are removed from the weights list when they are marked complete.

Notes

The games list could get super big. But 64 bit lua is probably good for it. Could test and see if it gets nasty with a massive list over a long time if it comes to that.

TheT113 commented 1 year ago

I wanted to try this out, but when running the LUA I get error: "NLua.Exceptions.LuaScriptException: [string "main"]:169: invalid escape sequence near ''.'"

I am downloading the entire package directly from your branch.

MrDannyPicard commented 10 months ago

I'd like to use this myself but i get error: " NLua.Exceptions.LuaScriptException: [string "main"]:169: invalid escape sequence near ''.' "

I've tried to swap this section with the original one but then i get another error on line 369, which i also try changing back to the original code, but at that point i get an error to use bizhawk v 2.6.1 (something about lua core)

Do you have any plan to fix this or should i give up?

Thanks.