Lilyflier
Virgin
Edit: It is now possible to change variables by truly random values! See this link:
https://chyoa.com/chapter/Creating-Random-Numbers.1708314/
Random distribution tips
Forgive the probably completely inaccurate names.
Offsetting
You can perform multiple operations on a variable in the same set of score changes.
This allows you to generate a random value and immediately offset it.
Squashing
You can squash distributions against the 100,000 and/or -100,000 limits to shape them, since values that would be below/above these limits are set to these limits.
Rectangular distribution
If you're just looking for a plain distribution like a dice roll where each outcome is equally probable, then you can usually use "R<number - 1>" and then an offset to wherever you want the number to be.
Eg.
Bell curve
To achieve a bell curve, you can use many small random potential additions/subtractions.
Eg.
-3: 1/64
-2: 6/64
-1: 15/64
0: 20/64
1: 15/64
2: 6/64
3: 1/64
Spikes
To make large probability spikes, you can use R<large number> and then squash a large portion (or all) of the distribution against the 100k or -100k boundaries.
What to generate
So what all can we use random (or "random") data for? Here are my ideas.
The point is to get creative with it, consider the limitations and see if you can manage to randomly generate unconventional things. And if you're feeling ambitious, take things to the extreme until even you don't really know what's going to happen and can enjoy new things every time you read.
PRNGs are much more difficult, but allow for some really interesting things.
Players are going to have to spend a decent amount of time selecting link chapters that generate numbers/bits for whatever is being randomly generated, especially when a lot of (or really big) random values are required. How do we keep the reader entertained while this is happening?
How do you even make a PRNG given the limitations in CHYOA's game mode? I won't go into too much detail unless people really want me to, but I'll try to explain the basics. LFSRs (Linear Feedback Shift Registers) are the best type of PRNGs I've found that can be implemented in CHYOA, and the simplest ones only involve XOR gates and sometimes bit shifts. Plenty of online resources exist explaining how they work better than I could, so I'll mostly focus on how to implement them into CHYOA specifically.
An XOR gate takes two inputs and checks if only one is true instead of false. If it is, it outputs a true value, otherwise it outputs a false value. To simulate one of these, we can create 4 link chapters for each of the 4 possibilities. They should function like "If we're simulating the XOR right now and the input values are 0 and 0, the output value should be 0."
But each chapter addresses a different possibility for the inputs and changes the output accordingly.
A bit shift (for our purposes) takes a series of bits and moves them all one space to the left or right. The last bit (which went "over the edge") gets taken to the first bit's empty place. To simulate this, we create a series of variables that is the length of the series of bits + 1 (the +1 is a variable that's used temporarily to hold the last bit while it's "over the edge"). We can then create link chapters that do checks like "if this is second to last step of the bit shift and bit 1 is 0 and bit 2 is 0, set bit 3 to 0 (set it to bit 2's value) and set bit 2 to 0 (set it to bit 1's value)".
We can create more link chapters to account for more input possibilities per reader click, allowing us to simulate multiple XORs and/or bit shifts at once. But of course the more you want to simulate at once, the more the link chapters you have to create will exponentially increase.
Conclusion
If you're actually crazy enough to try this, feel free to reach out to me. There are dozens of complications I left out and I can save you a lot of time since I've done a lot of experimentation and found more efficient circuits for CHYOA that aren't easily found/understood online.
Oh yeah, and if you have any other ideas for random generation, please comment them. I'd love to yoink them.
https://chyoa.com/chapter/Creating-Random-Numbers.1708314/
Random distribution tips
Forgive the probably completely inaccurate names.
Offsetting
You can perform multiple operations on a variable in the same set of score changes.
This allows you to generate a random value and immediately offset it.
Squashing
You can squash distributions against the 100,000 and/or -100,000 limits to shape them, since values that would be below/above these limits are set to these limits.
Rectangular distribution
If you're just looking for a plain distribution like a dice roll where each outcome is equally probable, then you can usually use "R<number - 1>" and then an offset to wherever you want the number to be.
Eg.
- Variable = R5
- Variable + 1
Bell curve
To achieve a bell curve, you can use many small random potential additions/subtractions.
Eg.
- Variable + R1
- Variable + R1
- Variable + R1
- Variable - R1
- Variable - R1
- Variable - R1
-3: 1/64
-2: 6/64
-1: 15/64
0: 20/64
1: 15/64
2: 6/64
3: 1/64
Spikes
To make large probability spikes, you can use R<large number> and then squash a large portion (or all) of the distribution against the 100k or -100k boundaries.
What to generate
So what all can we use random (or "random") data for? Here are my ideas.
- Companion's personality traits.
- Companion's appearance traits.
- Plot fetishes.
- Plot points.
- Locations/biomes.
- Items.
- Monsters/creatures/npcs.
- Who you are.
- Fundamentals that are then put through a smart algorithm to determine what some above things should be, to make the experience more cohesive while still generating exciting and unexpected outcomes.
The point is to get creative with it, consider the limitations and see if you can manage to randomly generate unconventional things. And if you're feeling ambitious, take things to the extreme until even you don't really know what's going to happen and can enjoy new things every time you read.
PRNGs are much more difficult, but allow for some really interesting things.
- A large open-world (one very long chapter filled with if statements and having link chapters to change x and y variables and do all actions in the game) where a PRNG's seed is set according to where you are when you move, and then it runs. (You're guided secretly or overtly to select link chapters which make the PRNG generate some random bits/numbers.) The resulting bits can then be used for things like what sort of location it is, what sort of person(s) belong there, what sort of plot points you'll encounter, etc.
- A fighting memory game with a binary tree. One PRNG is used to decide what decision the opponent makes (with a seed set with their stats and/or the day to keep their moveset from repeating for the most part). And one PRNG is used to determine what the correct response is from the reader. You could use the opponent's level/rank/whatever to determine how many rounds to do, and you can create image(s) that the reader can look over to learn what all the correct answers are at each point in the binary tree. Each round doubles the total amount of possibilities, so for the reader to beat an enemy, they'll either have to get lucky or memorize 2^Opponent level-1 binary answers. And of course erotic rewards could be included.
Players are going to have to spend a decent amount of time selecting link chapters that generate numbers/bits for whatever is being randomly generated, especially when a lot of (or really big) random values are required. How do we keep the reader entertained while this is happening?
- It could be canon that you use a large vehicle to navigate the world, and while you're traveling you can do various activities (most or all of which use link chapters that contribute to the pseudorandom generation).
- In situations where it isn't very important to keep the reader from predicting what the final value is, the bits/number parts generated each time the reader selects the next link chapter can be used to determine some smaller events/things to keep them entertained.
How do you even make a PRNG given the limitations in CHYOA's game mode? I won't go into too much detail unless people really want me to, but I'll try to explain the basics. LFSRs (Linear Feedback Shift Registers) are the best type of PRNGs I've found that can be implemented in CHYOA, and the simplest ones only involve XOR gates and sometimes bit shifts. Plenty of online resources exist explaining how they work better than I could, so I'll mostly focus on how to implement them into CHYOA specifically.
An XOR gate takes two inputs and checks if only one is true instead of false. If it is, it outputs a true value, otherwise it outputs a false value. To simulate one of these, we can create 4 link chapters for each of the 4 possibilities. They should function like "If we're simulating the XOR right now and the input values are 0 and 0, the output value should be 0."
But each chapter addresses a different possibility for the inputs and changes the output accordingly.
A bit shift (for our purposes) takes a series of bits and moves them all one space to the left or right. The last bit (which went "over the edge") gets taken to the first bit's empty place. To simulate this, we create a series of variables that is the length of the series of bits + 1 (the +1 is a variable that's used temporarily to hold the last bit while it's "over the edge"). We can then create link chapters that do checks like "if this is second to last step of the bit shift and bit 1 is 0 and bit 2 is 0, set bit 3 to 0 (set it to bit 2's value) and set bit 2 to 0 (set it to bit 1's value)".
We can create more link chapters to account for more input possibilities per reader click, allowing us to simulate multiple XORs and/or bit shifts at once. But of course the more you want to simulate at once, the more the link chapters you have to create will exponentially increase.
Conclusion
If you're actually crazy enough to try this, feel free to reach out to me. There are dozens of complications I left out and I can save you a lot of time since I've done a lot of experimentation and found more efficient circuits for CHYOA that aren't easily found/understood online.
Oh yeah, and if you have any other ideas for random generation, please comment them. I'd love to yoink them.
Last edited: