Tool Ren'Py Are you interested in a tool that could help you develop a renpy game?

midel

New Member
Oct 9, 2017
2
11
Hello, I'm not a new member on this forum, but it's my first post :)
Recently, after work (I'm a full time developer) I came up with the idea of creating a tool to help develop games based on the renpy engine.
I thought of such functionalities as:
- add characters, images, transitions, character positions, sound, music and story via GUI
- manual edit game scripts with syntax highlighting
- view story flowchart
- live preview actual scene
- possibility to convert different types of pictures to webp (which often reduces image size)
- possibility to convert different types of sounds/music with cut feature

The main purpose of this tool wouldn't be to replace programming, but to support the game developer and increase the pace of the game development in general.
This tool would be written in python 3.x and would be using GUI framework (maybe Qt?)

What are you thinking about that tool?
Would be demand for it?
Are there any additional features that you would want in this tool?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,979
16,236
- manual edit game scripts with syntax highlighting
What would be the improvement in regard of using, by example, Atoms with the Ren'py highlight file made by PyTom himself ?


- view story flowchart
Would it works with called labels and dynamic label names, like by example jump expression "{}_blowjob".format( girlName ) ?
Would a game like Super Powered, that almost never jump, and have all its call based on the dynamic structure show above, works with this feature ?


- live preview actual scene
What would be the advantage in comparison to opening the console and typing jump LABEL_OF_ACTUAL_SCENE, then using a combination of rollback and shift + R to see the impact of the changes made ?


- possibility to convert different types of pictures to webp (which often reduces image size)
What would be the advantage compared to cruncher and the (two?) other tools like that already available ?


The main purpose of this tool wouldn't be to replace programming, but to support the game developer and increase the pace of the game development in general.
So far, with few exceptions, what take the most time in game development with Ren'py is the CG (whatever 2D or 3D), and the dialog writing (finding the right sentences, make them sound real, etc.), not the coding part. And the exceptions are due to complex code that your tool wouldn't help to solve, like the writing of a good inventory system, by example.

It doesn't mean that it's a bad idea, especially the flow viewer, but this feature would be effectively useful for games that have a complex structure. How do you planed to handle the case of branching hub like:
Code:
init python:
    def actionHub( girl, stat, action ):
        v = getattr( getattr( store, girl ), stat )
        if v < 5:
            return None
        elif v < 10:
            return "{}_{}_first".format( "{}", action )
        elif v < 15:
            return "{}_{}_second".format( "{}", action )
        elif v < 20:
            return "{}_{}_third".format( "{}", action )
        else:
            return "{}_{}_fourth".format( "{}", action )

label whatever( char ):
    menu:
        "What to ask her ?"
        "Handjob":
           $ labelJump = actionHub( char, "like", "hj" )
        "Blowjob":
           $ labelJump = actionHub( char, "like", "bj" )
        "Sex":
           $ labelJump = actionHub( char, "love", "sex" )
        "Anal":
           $ labelJump = actionHub( char, "love", "anal" )
    if labelJump is None:
        "She's not ready for this"
        return
    call expression labelJump.format( "validation" ) ( char)
    if _return is False:
        return
    call expression labelJump.format( char )
    return


label validation_hj_first( char ):
    if char.anger > 10:
        "She really don't look pleased by your request"
        $ char.like -= 1
        return False
   return True
   
label annie_hj_first:
    [...]
It's those kind of games that would really benefit from a flow viewer feature, the other are basic enough for the flow to be relatively obvious when the labels are named correctly.
 

midel

New Member
Oct 9, 2017
2
11
Thanks for response :)

What would be the improvement in regard of using, by example, Atoms with the Ren'py highlight file made by PyTom himself ?
There wouldn't be much improvement - it would still be syntax highlighting with autocomplete feature.
I don't want to reinvent the wheel with this tool.

What would be the advantage in comparison to opening the console and typing jump LABEL_OF_ACTUAL_SCENE, then using a combination of rollback and shift + R to see the impact of the changes made ?
Hmm... I thought rather about live preview during coding without need to jump LABEL_OF_ACTUAL_SCENE. Additionally when developer would want to preview other scene then there would be possibility to select particular scene (from scene list) and click, e.g. button "preview scene".

What would be the advantage compared to cruncher and the (two?) other tools like that already available ?
Being integrated with other (sub) tools :)
For serious, there would be small advantage compared to cruncher - conversion is still the same process but I thought about:
- support for additonal file types from/to convert
- cutting feature for audio files
- maybe adding some effects?
- create backups :)

Would it works with called labels and dynamic label names, like by example jump expression "{}_blowjob".format( girlName ) ?
Would a game like Super Powered, that almost never jump, and have all its call based on the dynamic structure show above, works with this feature ?
Yes, it would work, see below.

How do you planed to handle the case of branching hub like:
Code:
    [...]
Hmm... in this example in label whatever( char ): I would be tracking how many times call expression is called and let developer to add nodes to existing blocks from these two call expression.
I think it's the best method (for such complex parts of scenario) because it's very easy to overlook something from perspective of tool developer.

Try to think that this would be collection of tools (implemented from scratch, using libraries if needed) merged into single GUI application.
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,979
16,236
The more you talk about it, the more I'm confused about what you want to do.


Hmm... I thought rather about live preview during coding without need to jump LABEL_OF_ACTUAL_SCENE.
Live preview of what exactly ?

You say that your tool will be in Python 3, what imply that it will be totally independent of Ren'py core, or don't come before probably a year, if not more, since Ren'py is in an hybrid state in between Python 2 and 3. While it can now run Python 3 code, it still can't be ran by a Python 3 interpreter.
Therefore, do you intent to rewrite every single bit of Ren'py by yourself, or do you intent to simply describe what would be shown if the code was ran under Ren'py ? And in top of that have an embedded Python 2 interpreter in order to process the Python code that can be embedded into the Ren'py one ?

I mean, if the code looks like:
Code:
layeredimage annie:
    always:
        "character/annie/[tatoo]/body.png"
    group head:
        attribute neutral:
            "character/annie/head/neutral.png"
        attribute happy:
            "character/annie/head/happy.png"
        attribute sad:
            "character/annie/head/sad.png"
        attribute surprised:
            "character/annie/head/surprised.png"
    [...]

label whatever:
     scene livingRoom
     show annie neutral
     a "Hello boy, what do you want ?"
     # Will use the alternate menu screen named "hintMenu", and show it
     # in the left on the screen, on the upper middle of it.
     menu( screen="hintMenu", x=100, y=500 ):
          #  The choice will be sensitive only if her /like/ value have the right value,
          # but still be displayed in order to show the hint when her /like/ value is
          # lower.
          "Go to a date"( hint="You need at least 10 like for this", capValue=10, capAttr="a.like" ):
             show annie happy at jumpyJump
             a "I'm so glad"
             jump annieDate
          "A blow job"( hint="You need at least 15 love for that", capValue=15, capAttr="a.love" ):
             show annie sad
             a "Is sex the only think you want from me ?"
             jump annieBJ
[...]
What will your preview show ?

Do you intent to rewrite all the layered images code, in order to be able to display them, then to rewrite the transform code, in order to show them, before rewriting all the menu code, in order to be able to handle the optional arguments, and finally to rewrite all the screen code, in order to be able to display the screens as they are effectively designed ?
Or do you intent to display something that will be more on the side of "here, you'll see an image that I can't display, with a transform name 'jumpyJump'", and other, "here, there's a menu that would looks like this if you haven't changed the 'menu' screen and didn't used too advanced features" ?


Therefore, like I asked, what this feature of your tool would add to what Ren'py already have ?

It seem that you didn't understood what I said when I talked about the combination jump, rollback and shift + r.
The key combination turn Ren'py into "automatic reload" mode. This mean that each time a rpy file will be updated (and this update saved), Ren'py will automatically reload the script, letting you show immediately the effect of the changes you made.
This is the live preview of your tool, with the guaranty that what you'll see will be what you'll get, since it's done by Ren'py, and so handle all the features of Ren'py language.


Additionally when developer would want to preview other scene then there would be possibility to select particular scene (from scene list) and click, e.g. button "preview scene".
What they can do, I admit it less intuitively, by opening the console and jumping to the scene. And, unlike with your preview, while they are in the console, they can tweak the variables, because they want to see a particular variation of this scene.
Keeping my example above, they'll be able to test the scene with both a "like" value below and above 10, and a "love" value below and above 15. What, in your tool, would imply to pass by an additional input windows asking what variable have to be changed, what should be its new value, then if the user want to change another value or not.
In the end, it wouldn't be really easier than using the console, just more visual.


For serious, there would be small advantage compared to cruncher - conversion is still the same process but I thought about:
- support for additonal file types from/to convert
What file types, and for what reason ?
2D games don't really need a tool like cruncher ; a whole game is generally smaller than a single update of the average 3D game. And 3D games will have to deal only with PNG and JPEG files.


Hmm... in this example in label whatever( char ): I would be tracking how many times call expression is called and let developer to add nodes to existing blocks from these two call expression.
I think it's the best method (for such complex parts of scenario) because it's very easy to overlook something from perspective of tool developer.
And therefore your flow chart would be at most as intuitive and understandable than just looking at the code itself :/
It would tell what label is possibly called from this place, what can already be known by looking at the code, and tell from where a label could possibly be called, what any grep tool already tell.


Try to think that this would be collection of tools (implemented from scratch, using libraries if needed) merged into single GUI application.
If there's something that my 35 years of coding, among which 25 doing it professionally, taught me, it's that merging tools for the sole purpose to merge tools only lead to hell, loose of knowledge, and final confusion.

It doesn't mean that your tool wouldn't be a good addition to Ren'py, and even less that it isn't needed, but you make me think about this quote of Nicoll Hunt, "the first step of any project is to grossly underestimate its complexity and difficulty."


If I have an advice to give you, it's to forget about a Python 3 independent tool.
What Ren'py need isn't that someone, you this time but you aren't the first, reinvent what Ren'py can already do, but that someone add what Ren'py is missing. And the best place to do this is in Ren'py itself.

Look at Ren'py core, learn its internal. And instead of having an external tool that will only be able to show a rough and raw preview of what would possibly, under many conditions, be what the code do, the user will have a key combination opening a menu-like in Ren'py letting him click on a label name and immediately jump to it for testing.

And by doing so, you'll see a lot of other tools that could be useful. Having access in real time to Ren'py and to the context, you can have a live branching map for the current label. Showing it in a "watch" way ; a list of the labels that can be reached from this label at this exact instant. And I mean the real labels, even when they are expressions. All you need is to learn how Ren'py AST is built, or to tweak the classes that can branch, adding to them a "labelPreview" property you can interrogate at any time, and display their value. The author would have the information in real time, "interaction" by "interaction", knowing precisely at what moment his code goes wild and wrongly changed the name of the label.
A little more work, and you couple that with renpy.has_label, showing in red all the labels that don't exist, making the author see in real time that "this context" break his game.
Look at the return stack, and you can tell to the author what path led him to "this label", letting him understand what gone wrong even if the said path include labels that branched without interactions.

There would be limitation, user defined statements and renpy equivalents would goes below the radar of your tools. But if someone use one or the other, he's expected to know a minimal what he is doing, and therefore be able to debug his code by himself if it's needed. Anyway your tool would still be useful for 95% of Ren'py users.


This is the kind of tools that Ren'py need, the kind of tools that would really make life easier for anyone who works with Ren'py. And by anyone I include the modders and walkthrough authors.

We pass time loosing our time, by trying to make tools for Ren'py that aren't needed. I don't remember his pseudo, but the guy who's working on the local version of unrpyc, passing time to make it works with tweaked version of the rpyc format in order to counter the obfuscation attempt of some authors... Or me, who made a standalone tool reverting the said obfuscation. All this when we could just branch unrpyc code into Ren'py, and therefore have it working fine whatever the attempt to obfuscate the code...
Same for rpatool, that we tweak to add this or that variation, when we can have, with two dozen of lines, a tool that would works directly from Ren'py, and therefore works whatever the said variations.
 
  • Like
Reactions: Penfold Mole

konabwo

Engaged Member
Sep 19, 2020
2,482
726
not sure if it is related to what tstarter had in mind
but i always wondered why some sort of worldbuilder was not created
create location1
add pic, add description, create object1 & add object (if some interactive gigs in the location)

create trigger-event1
choose location (from created places)
add (time for interaction to occur)
add pic/visuals (of that interraction from existing files)
add text
add a tip for the next task (example for sandboxes ofc)
 
Last edited:

prettyink

Newbie
Aug 22, 2020
31
451
I hope you're looking into creating something like this. I think for games that may be more heavily dependent on complex decision trees, having a more visual way of seeing those branches would be really neat. The idea of live preview would be great too, to make sure characters are where they are meant to be, dialog shows up where its meant to, and for GUI development, it could be helpful!

I think its worth making a small MVP and seeing how it goes. I'd certainly use something like it :D
 
  • Like
Reactions: JustAnotherHuman7

TDoddery

Member
Apr 28, 2020
175
167
I hope you're looking into creating something like this. I think for games that may be more heavily dependent on complex decision trees, having a more visual way of seeing those branches would be really neat.
+1 on that.

My personal view is as follows:

One of the most time-consuming aspects of working with branching (and un-branching) event-lines in Ren'py is trying to avoid unintended consequences.

For example, and I'm sure I'm not alone, I sometimes realize that I have wasted my time providing for some potential state of some variable that actually cannot have acquired that state (whether I wanted it to be possible or not), or, perhaps more often, that I have omitted properly to provide for some variable state that I have forgotten or not realized could exist.

In that context, some kind of tool allowing a visual overview of the code flow paths that are possible sounds very appealing, however, I suspect any sort of comprehensive "world-view" of such paths would itself be rather overwhelming in terms of displaying hundreds or even thousands of potentially stacked up contingencies.

I guess a big part of the problem lies in the fact that, unlike me, the tool would not know which contingencies are "plot critical" and which are merely incidental. It also would not know how clever or random I have been in using different types or classes or whatever to store data which is important or incidental.

To illustrate that by way of a dumb example, suppose if the player could have repeated a particular activity whereby the MC earned $10 each time, then we really don't want to be shown all the different potential "paths" which that could represent; they would be infinite.

Maybe a more coherent tool to work with would be something that operates in reverse by checking the dependencies at any given point in the code. I mean something like the ability to select a particular point in the code and have the tool show us only those conditions that would have been strictly necessary to get there.

If it's actually impossible to get there we would at least find out about that because the tool would not find any route back to "start". But the utility of that seems quite limited in the sense that there might be say two significantly different pathways for arriving at that point, and in that case we would probably want to see both of them, but how does the tool know that?Neither of those paths would be regarded as strictly necessary (due to the existence of the other).

I'm not clever enough to understand how things could be refined so that, irrespective of how the code has been implemented, some alternate paths could be shown without all of them being found and running back into things like the "MC earns $10" problem.

Maybe a different approach would be to have something a bit like the console variable viewer but which shows what all the variables could be at a given point.

A variable whose value is irrelevant to arrival at that point could be just show as such, and that might be good to know, as would the fact that another variable must be >3, or zero or whatever.

I don't know, it seems fucking complicated - lol
 

TDoddery

Member
Apr 28, 2020
175
167
I can't stop thinking about this now!

Showing what variables could be is largely useless because it doesn't take account of interdependencies like x can be >0 but only if y==0.

But it occurs to me that the reverse pathway display thing could maybe be implemented so that it ignores multiple pathways which do not affect any variables upon who's value the "arrival point" depends.

I'm going to try to stop thinking about it now and wait for someone smarter than me to say something.
 

Tk42799

Newbie
Dec 3, 2017
22
19
As a newbie contemplating creating my own game, I would welcome any tool which would assist me.

I'm sure a lot of members have ideas that they would be willing to attempt to create a game however, like me in spite of all the Youtube tutorial videos, still find the process overwhelming.

Thank you for your offer to create such a tool and please mark me as a definitely interested.
 

prettyink

Newbie
Aug 22, 2020
31
451
I can't stop thinking about this now!

Showing what variables could be is largely useless because it doesn't take account of interdependencies like x can be >0 but only if y==0.

But it occurs to me that the reverse pathway display thing could maybe be implemented so that it ignores multiple pathways which do not affect any variables upon who's value the "arrival point" depends.

I'm going to try to stop thinking about it now and wait for someone smarter than me to say something.
I agree, its complicated as all get-out. BUT, I'm wondering if it can be simplified by event logging rather than just depending on states and variables? Kind of like the workflow that's referenced in this thread . I think also, if its something that branches and is more of like a branching structure you can zoom in and out of and filter what paths are highlighted, etc it may work?

I guess the bottom line with something like this would be to figure out what is the bare minimum problem to solve in creating this tool, and then from there build out features that address these unique and complex issues?
 

TDoddery

Member
Apr 28, 2020
175
167
I agree, its complicated as all get-out. BUT, I'm wondering if it can be simplified by event logging rather than just depending on states and variables? Kind of like the workflow that's referenced in this thread . I think also, if its something that branches and is more of like a branching structure you can zoom in and out of and filter what paths are highlighted, etc it may work?

I guess the bottom line with something like this would be to figure out what is the bare minimum problem to solve in creating this tool, and then from there build out features that address these unique and complex issues?
I know what you mean because I'm actually a bit OCD about event logging.

I log every choice as it happens and I also time stamp it.

Kind of makes overviewing the code even more difficult though.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,979
16,236
Kind of makes overviewing the code even more difficult though.
It would be a little less intuitive (and is actually broke for menus) but there's for this kind of thing.

Else you can also do it by yourself:
Python:
init python:

    myLogFile = renpy.os.path.join( config.basedir, 'my_log_file.txt' )

    def formatedLog( msg ):
        FH = open( myLogFile, "a" )
        FH.write( "{} - {}\n".format( renpy.time.strftime( "%b %d %H:%M:%S" ), msg ) )
        FH.close()

    def display_menuWithLog( items, *args, **kwargs ):

        for label, val in items:
            if val is not None:
                formatedLog("Choice: " + label)
            else:
                formatedLog(label)

        rv = renpy.display_menu( items, *args, **kwargs )

        formatedLog( "Picked: {}".format( items[0][0] ) )
        return rv

    menu = display_menuWithLog
It will automatically log the different choice each time a menu is displayed, then log what choice have been picked by the player. All this without the need to add anything in the code of your game, and therefore without changing its readability.
 
  • Like
Reactions: prettyink

TDoddery

Member
Apr 28, 2020
175
167
Thanks Anne O', that sounds amazing, but anything with words like kwargs in it escapes me, let alone any of that other stuff.

I think you understand there's always that play-off between learning new coding tricks and just getting on with the game.

It's a great thing about Ren'py that it allows some of us to just keep clunking along like it was a 1980s mainframe and maybe pick up new stuff as we go.

I keep trying.
 

prettyink

Newbie
Aug 22, 2020
31
451
It would be a little less intuitive (and is actually broke for menus) but there's for this kind of thing.

Else you can also do it by yourself:
Python:
init python:

    myLogFile = renpy.os.path.join( config.basedir, 'my_log_file.txt' )

    def formatedLog( msg ):
        FH = open( myLogFile, "a" )
        FH.write( "{} - {}\n".format( renpy.time.strftime( "%b %d %H:%M:%S" ), msg ) )
        FH.close()

    def display_menuWithLog( items, *args, **kwargs ):

        for label, val in items:
            if val is not None:
                formatedLog("Choice: " + label)
            else:
                formatedLog(label)

        rv = renpy.display_menu( items, *args, **kwargs )

        formatedLog( "Picked: {}".format( items[0][0] ) )
        return rv

    menu = display_menuWithLog
It will automatically log the different choice each time a menu is displayed, then log what choice have been picked by the player. All this without the need to add anything in the code of your game, and therefore without changing its readability.
What does the output for something like this look like? I may use something like this to track decisions made in my game while testing, things get very complex very fast, and having a decision tree for errors would kick ass.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,979
16,236
Thanks Anne O', that sounds amazing, but anything with words like kwargs in it escapes me, let alone any of that other stuff.
You just need to copy the code into a rpy file that you create, nothing more. Everything else will be done automatically.
Or to be patient and wait for the 7.4.11 to be officially released, since it normally include a fix for , letting the menu being logged again.


I think you understand there's always that play-off between learning new coding tricks and just getting on with the game.
Except that it's not a trick, it's a corrected copy of the code used internally by Ren'Py to log the menus when asked to. If the said config.log haven't been broke by a change when the 7.x branch started, I wouldn't have cared to write some code and my answer would have been one line long:
Put config.log = "myLogFile.txt" somewhere in your code.

What does the output for something like this look like?
Whatever you want ? I mean, here it looks like:
Nov 18 14:46:25 - Choice: first choice
Nov 18 14:46:25 - Choice: second choice
Nov 18 14:46:26 - Picked the 0 choice
But since you decide of what is logged and how it is, it can looks whatever way you want it.
 
  • Like
Reactions: prettyink