Ren'Py RPYCs in old-game are not used to build the RPYC files in game

Doorknob22

Super Moderator
Moderator
Game Developer
Nov 3, 2017
2,208
5,325
Hi all.

I have a problem/bug where Ren'py seems to ignore files in old-game and builds new versions without it. My error-prone solution to this is to manually copy the RPYC files from old-game to game directory . Anyone running into a similar problem?

Here's a reproduction case:
Download

SHA256:
cfe4de90c8bfc64008f47555458c629227bb5c76ef99842d8b59978eb32764e3 jsimmons.zip

Unzip the project somewhere both non-special and a truly local path.

Using Ren'Py 7.5.3 SDK, point it to the project and load the save, 1-6-LT1.save. If all goes right it should crash with:
Code:
Exception: Couldn't find a place to stop rolling back. Perhaps the script changed in an incompatible way?

Quit, then hit 'Force Recompile'. This should now build the *.rpyc files from the included old-game. Launch and try loading it again.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,299
15,167
Quit, then hit 'Force Recompile'. This should now build the *.rpyc files from the included old-game.
Look at the date and time. All the RPYC files are posterior to the corresponding RPY files.

It's the reason why Ren'Py do not recompile them. For it, like the RPYC files have been generated after the last modification of the corresponding RPY files, they already are up to date and do not need to be generated again.
 

gojira667

Member
Sep 9, 2019
263
241
It's the reason why Ren'Py do not recompile them. For it, like the RPYC files have been generated after the last modification of the corresponding RPY files, they already are up to date and do not need to be generated again.
Force Recompile always rebuilds all the RPYC files and consequently should use old-game. At least it's the behavior I see here on Linux.

I actually created the reproduction project. Having the RPYC files up to date was to confirm loading the save fails initially.

Doorknob22 problem is even when he chooses Force Recompile it fails to use the RPYC files in old-game. Similarly it fails to use old-game when the RPYs are edited in game. It never seems to "see" the RPYC files in old-game for him.
 

osanaiko

Engaged Member
Modder
Jul 4, 2017
2,236
3,800
This sounds like you might have a better chance trying to get help in the official renpy forums - it's not impossible that there is some issue with recent release.

Are the "old-game" files from a renpy 7.x version, and the new build a renpy 8.x? Just speculation, but maybe the Python2->3 transition might be related?
 
Last edited:

Doorknob22

Super Moderator
Moderator
Game Developer
Nov 3, 2017
2,208
5,325
No, it’s a 7.x thing, I don’t have 8.x installed. I will try the official forums, thanks!
 

gojira667

Member
Sep 9, 2019
263
241
Are the "old-game" files from a renpy 7.x version, and the new build a renpy 8.x? Just speculation, but maybe the Python2->3 transition might be related?
So, does this work correctly for you? As in after a Force Recompile the save loads? Also, renpy-8.1.3-sdk works just fine for me here.
 

osanaiko

Engaged Member
Modder
Jul 4, 2017
2,236
3,800
So, does this work correctly for you? As in after a Force Recompile the save loads? Also, renpy-8.1.3-sdk works just fine for me here.
I'm just speculating - I'm a dilettante, and armchair commentator, an amateur who likes to heckle from the stands.

I'm not brave enough to actually complete and release an alpha version of any of the games I've tried to develop over the years. (ugh, self awareness hurts me so deep :cry:)

However, as an "in the real world" software dev, there's some things that make me suspicious that there is some human error rather than there being a bug in renpy.:

- Doorknob has confirmed it has nothing to do with the bleeding edge of renpy versions
- other devs don't seem to have reported any similar issue (that I remember)

I'd suggest going back to basics, revisit and double-check all your unspoken assumptions about what is *actually* in the files/versions/timestamps etc., and re-read the docs again.

Good luck though!
 

gojira667

Member
Sep 9, 2019
263
241
- other devs don't seem to have reported any similar issue (that I remember)

I'd suggest going back to basics, revisit and double-check all your unspoken assumptions about what is *actually* in the files/versions/timestamps etc., and re-read the docs again.
Well, it's a whole entire 1.5 meg download... The docs match the behavior I see and have tested. Not what Doorknob experiences.

I couldn't find any related bug, open or closed. I would think there would be something if it was a wider issue. Granted old-game is not very searchable.

Cheers.
 
Last edited:
  • Like
Reactions: osanaiko

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,576
2,203
[...] then hit 'Force Recompile'. This should now build the *.rpyc files from the included old-game. Launch and try loading it again.
Look at the date and time. All the RPYC files are posterior to the corresponding RPY files.

After some testing, I don't think time stamps are the issue here, although having a "old-game" folder that is newer than a "game" folder definitely set off alarm bells for me.

jsimmons-game.png

jsimmons-old-game.png


So I did a few bits an pieces to recreate the problem...

I removed the /game-bck/ folder completely (it doesn't seem necessary to this conversation.
I renamed the /old-game/ folder to /!!old-game/ (so RenPy didn't use it).
I edited each of the .rpy files within the /game/folder in minor ways (to update their timestamps).
I deleted each of the .rpyc files within the /game/ folder - to force them to be rebuilt.

I ran the game and loaded the save file. As expected, it failed.

I renamed the /!!old-game/ folder back to /old-game/.
I deleted the .rpy files from the /old-game/ ( ).
I then did a "Force Recompile".

In theory, (and as the OP assumes), this should rebuild things based on the .rpyc files within the /old-game/ folder (and the editing/rebuilding I've done should mean the timestamps are more "normal").

However, running the game and loading the save file result in the same rollback error.

I even went so far as to [BUILD] a full release... on the theory that perhaps the /old-game/ folder was only picked up by the build distribution process. Nope. That failed too.

Copying the .rpyc files from the /old-game/ folder to /game/ and then re-running the game (which will force a rebuild)... works. So those .rpyc file are compatible.

The implication being that the "Force Recompile" and RenPy's normal "rebuild the rpyc files if needed" isn't picking up the /old-game/ folder.

Finally, I tried exactly the same thing with another game I've been playing recently. Exactly the same results. Providing compatible .rpyc files within the /old-game/ folder doesn't result in a working game. But copying those same .rpyc files to the /game/ folder works fine.

I've tested it with various versions of RenPy, up to and including 8.1.3.
 

gojira667

Member
Sep 9, 2019
263
241
After some testing, I don't think time stamps are the issue here, although having a "old-game" folder that is newer than a "game" folder definitely set off alarm bells for me.
Hot damn, you tested the ever living shit out of it. No assumptions made too!(y)

I misread AON's post and thought he was talking about the files in game not needing to be recompiled. I was just happy I finally got Ren'Py to crash instead of successfully rolling back and didn't think about that when I swapped the versions around. I was a little sloppier putting this together than I realized.:coffee:

I managed to borrow a M2 Mac for a few minutes and tried the project there. It picks up old-game with no problem.

Perhaps an OS related bug? What Windows versions are you guys using?
 
Last edited:

gojira667

Member
Sep 9, 2019
263
241
Here's a patch for the SDK that adds some simple logging (backup the original first):
You don't have permission to view the spoiler content. Log in or register now.
You don't have permission to view the spoiler content. Log in or register now.

The 'File path:' lines are the old- files it's trying to find and 'Loading:' is if it was able to read some data from it. In the sample output below I deleted old-game/swt.rpyc beforehand so it has no corresponding 'Loading:' line.
You don't have permission to view the spoiler content. Log in or register now.

Doorknob22/79flavors I'm curious as to what your output looks like.
 

Doorknob22

Super Moderator
Moderator
Game Developer
Nov 3, 2017
2,208
5,325
Here's a patch for the SDK that adds some simple logging (backup the original first):
You don't have permission to view the spoiler content. Log in or register now.
You don't have permission to view the spoiler content. Log in or register now.

The 'File path:' lines are the old- files it's trying to find and 'Loading:' is if it was able to read some data from it. In the sample output below I deleted old-game/swt.rpyc beforehand so it has no corresponding 'Loading:' line.
You don't have permission to view the spoiler content. Log in or register now.

Doorknob22/79flavors I'm curious as to what your output looks like.
gojira667 Do you suggest that I edit my script.py file with the following code?
 

LightmanP

Well-Known Member
Modder
Game Developer
Oct 5, 2020
1,669
15,447
This should now build the *.rpyc files from the included old-game.
Are you sure about this? My is that old-game is needed/used only when there are none rpyc files. A use case would be if a team only commits rpy files to Github and then uses old-game for final builds between versions. I don't think that updating rpycs based on old-game when there are more up-to-date rpyc in game makes sense.

You can try removing rpyc files from game and see if it uses old-game to build new ones. Could be better to ask Tom or others how it's meant to work on Ren'Py Discord.
 

Doorknob22

Super Moderator
Moderator
Game Developer
Nov 3, 2017
2,208
5,325
Update:

Code:
print('base, _, game : ' + str(dir.rpartition("/")))
Gave me:

Code:
base, _, game : (u'C:\\Users\\User\\Downloads\\renpy-7.5.3-sdk/renpy', u'/', u'common')
C:\Users\User\Downloads\renpy-7.5.3-sdk/renpy/old-common
File path: C:\Users\User\Downloads\renpy-7.5.3-sdk/renpy/old-common/00touchkeyboard.rpyc
base, _, game : (u'C:\\Users\\User\\Downloads\\renpy-7.5.3-sdk/renpy', u'/', u'common')
C:\Users\User\Downloads\renpy-7.5.3-sdk/renpy/old-common
File path: C:\Users\User\Downloads\renpy-7.5.3-sdk/renpy/old-common/00updater.rpyc
...
base, _, game : (u'', u'', u'C:\\Temp\\jsimmons\\game')
/old-C:\Temp\jsimmons\game
File path: /old-C:\Temp\jsimmons\game/gui.rpyc
Loading: C:\Temp\jsimmons\game/gui.rpyc
base, _, game : (u'', u'', u'C:\\Temp\\jsimmons\\game')
/old-C:\Temp\jsimmons\game
File path: /old-C:\Temp\jsimmons\game/options.rpyc
Loading: C:\Temp\jsimmons\game/options.rpyc
base, _, game : (u'', u'', u'C:\\Temp\\jsimmons\\game')
/old-C:\Temp\jsimmons\game
File path: /old-C:\Temp\jsimmons\game/screens.rpyc
Loading: C:\Temp\jsimmons\game/screens.rpyc
base, _, game : (u'', u'', u'C:\\Temp\\jsimmons\\game')
/old-C:\Temp\jsimmons\game
File path: /old-C:\Temp\jsimmons\game/script.rpyc
Loading: C:\Temp\jsimmons\game/script.rpyc
base, _, game : (u'', u'', u'C:\\Temp\\jsimmons\\game')
/old-C:\Temp\jsimmons\game
File path: /old-C:\Temp\jsimmons\game/swt.rpyc
Loading: C:\Temp\jsimmons\game/swt.rpyc
...
Thoughts? Anyone? Anyone?
 
  • Like
Reactions: gojira667

gojira667

Member
Sep 9, 2019
263
241
Code:
print('base, _, game : ' + str(dir.rpartition("/")))
The corresponding line to the print, renpy/script.py#L600:
Code:
            base, _, game = dir.rpartition("/")
My working case:
Code:
base, _, game : (u'/mnt/renpy/projects/jsimmons', u'/', u'game')
/mnt/renpy/projects/jsimmons/old-game
File path: /mnt/renpy/projects/jsimmons/old-game/script.rpyc
Loading: /mnt/renpy/projects/jsimmons/old-game/script.rpyc
Given the dir path you see, I don't see how that works on any Windows?

You still have your GitHub account? You can file an . E.G. Ren'Py doesn't use the RPYC files in old-game on Windows. Include that debug output you got from adding some print statements to renpy/script.py. (y)

It either needs to handle Windows style paths or :unsure: it should have been converted beforehand.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,299
15,167
Given the dir path you see, I don't see how that works on any Windows?
It can't works with Windows because, once again, PyTom forgot to standardise the path. And it was still unfixed in the 7.6.3/8.1.3 included.

This being said, it's been more than 2 years that the "old-game" feature exist, and no one reported the obvious bug...
 
  • Like
Reactions: gojira667