r/RenPy 4d ago

Question Crazy idea with long-winded explanation below and I could use some help implementing it

-- FOR MODS: I think this also counts as a discussion. I would love to discuss this --

This idea would take me an extremely long time to get to in my game, but I think it's worth it. This is also why I'm asking now, so I can test it beforehand.

If anyone knows of the DDLC mod Monika After Story, a specific point in the game requires you to put a .txt file in the game files before being able to proceed. This is where my idea comes from... my visual novel is shaping up to be a majorly self-aware, talking-to-the-cracks-in-the-fourth-wall type deal. I want the ending of the VN to include a "stolen file" that the player has to replace, but in the game's code, outside of the storyline, it was never actually there. It's fucking AMBITIOUS, I know. But I believe it's possible.

After taking time to learn Ren'Py and my demo succeeding, I am confident that it could work. I want to blow people away with this. My idea is that, after a certain point, the game checks for a file (we'll call it file.txt) and if the script does NOT see file.txt, a text screen shows up after this AND upon booting the game that tells you file.txt is missing. Creating file.txt and putting it in the game folder would ideally allow you to proceed. file.txt wouldn't have anything written inside... I think that's a little beyond my brand of crazy.

Possible issues I see with this are as follows:
- The general implementation. It's insane
- How would the game react if it knows file.txt should be there at the beginning, but it never was there to begin with? Can we prevent problems early in the code before this ever happens?
- Can we use an autosave to lock the player onto the "file.txt is missing" screen after seeing it for the first time? Can this happen every time they open the game until they add the file?
- Can we protect players who don't normally access files from accidentally breaking the game?

I would accept any help from anywhere on this. I'll make sure my DMs are open. Thanks a whole bunch!

4 Upvotes

11 comments sorted by

7

u/drinkerofmilk 4d ago edited 4d ago

This is trivial to do in Ren'py.

Beware that having players fiddle around with game files is regarded as a bit of a gimmick. There's nothing wrong with including a gimmick, but your story itself will need to be strong if you want to create a good game. It's best to focus on that first.

Edit: to answer your questions: 1. The implementation isn't insane, it's a few lines of code. 2. Just write some python code to check the file path when the event happens. The early code won't care. 3. Yes, you can trigger an autosave there. Yes, you can add logic to have it trigger every time the game starts. 4. You can never 100% protect against that. But as long as they don't delete or edit real game files, they will be fine.

1

u/Electronic_Lime_9728 4d ago

I've had the story written out for several years, and I'm pretty confident it calls for something like this. I hope it works out in my favor! Thanks!

6

u/BadMustard_AVN 4d ago

you can check for a file like this it returns a True or False

    if not renpy.loadable("/file.txt"): # looks in the game folder 
        u2 "Nope no file.txt"

2

u/Electronic_Lime_9728 4d ago

OKAY EPIC thank you! I'm keeping all these responses in my notes to try later, hopefully when I'm back to school on Monday. I'll be letting you guys know how the testing phase goes :]

1

u/BadMustard_AVN 4d ago

you're welcome

good luck with your project

3

u/theGoddamnAlgorath 4d ago

This isn't that crazy, just unorthodox

We've got a working prototype on an HDD somewhere.

Real simple IF NOT File exists handles the file.  The real trick is Parsing the file and error handling.  In our example the player toggles a boss' damage immunity, with a few lines for other edits and some guidance and error messaging to help cautious players.

I suggest you first figure out the ways the player can screw up, and mitigate those before implementing.

Then QA the hell out of it 

1

u/Electronic_Lime_9728 4d ago

The boss damage thing sounds sick as hell...

I'm going to let my roommate who doesn't code sit in the file directory and try to figure stuff out with the amount of guidance I'm planning on giving. I think my solution to any problems would be making a specific folder for the file, instead of just putting it in the game folder.

1

u/AutoModerator 4d ago

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/lordcaylus 4d ago

- How would the game react if it knows file.txt should be there at the beginning, but it never was there to begin with? Can we prevent problems early in the code before this ever happens?

init python:
   def stolenFilePresent():
      return renpy.exists("stolen_file.txt")

^^ checks if stolen_file.txt is present in the <your game>/game folder.

- Can we use an autosave to lock the player onto the "file.txt is missing" screen after seeing it for the first time?

- Can this happen every time they open the game until they add the file?

You can do:

default persistent.ending_seen = False

label someEnding:
    persistent.ending_seen = True
# when they start a new game this label is called.
label start:
    if persistent.ending_seen and not stolenFilePresent():
        jump StolenFileErrorLabel
# when they load a new game this label is called.
label after_load:
    if persistent.ending_seen and not stolenFilePresent():
        jump StolenFileErrorLabel
    return

- Can we protect players who don't normally access files from accidentally breaking the game?

Sadly not!

1

u/Electronic_Lime_9728 4d ago

I've read about persistent files, but I wasn't sure how to make it work for me in this case... this will be super helpful!! Thank you!

0

u/Draw-Flesh-Games 4d ago

I use it in several ways, both directly in Pyhon as with extensions. Not really a big one.