kbuzsaki / bingosync

Collaborative bingo boards for speedrun races
https://bingosync.com
88 stars 106 forks source link

Allowing Text Seeds #172

Open Doid01 opened 2 years ago

Doid01 commented 2 years ago

Could we let seeds be inputted as text (on the bingosync site)? Is there a reason for it currently only working with numbers?

The seeded random function used in generators work as text just as well as with numbers (treats the numbers as text regardless too). Text has worked fine in my local testing of generating bingo boards. On the site, the fields for the seed only accept numbers. Even if you submit the form with text in the seed (having modified the HTML to allow that) there is an 'Internal Server Error' and it fails to generate the board. This also happens when you try to enter 1e2 as a seed, something that the number field normally recognizes as a number but still causes the internal error when generating.

If we allow for the the seed to be text and be processed correctly as such, it would resolve the minor issue with the scientific notation numbers and also give greater freedom for seeds. Additionally (and mostly why I'm here bringing this up), generators could be made to recognize specific terms in the passed seed and adjust certain randomization settings. As is, variation can only be done as fixed variants, but seed parsing by generators could enable some specially design extra function to the bingo card generations (have the generator allow/focus on specific types of goals, skew the randomization towards different difficulty ranges, etc.). As is, some generators like srl_generator_v8 even have some such options, but only built into the passed opts variable (i.e. only selectable for creating the fixed variants).

I'm not asking/saying that existing generators need to be updated to parse seeds, it is just a bonus to allowing text seeds in general. I'm also am currently working on a generator with a great deal of customization, seed parsing has worked fine on my end but wouldn't work if run on the site currently. Allowing text seeds is probably also a simpler option than adding extra option fields for specific generators (although that would be a lot cleaner of an option if done well).

Anyhow, I'm not familiar enough with exactly what would go into not having there be internal errors with the text seeds so I'll leave this as an issue for someone more familiar.

kbuzsaki commented 2 years ago

There isn't a significant technical reason why seeds are restricted to only be numeric right now. The historical reason why it's that way is that the original bingo sites (e.g. the different bingo generators on SRL) use numeric seeds interpreted as strings. Bingosync kept that model in order to continue to be compatible with static bingo sites and match user expectations.

There's a minor technical issue in that the database schema currently also represents seeds as strings, but that's easy to migrate if necessary.

I wasn't interested in making seeds alphanumeric strings if there wasn't an actual use case -- it makes the UI more consistent if seeds are all roughly the same size and format -- but using the seed as a side-channel for additional options to the generator is an interesting idea.

What kinds of additional options do you want to be able to pass to your generator? What do you think the ideal (generic) options UI would look like?

Doid01 commented 2 years ago

Difficulty scaling is a nice option to have. The srl_v8 generator has an option for shifting the difficulty spread on the generated magic square to be 1-13 or 13-25 instead of 1-25 if wanted, effectively making shorter and longer variants. A similar thing has been done in how I constructed my (proposed) Octopath bingos, bu I did it more artificially. For those, I have a separate master list of goals with difficulties ranging from 1 to 120, and the variants created take subranges of the master goal list and place the goals into the 1-25 scale. If there was a difficulty option (being the total or average difficulty of a line) to be passed, then a generator could be made to pick goals to fit the user specified line sums. In the Octopath case, the variants could in theory be condensed to one variant + a difficulty option, and have in between options too. If a generator supports it, then the spread of difficulties could be user specified too (1-25, 10-15, all 12-13, etc.).

The other idea is to let Types (and similar sorts of counts) be adjusted by users. If a generator by default ensures an even spread of types or a limit on the number of certain types, then the user could input types to adjust the generators settings. It wouldn't work for most goal lists with their current usage of types, but it could allow for generating 'themed' cards, focusing on certain goal types over others. For my Octopath bingos as an example, if players didn't want as many collect item goals (or if players didn't want to require that particular game knowledge), then they could pass that goals with the Type items would be depreciated in the generator. Or, they could prioritized a certain type and have a card with many Side Story Type goals. This can be done with variants with adjusted goal lists, but the option to pass this to the generator directly could see some better use.

I'll add here that although my Octopath bingos are a good example of ways these option could be used well, there is not much interest in my bingos from Octopath Speedrunners. This is not a priority for us or anything, but it would be cool and interesting still. Even better would be if other bingo communities picked up the extra customization ability for their bingos, and there is probably some creative potential in ways I haven't thought up too.

For UI, if the generator selected supports customization then the respective UI elements would appear (not sure of exactly how 'Custom (Advanced)' is currently working, but similar to that). A difficulty box would be the most straight forward of an option to make available and fits most bingos anyways. The Types thing would require users to know a bit about the generator they are using if they have to type the Types they want adjusted, and could take up a bit of space if full UI selection capabilities for each type was added (dynamically adding options for the variable Types specified by the generator). Types would be difficult to do well as UI overall, but if the option is there secretly in the seed for specific generators then at least users that know of the options could use it.

A lot (all) of this is a bit unnecessary for most users though. We don't necessarily need such a great deal of customization if sufficient variants are provided. Plus, it mostly would only serve future bingos added, the existing bingos would need a fair bit of adjustment in design to make best use of this. If making Text Seeds is simple, then go for it. Otherwise, not at all necessary to consider.

The generator I am working on has a great deal of potential customization. That can just be controlled through the fixed variants if anything, but it will support the ability to pick desired difficulty sums and distributions, and have generator specific ways to handle line synergies if wanted.