Breake down the screen.rpy file for easier navigation

in utopian-io •  7 months ago

Components

  • Ren'py screen.rpy file
  • GUI

The problem

The screen.rpy that holds the bulk of code for the games interface is 1509 lines long, to construct a new interface we often have to change every single line in this file, however, most of the time you are working only on two or three sections of the file, usually the top that holds the styles and a section in the middle.

but scrolling down and finding the screen you have been working on, often take more of your time than the actual coding.

Proposal

My solution always been breaking down the file into more manageable chunks:

  • styles.rpy holds the code for general styling of the projects interface.
  • main.rpy holds the code for the main menu and the navigation bar.
  • chat.rpy holds the code for anything related to the games dialogue such as say, input, choice, quick menu, history and NVL screens.
  • menus.rpy holds the code to save, load and preferences screens.
  • others.rpy for all other small bits and parts of the interface plusd help and about screen that usually remain untouched.

I keep these files in a folder named "ui" alongside any graphics I create for interface.
this way instead of going up and down to find the part I want to edit, I simply open all of those or the ones I want to edit in the editor and click the tabs for a fast and easy workflow.

my suggestion is: implementing this change as a default, for all of renpy users to benefit from this workflow boost on all of the projects that they create.

Mockups / Examples

you can imagine how easier it is to work on few lines of code at a time.
01.jpg

also finding the right file.
02.jpg

it's not that hard to do but to make it even easier, here's the screen broken into those chunks:
https://drive.google.com/open?id=1aajBpR0u09AmaGtq34jp9qJoDpzY2yr2

Benefits

  • speeding up the workflow
  • stripping down few lines in the code that are not necessary anymore
  • easier to find and debug problems in the code
  • different members of the team can work on different part of the code without worrying about messing up each other's work
  • it's easier to grab and send only the interface to the client or other members of your team when all of it is contained in a single folder

as a side suggestion: I suggest moving the "GUI.rpy" into the GUI folder to make it easier to move a changed GUI to another project



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Your contribution cannot be approved because the github repository does not contain a license file


Need help? Write a ticket on https://support.utopian.io.
Chat with us on Discord.

[utopian-moderator]

·

the license is shipped with the software so it is provided in the repository as well on the website, if it's not on the main folder it doesn't mean there's no license file:

LICENSE_PATH = os.path.join(config.renpy_base, "doc/license.html")

LICENSE_URL = "http://www.renpy.org/doc/html/license.html"