I brought this up on ifMUD in either December or January, and planned to ask in the forums about it, but then I was trapped in a dark dungeon by an evil monster called the “2014 Spring Semester”, which I only today finished level grinding my academic skills enough to defeat. So I’m looking at resuming that project. Here’s the deal:
I’m thinking of doing a demake of The Stanley Parable in Inform 7. This game is very metafictional, and relies heavily on the concept of restarting.
I’d like to avoid using Glulx if I possibly could and that means needing to build a fake restart routine. I want to write a routine that looks/feels like the Z-machine is asking you if you want to restart, restore or quit, but what restart actually does is not restart, but instead goes to a big long list of actions that put each individual item back it’s starting position or state, while preserving a number of variables that remember what you did before in order to trigger events differently based on different things you try. Some “endings” you only get once, like if you go in the closet too many times, the next time you come back through, it will be boarded up.
One problem I’m encountering is that there are a crap ton of items that are almost exactly like other items, because the game takes place in a building with 500 employees who are referred to by their number. So for instance, the “420s Office Pool” room will have a “Employee 427’s door” leading to “Employee 427’s office” which is a room that contains “Employee 427’s computer.” (The narrative doesn’t require all 500 employees: just a selection of numbers that give the feeling that you’re in a building that big) The trouble is, I can’t seem to get it to differentiate properly between different employees stuff when trying to write this restart routine. Any advice?
BTW, I can post some code examples of what I’ve tried and what the results were if that would help
If you already have your “reset” function worked out, I would think the cosmetic things you’re looking for would be accomplished by calling the appropriate rules or activities from the Standard Rules (e.g. to display the banner).
You might be able to just override the standard “immediately restart the VM rule” with something that executes the reset function then does the cosmetic parts of the “when play begins” rules.
I think examples of this would be helpful in trying to diagnose the issue. It doesn’t seem like the kind of thing that should be hard to solve, but it may be hard to see.
I think it would help to post some code examples. My advice would be not to try actually ending the game and restarting, but doing everything within the game. It might require a bit of Inform 6 trickery (which someone else can probably do pretty easily) to make the “The End” or “Game Over” print up in the right typeface, as though the game had ended, but you can make the game print the final question text itself, and example 415 of the documentation (“Identity Theft”) gives some code to make sure it only accepts the right answers after asking that question.
Resetting the state of the game to the beginning is another issue entirely; how you do that will depend on what you need to do.
(Warning: If you’re doing any kind of sizable game with the new Inform, you may wind up having to use Glulx anyway.)
I should elaborate what I meant about the I6 trickery required to print “The End” in the typeface you want. You can order your game to “follow the print player’s obituary” rule at any time without ending the game. But if you don’t do something, that just prints two sets of three asterisks with nothing in between them. Poking around the rules a bit (specifically, looking at what the Standard Rules do with the phrase “End the story saying ‘foo’”) suggests that some I6 would be needed to get your desired text in between the asterisks, if you wanted to do it that way. But I wouldn’t be surprised if the I6 required to do that were pretty simple.
Well, it depends on what state changes you’ve made. If it’s just a question of returning a bunch of objects to their initial positions, making sure doors are closed, etc., that’s doable. If you’ve got “[first time]…” substitutions that you want to reset that seems like it’d cause lots of problems.
Can’t speak to the original poster’s reasons for wanting the z-machine, but I believe it’s still more portable (to phones etc.); or it might be part of the demake aesthetic.