Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Need help implementing page randomization

2 years ago
Hey, I'm new here and looking to include a "random page" link at the start of a story game I'm about to publish. The problem is that I don't think it can be treated like a simple die roll; just plopping players on a random page wouldn't take into account what variables they may or may not have activated during a regular run toward that given page. So how do I account for this?
The only idea I've had regarding it is that this link would run a script that rapidly plays the game for you, making random choices along the way and handing control back to you on a random page. That way you arrive at your destination with a set of variables that makes sense for your progress. However, I have no idea how possible this is to accomplish.
Does anyone have experience with this?

Need help implementing page randomization

2 years ago

This sounds like a pretty tough thing to do, and I'm unsure what benefit it would actually have for gameplay.  I've thought of a way to do it, but it would be a real pain for you to code.  Knowing more about what game you're trying to publish would help.

First, you would need to make all variables visible, then you would need to make a random playthrough to each page in the game.  Once you get there, write down all the variables you've triggered.

On the random link page at the beginning, have $DEST := "@P" + 1DX where X is however many pages you're planning on including.

Then, you would have a series of lines of code saying "IF $DEST = 1 THEN ..." and go on to set all the variables to the values you found in your random playthrough.

Obviously this method has the disadvantage of being really annoying to do, and only giving the player one possible set of random variables for getting to a single page.  You may want to consider a different approach depending on the length of your game and the importance of randomness in variables.

Need help implementing page randomization

2 years ago
What is the story reason for doing this? The first thing you need to ask yourself is if what you're trying to do adds to the play experience enough to bother.

But you know what choices can be encountered, so create variables for each of them and bundle them up by sets of possible path options under other variables. Then have the first link clicked randomly select one of those controlling variables and toggle everything beneath it while moving the player to the destination page.

Is there a reason the destination page needs to be random? Because that adds whole layers of complication.

If you're attempting something this complicated, I'm going to assume you read the articles and know how to do basic things with variables already and don't need that part explained in detail.

But again, I'm curious of the plot reason for this. Making choices at random seems like it'd just be simulating an absolute schizo. How about just asking the player for a personality type and then assigning them matching choices or something before...having them skip over half the game? Or whatever the intent is. That seems like it may make more sense and simplify things.

I took a glance at the game and it looks like it's got some strong writing and a nice dark fantasy set up, I honestly question the need for such a gimmick in the first place when I'm sure the game would be well recieved without all this tedious extra work on your part.

Need help implementing page randomization

2 years ago
Yeah, for me it's not clear what you want to do, never mind why.

You mention A random page at the start; but then you have a thing about many pages and variables. A single random page, from a die roll, is pretty simple. But I don't understand -- you want a random page, but to select from random pages based on variables that the player has already set... on the first page?

And as mizal mentions, why? What's the story goal here?

Need help implementing page randomization

2 years ago
That's nonsensical, and you have yet to give a reason as to why you would want it, so the short answer is just stop.

The longer answer is do what Gryphon said.

The even longer answer is don't make it truly random. Just have a set of pre-determined spots they could get jumped to, choose one of those spots at random when the click the link, and randomize the variables that would have been hit at that point in time.

Need help implementing page randomization

2 years ago
Thanks for the quick replies.

To answer what everyone is asking: there is zero plot reason for this. I simply thought it would be a fun bonus option. As a kid I enjoyed opening cyoa novels onto random pages and I wanted a similar feature for my game.

I figured it was a long shot, but I asked because I was hoping someone had figured out a relatively quick and easy way to implement a procedural "randomizer" like this. That doesn't seem to be the case, though, and since I'm not the greatest programmer in the world, I'll just forgo the feature and save myself the extra tedium.

Thanks, everyone.

Need help implementing page randomization

2 years ago
Ah, now I understand. I, too, read many of those old CYOA books that were quite random. Just so you know, those are often referred to as "lol random" stories here. Oh, and a lot of people currently prefer more story-oriented stories (though don't let that stop you, please write what you like!). I have one that's kind of in that vein here.

Good luck with your writing!

Need help implementing page randomization

2 years ago
It looks like a pretty badass game about a witchhunter actually.

Need help implementing page randomization

2 years ago
Not quite what I mean. Rather I liked opening in on the middle of a situation and picking up from there, instead of always starting at the beginning of a story. I've definitely written something with a plot and all that; just wanted to give people another way to enjoy it after they've done a few runs.

Thanks!

Need help implementing page randomization

2 years ago
Just mentioning that this guy has finished his game, and what Is an so far is impressive.

https://chooseyourstory.com/story/your-fate-like-clockwork

@readwithjeremy I assume you wrote this all off site and pasted it over? That is a lotta words for such a new account. Or for anyone really.

Need help implementing page randomization

2 years ago
Thanks for the shoutout. I was just about to put this in the Parlor, actually. Just wanted to get some sleep first.

Yeah, I wrote it offsite. Had to manually input all those italics tags and paragraph spacing after the fact, since I didn't write it for this site at first. As well as figuring out html for some of the puzzles, since they otherwise relied on readers being able to select any page at any time.

For something that was already done when I started pasting, there was a surprising amount that needed doing to get it all here. But I'm glad there's an easy way to play it now.