Windows/Android difference

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Apa
Regular
Posts: 103
Joined: Fri Dec 23, 2016 2:26 am
Location: NYC
Contact:

Windows/Android difference

#1 Post by Apa » Sat Dec 16, 2017 7:43 pm

Tom,
I see a difference between Windows and Android versions, want to clarify, it’s intended. :?:
It took me a while to isolate it due to Android slow build process.
The script below works fine on Windows.
It fails on Android with uncaught exception:

Code: Select all

File "game/script.rpy", line 9, in <module>
Exception: Displayables may not be rendered during the init phase.
With
define credits_text = '...'
The error will change to:

Code: Select all

AttributeError: 'NoneType' object has no attribute 'draw_per_virt'
With uncommented line #7

Code: Select all

    # "start" # 3
it’ll work fine on Android

script.rpy

Code: Select all

define credits_text = '{image=center.png}' # 1
#define credits_text = '...' # 2

define credits_textd = Text(credits_text, color='#ffffff', text_align=0.5)

label start:
    # "start" # 3
    $devlog.info("start")
    $credits_text_size = credits_textd.size()

    "done"
    $devlog.info("done")
    $renpy.quit()
    
    return

# auto start
label main_menu:
    return
traceback0.txt

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 9, in <module>
Exception: Displayables may not be rendered during the init phase.

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "/data/user/0/test2.tst/files/renpy/bootstrap.py", line 305, in bootstrap
    renpy.main.main()
  File "/data/user/0/test2.tst/files/renpy/main.py", line 499, in main
    run(restart)
  File "/data/user/0/test2.tst/files/renpy/main.py", line 147, in run
    renpy.execution.run_context(True)
  File "/data/user/0/test2.tst/files/renpy/execution.py", line 795, in run_context
    context.run()
  File "script.rpyc", line 9, in script
  File "/data/user/0/test2.tst/files/renpy/ast.py", line 827, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "/data/user/0/test2.tst/files/renpy/python.py", line 1764, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/script.rpy", line 9, in <module>
  File "/data/user/0/test2.tst/files/renpy/text/text.py", line 1727, in size
    renders[i] = renpy.display.render.render(i, width, self.style.size, st, at)
  File "renpy/display/render.pyx", line 110, in renpy.display.render.render (gen/renpy.display.render.c:3445)
  File "renpy/display/render.pyx", line 143, in renpy.display.render.render (gen/renpy.display.render.c:2308)
Exception: Displayables may not be rendered during the init phase.
traceback1.txt

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 9, in <module>
AttributeError: 'NoneType' object has no attribute 'draw_per_virt'

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "/data/user/0/test2.tst/files/renpy/bootstrap.py", line 305, in bootstrap
    renpy.main.main()
  File "/data/user/0/test2.tst/files/renpy/main.py", line 499, in main
    run(restart)
  File "/data/user/0/test2.tst/files/renpy/main.py", line 147, in run
    renpy.execution.run_context(True)
  File "/data/user/0/test2.tst/files/renpy/execution.py", line 795, in run_context
    context.run()
  File "script.rpyc", line 9, in script
  File "/data/user/0/test2.tst/files/renpy/ast.py", line 827, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "/data/user/0/test2.tst/files/renpy/python.py", line 1764, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/script.rpy", line 9, in <module>
  File "/data/user/0/test2.tst/files/renpy/text/text.py", line 1729, in size
    layout = Layout(self, width, height, renders, size_only=True)
  File "/data/user/0/test2.tst/files/renpy/text/text.py", line 472, in __init__
    self.oversample = renpy.display.draw.draw_per_virt
AttributeError: 'NoneType' object has no attribute 'draw_per_virt'

User avatar
Imperf3kt
Eileen-Class Veteran
Posts: 1756
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Windows/Android difference

#2 Post by Imperf3kt » Sat Dec 16, 2017 7:58 pm

Change

Code: Select all

Label main_menu:
To something else. The name "main_menu" is already in use by the screens 'main_menu'
Image

Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Apa
Regular
Posts: 103
Joined: Fri Dec 23, 2016 2:26 am
Location: NYC
Contact:

Re: Windows/Android difference

#3 Post by Apa » Sat Dec 16, 2017 10:43 pm

Imperf3kt wrote:
Sat Dec 16, 2017 7:58 pm
Change

Code: Select all

Label main_menu:
To something else. The name "main_menu" is already in use by the screens 'main_menu'
Sorry, what you do mean exactly? :?

I'm complete newbie in RenPy... Just trying to skip non essential things, that's all. :oops:
AFAIR, Tom asked to do it on bug submission.
If it (name "main_menu") offends you - feel free to remove it.

User avatar
PyTom
Ren'Py Creator
Posts: 15202
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Windows/Android difference

#4 Post by PyTom » Sun Dec 17, 2017 2:16 am

I think I know what the problem is.

For now a reasonable workaround is probably:

Code: Select all

label start:
    # "start" # 3
    $devlog.info("start")
    pause 0
    $credits_text_size = credits_textd.size()
But this is probably something I should fix. (The issue is that we delay the GUI initialization on Android and iOS to keep the splashscreen up as long as possible, but without an initialized GUI, text layout can't work.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
Imperf3kt
Eileen-Class Veteran
Posts: 1756
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Windows/Android difference

#5 Post by Imperf3kt » Sun Dec 17, 2017 3:26 am

Apa wrote:
Sat Dec 16, 2017 10:43 pm
Imperf3kt wrote:
Sat Dec 16, 2017 7:58 pm
Change

Code: Select all

Label main_menu:
To something else. The name "main_menu" is already in use by the screens 'main_menu'
Sorry, what you do mean exactly? :?

I'm complete newbie in RenPy... Just trying to skip non essential things, that's all. :oops:
AFAIR, Tom asked to do it on bug submission.
If it (name "main_menu") offends you - feel free to remove it.
I mean that you have called a label "main_menu" but "main_menu" is a reserved name and you should not use it.
https://www.renpy.org/doc/html/reserved.html
https://www.renpy.org/doc/html/store_va ... -main_menu


It wasn't anything to do with the error you were receiving.
Image

Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Apa
Regular
Posts: 103
Joined: Fri Dec 23, 2016 2:26 am
Location: NYC
Contact:

Re: Windows/Android difference

#6 Post by Apa » Sun Dec 17, 2017 1:36 pm

Tom,

Code: Select all

label start:
    pause 0
worked.
Thank a lot for workaround! :D

PyTom wrote:
Sun Dec 17, 2017 2:16 am
But this is probably something I should fix. (The issue is that we delay the GUI initialization on Android and iOS to keep the splashscreen up as long as possible, but without an initialized GUI, text layout can't work.
Got it.
Do you track this issue somehow, i.e. anyway to know when it’s resolved?
Might be worth to mention on platform differences page until then?
AFAIR, Android is not top priority on your list, exactly. Don't know about iOS tho...


Imperf3kt wrote:
Sun Dec 17, 2017 3:26 am
I mean that you have called a label "main_menu" but "main_menu" is a reserved name and you should not use it.
I know what label "main_menu" means, I guess everybody does. :shock:

Apa wrote:
Sat Dec 16, 2017 10:43 pm
I'm complete newbie in RenPy... Just trying to skip non essential things, that's all. :oops:
AFAIR, Tom asked to do it on bug submission.
Once again, I was following the Bug Replications guideline.
PyTom wrote:
Wed Mar 27, 2013 9:43 pm
* Disable splashscreens and other time-consuming portions of the program.
* If the bug doesn't show up at the main menu, consider disabling the main menu
* Ensure that the bug show up within a click or two of program start.
I terribly sorry about it... :oops:


Out of curiosity, what is the proper way to skip main menu without using "main_menu" label?
Or overwrite any other default behavior? :?:

User avatar
Ocelot
Miko-Class Veteran
Posts: 849
Joined: Tue Aug 23, 2016 10:35 am
Skype: miinipaa
Contact:

Re: Windows/Android difference

#7 Post by Ocelot » Sun Dec 17, 2017 1:45 pm

Usinп main_menu label is, in fact, proper way to skip main menu:
https://www.renpy.org/doc/html/label.ht ... ial-labels
Documentation wrote:main_menu
    If it exists, this label is called instead of the main menu. If it returns, Ren'Py will start the game at the start label. For example, the following will immediately start the game without displaying the main menu.

Code: Select all

    label main_menu:
        return
< < insert Rick Cook quote here > >

User avatar
PyTom
Ren'Py Creator
Posts: 15202
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Windows/Android difference

#8 Post by PyTom » Sun Dec 17, 2017 5:12 pm

Apa did right.

It's being tracked at https://github.com/renpy/renpy/issues/1316 , eta in the next day or so, before 6.99.14 prereleases.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
Imperf3kt
Eileen-Class Veteran
Posts: 1756
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Windows/Android difference

#9 Post by Imperf3kt » Sun Dec 17, 2017 5:54 pm

Thanks.
Guess I learnt something.
Image

Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Apa
Regular
Posts: 103
Joined: Fri Dec 23, 2016 2:26 am
Location: NYC
Contact:

Re: Windows/Android difference

#10 Post by Apa » Sun Dec 17, 2017 6:23 pm

PyTom wrote:
Sun Dec 17, 2017 5:12 pm
It's being tracked at https://github.com/renpy/renpy/issues/1316 , eta in the next day or so, before 6.99.14 prereleases.
I'll check nightly in a couple days.
If you post in this thread when't fix is done, I'll try test and let you know right away! :D
Thank you

Post Reply

Who is online

Users browsing this forum: No registered users