Unity Ren'Py Unreal Engine Seeking Development Guidance - How Essential is Python Really? Share Your Experiences

cascada

New Member
Aug 26, 2019
12
15
70
Hello, everyone! This is my first post here.
Sorry in advance if this is off-topic, or it should be somewhere else.o_O

I'm venturing into the design and development of NSFW videogames, and I've been exploring the technologies that are commonly used in this field, such as Unity, Unreal Engine, Ren'Py, and so on.

I'm a Computer Scientist and have been in the software industry for several years now. I'm well-versed with a variety of languages, including but not limited to C/C++, Python, Ruby, Scala, Julia, Haskell, etc.

I've been contemplating trying something different, and that led me to Ren'Py. I have a strong grip on Python as I use it regularly in my work, but as I looked at Ren'Py's syntax, I found it not to be very Pythonic. It seems to be more like a basic language with a lot of declaration statements. I do understand this might be due to the nature of the products it's used to create.

Can someone help me understand how it really works? Is Python ever used in the creation process? From what I understand, you can generate something like:


Python:
label start:   
     python:       
         variable_python = "example string"

But I'm not certain if this is a common practice or not.:unsure:

Any Python programmers who have used Ren'Py willing to share their experiences? Your insights would be greatly appreciated!

Best regards
Cascada
 
  • Like
Reactions: TREXrg

x_309

New Member
Nov 15, 2020
7
4
13
Yes, that's common though for a single line python statement you can just prepend $ so '$ variable_ptyhon = "example string"' instead of creating a python block. For simple games python is mostly used for manipulating variables. Advanced python will be helpful for creating minigames or more advanced screen behavior but for basic VN stuff it is not needed.

 
  • Like
Reactions: TREXrg

<Code/>

Newbie
Feb 27, 2020
69
78
155
Variables are normally not created in labels, but outside them using `default` and `define`. define is for runtime constants, and default is for mutable variables.



Python:
# mc_name can be changes so that the user can choose their name at the start of the game.
default mc_name = "Bob"

# here, mc can't be changed, but singe string interpolation is being used for the name, we can still change the nameby changing mc_name
define mc = Character("[mc_name]") # [] is used for string interpolation

label start:
    $ mc_name = input("What is your name?", default="Bob") # inline python
    if len(mc_name) >= 3:
        jump start # ask them again
    "Hello [mc_name]!"

    "Welcome to the game"
Here you can more or less see the different methods beings used.
 

osanaiko

Engaged Member
Modder
Jul 4, 2017
3,354
6,440
707
Ren'Py is a framework that implements three related DSLs for making games.

It grew out a desire to replicate the "japanese dating sim visual novel" game genre but has been gradually extended to have more capability as a general platform for making various "2d" games such as management simulations, "flash game" like interactive click adventures, and similar. It is not great at making realtime 2d action games, and has extremely limited 3d effect capability. It is not especially performant, barely managing a 30fps update loop most of the time.

The source code for Renpy games language is compiled to an intermediate representation and then executed/evaluated by the Python coded game engine. Under the hood the Pygame library provides much of the graphics, sound and input management.

Things are further complicated by the following:

1. as you have been informed above, straight-up python statementsm, including classes, can be included in Renpy Script and executed at runtime. The variables in the virtual environment are accessible to python statements because references are translated.

2. As well as the primary Renpy Script DSL, there are two other DSLs: Renpy Style Lang (Style) and Renpy Animation Transform Lang (ATL). These can be defined in the same flattened source code space the Renpy Script code, with specific identifier names before the relevant block: "style" and "transform", and they can also be used in-place as sub-blocks below some renpy script commands (like image, or screen) to control the visual outputs.

Having a good command of Python is a blessing and curse when working with Renpy - until you really get used to the fact that Renpy is NOT a dialect of python but is instead a separate DSL, it can be hard to understand the differences, which are born out of different goals. However there are some advanced topics and functionality for extending Renpy which require the dev to be able to write python code. Specifically that includes "Creator Defined Displayables" (CDD) and "Creator Defined Statements" (CDS) which allow you to add higher-performance visual components, and Renpy Script language syntax extentions respectively.
 
Last edited:
  • Like
Reactions: recoba