A question about writing a long game...

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Dacuna
Newbie
Posts: 24
Joined: Wed Dec 20, 2017 4:15 pm
Contact:

A question about writing a long game...

#1 Post by Dacuna » Sun Dec 24, 2017 1:49 am

I'm making a very large game in Ren'Py, so I have a few questions about making it as efficiently as possible:
Should I typically be writing in many different script files? I only have the main one and I'm considering jumping to another after every major decision. If so, how do I make another one? How does the game know which one to run first?
I understand that the game allows you to make global or local variables. Are there any disadvantages to using global variables only, besides the inability to reuse variable names? As I'm the only one writing the game, I think I can keep track of what variables I have and haven't used.
That's it, thanks for any responses!

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1883
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: A question about writing a long game...

#2 Post by Ocelot » Sun Dec 24, 2017 2:17 am

Should I typically be writing in many different script files?
Whatever is more convenient to you.
If so, how do I make another one?
Just create a text file with .rpy extention
How does the game know which one to run first?
It does not. The thing is, you already have different script files. From the game point of view, there is no difference between script.rpy, screens.rpy, and others. YOu can write screen code in options.rpy, you can write game script in gui.rpy, you can configure your game in screens.rpy and it would work because game does not care about names. It uses main_menu screen to show menu, it starts game from start label, it loads game wherever you stop.
I understand that the game allows you to make global or local variables.
RenPy script does not have the notion of local variables. You will have to deal with globals (or simulate locals by some means). Python code can and should use locals. Luckily, you have to go extra mile to create globals from Python code.
Are there any disadvantages to using global variables only, besides the inability to reuse variable names?
In RemPy script there are more reasons to use globals, than in usual programming language. If you are interested in general problems with globals, this article might help: http://wiki.c2.com/?GlobalVariablesAreBad
< < insert Rick Cook quote here > >

Dacuna
Newbie
Posts: 24
Joined: Wed Dec 20, 2017 4:15 pm
Contact:

Re: A question about writing a long game...

#3 Post by Dacuna » Sun Dec 24, 2017 5:34 am

Thanks a lot for your post! It answered all of my questions. I'll browse through the other script files before continuing my VN.

tcassat
Regular
Posts: 30
Joined: Tue Oct 03, 2017 7:32 pm
Contact:

Re: A question about writing a long game...

#4 Post by tcassat » Sun Dec 24, 2017 10:32 am

If the story is linear, then I see no problem in making a gigantic script. But if you have several parallel stories (or multiple characters), then it is much better to do multiple scripts. I'm creating a visual novel with several characters and the fact that each one has its own script makes the work much more pleasant, efficient and rational.

Post Reply

Who is online

Users browsing this forum: Google [Bot]