Ren'Py on Raspberry PI

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
Strontium
Newbie
Posts: 2
Joined: Thu Jan 05, 2017 9:29 am
Github: stevenj
Contact:

Ren'Py on Raspberry PI

#1 Post by Strontium » Thu Jan 05, 2017 10:07 am

Hi all,

As an experiment I wanted to see if Ren'Py would run on a Raspberry PI running Linux.
Specifically I tested on Raspbian, up to date as at 4 January 2017.
And Ren'Py checked out of github on the same day.
My Raspberry PI was the PI 3.

Out of the box, it wont build. The problem is that Raspbian ships with libav and Ren'Py uses some features of ffmpeg libraries not found in libav. I installed the debian multimedia repo, updated, which pulled in ffmpeg instead of libav, and all was fine after that.

The only other library that seems to be missing is libjpg8-turbo, there is only libjpeg62-turbo so i installed that.

Otherwise, it builds using the normal python virtual environment, in the expected way, with no special settings.

It runs.
@1080P -> http://imgur.com/qlrd08N
@800x480 -> http://imgur.com/SHZj1bD

The problems:

It is very very slow to start, and even complains about taking a long time to start, however if you say ignore to the message, it starts fine.
Games also take a long time to start (I only tested "The Question") and also produce the same message about being slow.

I don't understand why it is soooo slow however. I understand its python, but people run python on raspberry pi all the time, and this is a PI3, which is a quad core 1.2Ghz machine.
I checked memory usage and its not swapping, so the 1Gig or ram seems to be sufficient.

What i do notice however is Top reports the Ren'Py process consuming about 350% cpu, just sitting at the Launcher screen.
Idle (the python IDE, written in Python, consumes about 2%)

So I dont understand why Ren'Py is consuming so much CPU time doing effectively nothing??

There are also complaints about audio under-runs when you play a game, which isn't surprising if the engine itself is consuming 3.5 cores of the 4 available.

Anyway, it definitely works otherwise, and would be a great simple game maker for schools to use on Raspberry PI hardware if it could be made to perform acceptably.

User avatar
PyTom
Ren'Py Creator
Posts: 14705
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: Ren'Py on Raspberry PI

#2 Post by PyTom » Thu Jan 05, 2017 12:17 pm

My initial guess is that it's using Mesa for OpenGL rendering. Ren'Py updates the screen 5 times a second, even when it's doing nothing else. If we're not getting hardware acceleration for that, it seems quite possible Mesa could be consuming a ton of threads, and causing performance problems.

What Ren'Py needs to run well on the Raspberry Pi platform is a way of using OpenGL ES with X11. As far as i can tell, that's been missing on the platform for years and years, which is why the various ports don't work well.

(It's possible there's some other reason for the high CPU, but we don't get it on other platforms.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Code > Drama
https://www.patreon.com/renpytom

Strontium
Newbie
Posts: 2
Joined: Thu Jan 05, 2017 9:29 am
Github: stevenj
Contact:

Re: Ren'Py on Raspberry PI

#3 Post by Strontium » Fri Jan 06, 2017 12:01 am

PyTom, you are 100% on the Money.

A bit of searching revealed that Yes, the Raspberry PI even though it has a reasonably capable GPU has been using software Mesa for OpenGL on the desktop. February last year they released an "experimental" hardware OpenGL driver which ONLY works on the Raspberry PI 2 and 3, the issue being on the other PI's there isn't enough memory for the GPU.

Enabling that using their tool "raspi-config" enabled a fully accelerated Desktop OpenGL.

On that, Ren'Py runs silky smooth on the Raspberry PI, using only about 5% CPU total for the Launcher, and about the same for "The Question". The underrun errors in audio stopped being reported also.

So, in Summary, to build and run Ren'Py on the Raspberry Pi requires the following:
0. Using Raspbian
1. A Raspberry PI 2 or 3. (I only tested a PI 3, but i dont see why a PI 2 wouldnt work)
2. Update from LibAV to FFMPEG using the Debian multimedia repository
3. Install the "experimental" 3d desktop drivers on the PI, using rasp-config.
4. Build Ren'Py as you would on x86 linux.

I would like to take this to the next step and have it run from the linux stratup script (which maybe could check the presence of the Hardware OpenGL and error out if not running) and also make it so Ren'Py can build stand-alone game packages for the Raspberry PI as another flavour of Linux. But i am not sure how to go about that. If i did this, is it something that is of interest to the main project?

Strontium

Imperf3kt
Miko-Class Veteran
Posts: 735
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Ren'Py on Raspberry PI

#4 Post by Imperf3kt » Wed May 31, 2017 6:04 am

><>
Pytom, forget it. Its impossible, don't waste your time.
Last edited by Imperf3kt on Thu Jun 01, 2017 7:34 am, edited 2 times in total.
Image

Warning: May contain trace amounts of gratuitous plot.

User avatar
PyTom
Ren'Py Creator
Posts: 14705
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: Ren'Py on Raspberry PI

#5 Post by PyTom » Wed May 31, 2017 6:49 pm

Sure. I'll dig something out and try to get to it soon.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Code > Drama
https://www.patreon.com/renpytom

User avatar
PyTom
Ren'Py Creator
Posts: 14705
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: Ren'Py on Raspberry PI

#6 Post by PyTom » Sat Jun 03, 2017 8:01 pm

As an update on this, I couldn't find my raspi, so I put in an order for a pi 3 to arrive Monday.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Code > Drama
https://www.patreon.com/renpytom

Imperf3kt
Miko-Class Veteran
Posts: 735
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Ren'Py on Raspberry PI

#7 Post by Imperf3kt » Sat Jun 03, 2017 10:07 pm

I appreciate you helping on this matter. I did some googling and it seems that getting SDL2 to build is the most common difficulty in running Renpy on a Raspberry Pi

Be aware that you might need to change one line in the Github:

Code: Select all

export RENPY_DEPS_INSTALL="/usr::/usr/lib/arm-linux-gnueabihf/"
Since you are using ARM and not x86


E: I think I may have finally figured out most of it, but now I cannot install FFMPEG library. I keep getting permission denied errors when trying to edit my sources.list
(plus I have no idea what I'm doing)

And what does "experimental" mean?
I see the following (nothing about experimantal)
Raspberry Pi Software Configuration Tool (raspi-config) ├──────────┐
│ │
│ G1 GL (Full KMS) OpenGL desktop driver with full KMS │
│ G2 GL (Fake KMS) OpenGL desktop driver with fake KMS │
│ G3 Legacy Original non-GL desktop driver

Enabling option one makes the Pi almost unusable, the screen is severely screwed up and does not display properly at all.
G2 is what I'm using now, I see no change from whatever is used as default.
Legacy also does nothing different as far as the end user can see.
Image

Warning: May contain trace amounts of gratuitous plot.

User avatar
PyTom
Ren'Py Creator
Posts: 14705
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: Ren'Py on Raspberry PI

#8 Post by PyTom » Sat Jun 03, 2017 11:45 pm

I don't know, offhand. I do this sort of thing for my day-job living. So I'll figure it out when the hardware arrives.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Code > Drama
https://www.patreon.com/renpytom

Imperf3kt
Miko-Class Veteran
Posts: 735
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Ren'Py on Raspberry PI

#9 Post by Imperf3kt » Sun Jun 04, 2017 3:31 am

I highly appreciate it.
If you chuck me a PM with your paypal details, I'll make good on my promise to send $20USD to whoever helps me get this running.
Or if you prefer, I can make a donation via your patreon. Are anonymous donations possible there?

I'm lost as to what I need to do to use FFMPEG instead of LibAV
The internet is not much use for a guy who doesn't understand gibberish.

I get this while trying to do python setup.py install
ffmedia.c:3:38: fatal error: libswresample/swresample.h: No such file or directory
#include <libswresample/swresample.h>
^
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
Image

Warning: May contain trace amounts of gratuitous plot.

Imperf3kt
Miko-Class Veteran
Posts: 735
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Ren'Py on Raspberry PI

#10 Post by Imperf3kt » Tue Jun 06, 2017 6:14 am

Alright, it took a few weeks, but I've got it all sorted now. That was a bit of a steep learning curve.

Regarding everything required, I will be putting together a detailed guide on the process. Would you consider adding it to the github, since a few steps differ slightly from the instructions found there.
I must thank Strontium for his/her part in this process, I found the advice here invaluable.

I am still willing to send you the aforementioned compensation, so that offer is still open if you wish.
Thank you for your patience with me.

Image
Image

Warning: May contain trace amounts of gratuitous plot.

User avatar
PyTom
Ren'Py Creator
Posts: 14705
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: Ren'Py on Raspberry PI

#11 Post by PyTom » Tue Jun 06, 2017 10:59 am

Congratulations. I'd love to see the guide, and would be happy to add it somewhere.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Code > Drama
https://www.patreon.com/renpytom

Imperf3kt
Miko-Class Veteran
Posts: 735
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Ren'Py on Raspberry PI

#12 Post by Imperf3kt » Thu Jun 15, 2017 5:37 am

So before I make the guide, I decided it best to fully prepare everything.
This included adding Ren'Py to the main menu.

I've run into a bunch of issues over the past week.

To place a shortcut in the main menu, I require a single command line. This is a problem as launching Ren'Py requires three lines.
So the obvious work around is to point to a shell script that instead runs the commands.

I have the following inside ~/renpy/renpy.sh

Code: Select all

#!/bin/bash
echo "Preparing to Launch Ren'Py"
workon renpy &
sleep 1
python -O /home/pi/renpy/renpy.py
echo "Waiting 5 seconds before closing the terminal"
sleep 5
Then I made it executable

Code: Select all

sudo chmod 755 /home/pi/renpy/renpy.sh
However, there is an issue.
If I use

Code: Select all

cd ~/renpy
workon renpy
python -o renpy.py
Ren'Py launches without issue.

However, running the script, returns

Code: Select all

Preparing to Launch Ren'Py
/home/pi/renpy/renpy.sh: line 3: workon: command not found
Could not import pygame_sdl2. Please ensure that this program has been built
and unpacked properly. Also, make sure that the directories containing
this program do not contain : or ; in their names.

You may be using a system install of python. Please run renpy.sh,
renpy.exe, or renpy.app instead.

Traceback (most recent call last):
  File "/home/pi/renpy/renpy.py", line 199, in <module>
    main()
  File "/home/pi/renpy/renpy.py", line 196, in main
    renpy.bootstrap.bootstrap(renpy_base)
  File "/home/pi/renpy/renpy/bootstrap.py", line 235, in bootstrap
    import pygame_sdl2
ImportError: No module named pygame_sdl2
Waiting 5 seconds before closing the terminal
I'm unable to solve this and have been trying all week. I'm frustrated and tired.
Any clues?
Image

Warning: May contain trace amounts of gratuitous plot.

Post Reply

Who is online

Users browsing this forum: No registered users