- Jan 31, 2020
- 87
- 243
Use istWhat exactly are you using to display videos?
More on topic, why are you asking about it in this thread?
image triss = Movie(play="wayhome1.webm")
this is why
Ren'Py optimization tips?
Use istWhat exactly are you using to display videos?
More on topic, why are you asking about it in this thread?
12 log.log[20138].context.dynamic_stack[4991] = <dict>
0 log.log[20138].context.dynamic_stack[4992][u'_args'] = alias None
0 log.log[20138].context.dynamic_stack[4992][u'from_assign'] = alias False
0 log.log[20138].context.dynamic_stack[4992][u'_kwargs'] = alias None
0 log.log[20138].context.dynamic_stack[4992][u'from_room'] = alias False
6 log.log[0].context.call_location_stack[11056] = <tuple>
0 log.log[0].context.call_location_stack[11057][0] = alias u'game/_story/hunt/plains.rpy'
1 log.log[0].context.call_location_stack[11057][1] = 1648860522
1 log.log[0].context.call_location_stack[11057][2] = 16343
1 log.log[0].context.return_stack[12214][0] = u'game/_story/hunt/plains.rpy'
1 log.log[0].context.return_stack[12214][1] = 1648860522
1 log.log[0].context.return_stack[12214][2] = 16344
7 log.log[0].context.return_stack[12214] = <tuple>
0 log.log[5].context.abnormal_stack[4617] = alias False
Judging from this, it looks like you call stack is... 12214 levels deep (holy shit!)1 log.log[0].context.return_stack[12214][2] = 16344
renpy.call_stack_depth()
renpy.game.context().return_stack
jump
with arguments, which call
kinda supplies, but obviously that leads to these problems seen here. I don't think some return
s will ever be reached, so merely adding them will not help. I can imagine some ways out of it... Like some global variable for these specific calls, perhaps, but this seems so... wrong.renpy.get_return_stack()
seems to do the same, and gives me 20k+ levels. Fortunately, Ren'Py doesn't try to show all of these at once, since it's a list. I tried replacing this with renpy.set_return_stack()
, which seemed to do nothing useful wrt save size.Most of these are the same 'game/_story/hunt/plains.rpy'. Which is strange, because the main label inside that isTry something like renpy.get_return_stack()[:20] to see the first 20 entries or so
jump
ed into and out of, and the few call
s inside all have return
s and I'm 90% plus certain they also always reach these return
s.call
ed, only jump
ed into and out of.Because renpy needs the filename and some kind of line number/hash to know where to return toWhy are these entries by script filename and not label name, anyway?
No, they are in there because they got called from somewhere and never returned. I have never seen a return stack size of more than 4-5 in my game, and I call things all the time. So there is an error in the logic somewhereThat might be tied to them being in there, forever.
But some of them are stored as label names. So clearly that is not universally true.Because renpy needs the filename and some kind of line number/hash to know where to return to
There's a ton of things that getSo there is an error in the logic somewhere
call
ed (and called, and called) as a replacement for jump
with arguments. I really should do something about that, but I'm not sure that will help because...renpy.game.log.log = []
. Saves are down by a factor of 18+ (a bit under a Mb, which is reasonable given how much data there is), save dump is down to ~28Mb, mini-freezes seem to be slightly reduced in power. I never wanted rollback in the first place, and turned it off somewhere in the middle of the test save, so that might explain some of it.It's that, yes.Judging from this, it looks like you call stack is... 12214 levels deep (holy shit!)
Any way to clear the existing call stack?
init python:
def cleanCallStack():
while renpy.call_stack_depth():
renpy.pop_call()
label whatever:
$ cleanCallStack()
It's not true for screens, the "call" inI don't think this is true for screens?
call screen
have another meaning.Because there's screen that can be shown and not called.Why else are there 'hide screen' and other things like that?
It imply a bit more codding, but you can perfectly pass the arguments through an external dict and therefore useI'm looking at them calls right now, and I have the problem that in a few places I basically need ajump
with arguments, whichcall
kinda supplies, but obviously that leads to these problems seen here.
jump
. Something like:label whatever:
call myCalledLabel( "abc", 1 )
[...]
label myCalledLabel( name, value ):
if name == "abc":
[...]
label whatever:
$ params = { "name":"abc", "value":1 }
jump myCalledLabel
[...]
label myCalledLabel:
if params["name"] == "abc":
[...]
Then there's a enormous design flaw in the code.I don't think somereturn
s will ever be reached, so merely adding them will not help.
If I remember correctly, you said that the save file size grow significantly over time. This mean that there's none returned called labels. While it's perhaps not the only cause, the huge call stack is part of the problem, and its size increase over time.Most of these are the same 'game/_story/hunt/plains.rpy'. Which is strange, because the main label inside that isjump
ed into and out of, and the fewcall
s inside all havereturn
s and I'm 90% plus certain they also always reach thesereturn
s.
Edit: The other common one is a label (and that one is by it's label name) that is nevercall
ed, onlyjump
ed into and out of.
The worse I seen before was with a totally broken, and abandoned since years, game that goes up to 100 entry in the call stack. I admit that I'm impressed by the size of this one.I have never seen a return stack size of more than 4-5 in my game, and I call things all the time.
Python:while renpy.call_stack_depth(): renpy.pop_call()
A called screen can be hidden and not 'Return()'-ed, no? Which means a called screen is not required to beBecause there's screen that can be shown and not called.
return
ed from, as I understand it.Yeah, I thought of that. Means a lot of combing the scripts, but I guess I do need to close this insanity down at some point.It imply a bit more codding, but you can perfectly pass the arguments through an external dict...
Yep, that one's entirely on me. Edit: Or maybe not entirely, but definitely mostly.Then there's a enormous design flaw in the code.
See my last post. Wiping the rollback cut down on all of this by a huge margin. I guess the call stack itself is still there and growing, so that's not all of it, but it's like 90%+ better now.If I remember correctly, you said that the save file size grow significantly over time.
I aim to please!I admit that I'm impressed by the size of this one.
renpy.game.log.log = []
seems to have a more immediate effect. Unfortunately, Ren'Py is insisting on repopulating this, and while it's not going overboard (yet?), it is increasing saves a little. I also can't put a call (heh, function call) to this before a save, because rollback doesn't apparently like this and complains about emptyness, while manually clearing it and then saving works. Strange.config.rollback_length
. I suppose the log issues are mostly fine now. I only I knew what the other cause(s) of the mini-freezes might be.Well, “1” is also an object, because it's an object in PythonIn$ loveCounter += 1
, the only thing that isn't an object is "1".
With all due respect that's not helpful to the issue here - it's fundamental to the way Jman has coded his game to "call" to labels and then not consistently "return" to remove the frame from the callstack. If you don't read the thread it's hard to make a useful contribution based on thread title only.I'm a bit too lazy to read everything if it was discussed, but there are a bunch of tools that optimize your code like that new one from OpenAI (or DeepMind), DeepCode, etc. Those are pretty solid from what I've heard, and all can handle Python.