A better solution than nested if else statements

Diconica

Well-Known Member
Apr 25, 2020
1,101
1,150
Interesting, I will probably have a look at some point.


Which is exactly the purpose of RenPy. To be as approachable as possible. Sure, if you can code your own engine you don't have to use RenPy, but hardly any creator out there can.
When you try to make something as streamlined as possible and with a very low entry barrier, you cut corners in raw performance, it's just how it is.

The whole point is for a framework that people with little/no coding background can use as easily as possible, not try to take UE head on in performance. And it just works for the kind of games that utilize it.
We're not talking about professional studios here, but hobbyists that try to make a game.
In some extent I agree with what you said here. In another I don't.
The reason I don't is a project I am working on. Imagine you could see the entire visual novel from a perspective you could see all the scenes and how they are tied together. Then being able to click on those nodes and edit them without a single line of code being used. It has a lot more as well including AI per character. No need to program. You drag in assets name them. You use a selection system for all the character AI stuff and standard variables.
Anyway its built on top of the c++ version of that.

What it doesn't do at present is allow for the developer to try and create a different form of game. Its really based around the visual novel system and cutting out that work.

What I provided was simply a frame work. Its what you put on top that determines the use of it.
That's the problem with Renpy what it was designed for vs what people are trying to use it for.
Just because you can doesn't mean you should.

There are other aspects Renpy's font system is actually from pygame's use of SDL. Unfortunately SDL's font system is slow.
If you want speed you can use it at the start of a game to generate glyphs and then use glyphs rather than the font system.
That means a good bit more code especially if you want to maintain the utf8 and unicode compatibility. Which you do if you want to allow other languages besides English. I know from experience I had to write a utf8 unicode converter. A language system to allow swapping from one to another and selecting fonts that matched.

The short answer is if you want performance it takes work. You can even have performance at a low level for beginners.
Some times performance isn't so much a matter of work but simply lack of knowledge.
 

Diconica

Well-Known Member
Apr 25, 2020
1,101
1,150
I feel like this thread is missing a really really large point of why people use Renpy. Just look at the sheer amount of games here that are developed by either a single person, or maybe two people. Between doing artwork, telling the story and having to make it work in Renpy I think you will find that maybe like 75% won't get more advanced than an if/else statement (I certainly can't in python).
Sure having fancy code that makes it faster is nice, but if you don't understand a single thing it does it's not very useful at all. Judging by the amount of "failed/abandoned" projects here most people are already in over their heads. Having to spend another full week learning the ins and outs of python is just not realistic.
I agree with a lot of developers it looks like their delve into programming came to an end when they learned if else.
They will never learn more unless someone points out there are better ways.
 

Ambir

Adult games developer
Game Developer
Aug 7, 2020
846
1,165
Or you can use Ren'Py, and see a whole class become four totally basics lines...

Code:
init python:
    config.label_overrides["Home_1_6:00"] = "hello"
    config.label_overrides["Home_1_6:01"] = "bye"
    config.label_overrides["Home_1_6:02"] = "dance"

label hello:
    "Hello"
    return

label bye:
    "Bye"
    return

label dance:
    "Dance"
    return

label hasEvent:
    $ l = "{}_{}_{}".format( Location, Day, gTime )
    if renpy.has_label( l ):
        call expression l
    return

label start:
    $ Location = "Home"
    $ Day = 1
    $ gTime = "5:00"

    call hasEvent
    $ gTime = "6:00"
    call hasEvent
    $ gTime = "6:01"
    call hasEvent
    $ gTime = "6:02"
    call hasEvent
    "Finished"
Four lines that can become three:
Code:
label hasEvent:
    $ l = "{}_{}_{}".format( Location, Day, gTime )
    $ if renpy.has_label( l ): renpy.call( l )
    return
Or even two:
Code:
label hasEvent:
    $ if renpy.has_label( "{}_{}_{}".format( Location, Day, gTime ) ): renpy.call( "{}_{}_{}".format( Location, Day, gTime ) )
    return
I did not know you could do something like this. Came here out of curiosity, but honestly this makes handling labels so much easier... It's not even funny.

Not quite certain I understand what the other guy was trying to do, but I defo will be taking note of your code.