Page 1 of 1

Windows/Android difference

Posted: Sat Dec 16, 2017 7:43 pm
by Apa
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'

Re: Windows/Android difference

Posted: Sat Dec 16, 2017 7:58 pm
by Imperf3kt
Change

Code: Select all

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

Re: Windows/Android difference

Posted: Sat Dec 16, 2017 10:43 pm
by Apa
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.

Re: Windows/Android difference

Posted: Sun Dec 17, 2017 2:16 am
by PyTom
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.

Re: Windows/Android difference

Posted: Sun Dec 17, 2017 3:26 am
by Imperf3kt
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.

Re: Windows/Android difference

Posted: Sun Dec 17, 2017 1:36 pm
by Apa
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 pmI'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? :?:

Re: Windows/Android difference

Posted: Sun Dec 17, 2017 1:45 pm
by Ocelot
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

Re: Windows/Android difference

Posted: Sun Dec 17, 2017 5:12 pm
by PyTom
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.

Re: Windows/Android difference

Posted: Sun Dec 17, 2017 5:54 pm
by Imperf3kt
Thanks.
Guess I learnt something.

Re: Windows/Android difference

Posted: Sun Dec 17, 2017 6:23 pm
by Apa
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