Page 1 of 1

Developer tool idea: Notes system

Posted: Mon Feb 28, 2011 1:33 pm
by @berration
So, while working on development for Errant Heart, I came across this idea for something that I thought would be useful: A notes system.

To give you an idea of what I'm talking about:

Voight-Kampff will create a sort of bare-bones version of the VN, placing the script, along with placeholder backgrounds and sprites into RenPy. As the artist, I'll play through the VN, taking notes and making sketches as I do so…

However, he also likes to put notes in comments—things like what should be in a background, thoughts on what a character should look like, the mood of the music, sound effects, etc. The problem is, I need to go back through the actual code to look at any of this.

So my thought is: Is there some way we can make some sort of Notes system that can be enabled or disabled (for the developer only, of course) that would…well, I'm not sure. Contain a pop-up with comments on the scene? I'm not exactly sure how or where they should appear, since the VN uses both ADV and NVL modes.

Do any of you coding geniuses out there have any ideas on how such a thing could be implemented?

Re: Developer tool idea: Notes system

Posted: Mon Feb 28, 2011 2:18 pm
by Anima
You could use a screen for that and give the text as an argument to the screen.
Something like:

Code: Select all

init :
    screen developerNotes:
        default devNote = ""
        text devNote

    python:
        def showdevNote(pNote):
            if config.developer == True:
                renpy.show_screen("developerNotes", devNote = pNote)

# The game starts here.
label start:
    $ showdevNote("Hello World")
The screen should be formatted a bit, but that's the gist of it.

Re: Developer tool idea: Notes system

Posted: Mon Feb 28, 2011 2:59 pm
by PyTom
Since characters are really just python functions, you can simplify the use of Anima's code a bit.

Code: Select all

screen developerNotes:
    if devNote:
        window:
            yalign 0.0
            background "#0008"

            text devNote

init python:
    devNote = ""

    def note(s, **kwargs):
        global devNote
        devNote = s

# The game starts here.
label start:
    show screen developerNotes

    note "Perhaps we should have some thunder sound effects here as well."

    "It was a dark and stormy night; the rain fell in torrents..."

    # Hide the note.
    note ""

    "except at occasional intervals, when it was checked by a violent gust of wind which swept up the streets (for it is in London that our scene lies)..."


Re: Developer tool idea: Notes system

Posted: Mon Feb 28, 2011 3:19 pm
by SusanTheCat
My brain just became evil and now wants to have something that would let you add notes to a screen during the game that are spit out to a log.

/me goes off to figure out how to do this.

Susan

Re: Developer tool idea: Notes system

Posted: Mon Feb 28, 2011 5:02 pm
by rioka
Pretty neat! You can make a director's cut-type game or completely use that as a game play mechanic.

Re: Developer tool idea: Notes system

Posted: Wed Mar 02, 2011 6:27 pm
by Gargargarrick
SusanTheCat wrote:My brain just became evil and now wants to have something that would let you add notes to a screen during the game that are spit out to a log.
Not sure if this is what you want, but there are some Python commands that print strings to plaintext files.

Code: Select all

    $ name = renpy.input("Enter your name.", length=20)
    
    python:
        with open(config.gamedir + "/records/name.txt", 'wb') as fo:
            fo.write(name)
            fo.close()
will put the text entered as "name" into the text file "name.txt" in the "records" directory, for example. (Make sure these both exist.) You have to be careful with whether text is appended to or replaces existing text, but it can be quite handy if you only want to log certain things, as opposed to Ren'Py's usual log function. ^^

Re: Developer tool idea: Notes system

Posted: Wed Mar 02, 2011 10:01 pm
by @berration
Finally got a chance to try some of this code out. It'll probably take a little playing around to get something to my liking, but these suggestions give me a good place to start. Thanks!

Re: Developer tool idea: Notes system

Posted: Thu Mar 03, 2011 1:28 pm
by SusanTheCat
Gargargarrick wrote: Not sure if this is what you want, but there are some Python commands that print strings to plaintext files.

Code: Select all

    $ name = renpy.input("Enter your name.", length=20)
    
    python:
        with open(config.gamedir + "/records/name.txt", 'wb') as fo:
            fo.write(name)
            fo.close()
will put the text entered as "name" into the text file "name.txt" in the "records" directory, for example. (Make sure these both exist.) You have to be careful with whether text is appended to or replaces existing text, but it can be quite handy if you only want to log certain things, as opposed to Ren'Py's usual log function. ^^
Cool! Thanks.

I have created some code that puts a button in the top right-hand corner that puts the the word "TYPO" and the file and line number. I can pair that with the code you put and have a snazzy typo indicator. The idea is that when the playtester sees a typo, they can hit the button and the fixer would know exactly where the typo took place!

Susan

Re: Developer tool idea: Notes system

Posted: Thu Mar 03, 2011 7:35 pm
by Greeny
Look, let me be honest here. Unless you're prepared to go back in the end and manually delete all these notes, this is going to have a very bad influence on your file size, you'll be sending the end-user a large portion of junk data.

And if you are willing to do manually remove them, you might as well just put these notes into regular say statements.
I also don't see when .txt files got obsolete in this whole story.

Re: Developer tool idea: Notes system

Posted: Fri Mar 04, 2011 12:17 am
by SusanTheCat
I've been making "#TODO" comments in my code. Then I can do a quick grep to see what still needs to be done.

The same could be done for the notes. 'Specially if you call them stuff_todo instead of notes. Then it is a simple thing to strip them out and they do their job to let the play testers know that there was supposed to be a sound effect there. (Or whatever)

Susan

Re: Developer tool idea: Notes system

Posted: Sat Mar 05, 2011 8:00 pm
by SusanTheCat
In case anyone is interested, here is my hacked together code.

The purpose is to put it in while developing so that when your play testers encounter a typo or continuity problem, all they have to do is click a button and the file and line number are entered into a file called "comments.txt".

Code: Select all

    init python:

    def log_typo(myType = "TYPO"):    
        try:
            f = file(config.gamedir + "/comments.txt", "a")
            filename, line = renpy.get_filename_line()
            print >>f, myType,filename,line
            f.close()
        except:
            pass
            
    def log_typo_plot(): 
        log_typo("PLOT")

    def button_log_typo():

        ui.vbox(xpos=0.99, ypos=0.02, xanchor='right', yanchor='top')
        ui.textbutton("Typo", xminimum=80, clicked=log_typo)
        ui.textbutton("Plot", xminimum=80, clicked=log_typo_plot)
        ui.close()


    config.window_overlay_functions.append(button_log_typo)
Of course different types of muttons can be added for different purposes. (Sound, pauses, graphics)

Susan