Prototying Week!
Added 2018-06-24 04:44:23 +0000 UTCv0.6.0 is out for bug testing right now (thank you to everyone who's left me a bug report so far!). I normally use the time between the public and patron release to prototype features that are either very early in development or that might not make it into the final game, but this week I have a different goal in mind.
For a few versions now a number of people, myself included, have noticed a significant slowdown in LR2 as the game progresses. My goal for this week is to track the cause of that slowdown down and eliminate it, as well as give myself some diagnostic tools for future bug hunting. I'll also be rendering out some new character positions and experimenting with some compression techniques to shrink the game file size if possible.
My current hunch for the slowdown is that somewhere along the character creation process a character is grabbing a copy of the clothing library instead of referencing the static images, and that this is resulting in a massive duplication of data every time a character is created. To test this I will be writing some debugging functions that time how long it takes to create a character, move them around, ect. Then I will see if the time scales up with the total number of people in existence, total number of people interacted with, and so on. Hopefully this will lead me to the root cause of the slowdown.
Comments
I just wrote up a post picking apart the bug, why it cause the problems it cause, and how it's been resolved. (tl;dr: improper use of deep copies lead to massive data duplication). The random event generation at the end of the turn is currently something that takes up less than a hundredth of a second and would increase exponentially with the number of events rather than the size of the current game, so it's not something I'm worried about yet (but might have to fiddle with later, we'll see!)
Vren
2018-06-25 06:59:05 +0000 UTCIt's been found and fixed, v0.6.1 will be released on Wednesday and will include a couple major bug fixes.
Vren
2018-06-25 06:54:39 +0000 UTCVren: When I see issues like that in my simulations, the problem is a process that grows exponentially with the number of agents. I've poked around in a lot of the .py files to see what sort of algorithms you employ, and there are some that pick a rabbit out of the hat. Assuming I am reading the code correctly (and forgive me, I'm a Tcl and C programmer) your code is putting all of the rabbits into a sorted data structure and then picking a random element. When it goes to pick another random element... everybody goes back into the bucket. As your pool of characters expands, the sort is going to grow exponentially. I had a similar issue with a system that would pick a random quote from a large database of quotes, and slap it into the margins of a website. The answer was to build a temporary data structure to represent all of the possibilities in a stack, like a stack of cards. I would draw cards until the deck was empty, and then shuffle up a new deck.
2018-06-24 22:58:02 +0000 UTC0
blakeness
2018-06-24 22:07:32 +0000 UTCFatal error -I'm sorry, but an uncaught exception occurred. While running game code: File "game/script.rpy", line 4406, in script call python: File "game/script.rpy", line 5123, in script call screen serum_design_ui(SerumDesign(),[]) #This will return the final serum design, or None if the player backs out. File "renpy/common/000statements.rpy", line 485, in execute_call_screen store._return = renpy.call_screen(name, *args, **kwargs) File "renpy/common/00action_other.rpy", line 501, in __call__ rv = self.callable(*self.args, **self.kwargs) File "game/script.rpy", line 3127, in remove_trait_recalc trait.status_effects.extend(the_trait.status_effects) MemoryError: -- Full Traceback ------------------------------------------------------------ Full traceback: File "F:\Lab_Rats_2-v0.6.0-pc\renpy\bootstrap.py", line 306, in bootstrap renpy.main.main() File "F:\Lab_Rats_2-v0.6.0-pc\renpy\main.py", line 523, in main run(restart) File "F:\Lab_Rats_2-v0.6.0-pc\renpy\main.py", line 149, in run renpy.execution.run_context(True) File "F:\Lab_Rats_2-v0.6.0-pc\renpy\execution.py", line 835, in run_context context.run() File "game/script.rpy", line 4406, in script call python: File "game/script.rpy", line 5123, in script call screen serum_design_ui(SerumDesign(),[]) #This will return the final serum design, or None if the player backs out. File "F:\Lab_Rats_2-v0.6.0-pc\renpy\ast.py", line 1801, in execute self.call("execute") File "F:\Lab_Rats_2-v0.6.0-pc\renpy\ast.py", line 1789, in call return renpy.statements.call(method, parsed, *args, **kwargs) File "F:\Lab_Rats_2-v0.6.0-pc\renpy\statements.py", line 169, in call return method(parsed, *args, **kwargs) File "renpy/common/000statements.rpy", line 485, in execute_call_screen store._return = renpy.call_screen(name, *args, **kwargs) File "F:\Lab_Rats_2-v0.6.0-pc\renpy\exports.py", line 2655, in call_screen rv = renpy.ui.interact(mouse="screen", type="screen", roll_forward=roll_forward) File "F:\Lab_Rats_2-v0.6.0-pc\renpy\ui.py", line 287, in interact rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs) File "F:\Lab_Rats_2-v0.6.0-pc\renpy\display\core.py", line 2624, in interact repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs) File "F:\Lab_Rats_2-v0.6.0-pc\renpy\display\core.py", line 3417, in interact_core rv = root_widget.event(ev, x, y, 0) File "F:\Lab_Rats_2-v0.6.0-pc\renpy\display\layout.py", line 986, in event rv = i.event(ev, x - xo, y - yo, cst) File "F:\Lab_Rats_2-v0.6.0-pc\renpy\display\transition.py", line 45, in event return self.new_widget.event(ev, x, y, st) # E1101 File "F:\Lab_Rats_2-v0.6.0-pc\renpy\display\layout.py", line 986, in event rv = i.event(ev, x - xo, y - yo, cst) File "F:\Lab_Rats_2-v0.6.0-pc\renpy\display\layout.py", line 986, in event rv = i.event(ev, x - xo, y - yo, cst) File "F:\Lab_Rats_2-v0.6.0-pc\renpy\display\screen.py", line 667, in event rv = self.child.event(ev, x, y, st) File "F:\Lab_Rats_2-v0.6.0-pc\renpy\display\layout.py", line 986, in event rv = i.event(ev, x - xo, y - yo, cst) File "F:\Lab_Rats_2-v0.6.0-pc\renpy\display\layout.py", line 986, in event rv = i.event(ev, x - xo, y - yo, cst) File "F:\Lab_Rats_2-v0.6.0-pc\renpy\display\layout.py", line 239, in event rv = d.event(ev, x - xo, y - yo, st) File "F:\Lab_Rats_2-v0.6.0-pc\renpy\display\layout.py", line 986, in event rv = i.event(ev, x - xo, y - yo, cst) File "F:\Lab_Rats_2-v0.6.0-pc\renpy\display\behavior.py", line 897, in event return handle_click(self.clicked) File "F:\Lab_Rats_2-v0.6.0-pc\renpy\display\behavior.py", line 832, in handle_click rv = run(action) File "F:\Lab_Rats_2-v0.6.0-pc\renpy\display\behavior.py", line 299, in run new_rv = run(i, *args, **kwargs) File "F:\Lab_Rats_2-v0.6.0-pc\renpy\display\behavior.py", line 306, in run return action(*args, **kwargs) File "renpy/common/00action_other.rpy", line 501, in __call__ rv = self.callable(*self.args, **self.kwargs) File "game/script.rpy", line 3127, in remove_trait_recalc trait.status_effects.extend(the_trait.status_effects) File "F:\Lab_Rats_2-v0.6.0-pc\renpy\python.py", line 672, in do_mutation return method(self, *args, **kwargs) MemoryError: Windows-8-6.2.9200 Ren'Py 6.99.14.1.3218 Lab Rats 2 - Down to Business v0.6.0 Sun Jun 24 18:03:12 2018
blakeness
2018-06-24 22:06:41 +0000 UTCLooks like there is an error when any of the girls get to loyalty over 130. My game pops up errors when I talk to them and then auto exits the conversation. It also pops up errors when I click the detail information screen.
M M S
2018-06-24 21:17:18 +0000 UTCI think I can agree with that assessment, I also associate the slowdowns with my activity. So, the first place to look at should be the rollback code, IMHO. I suspect it's even saved so that when you load the game, you're back in the slowdown zone.
Piotr Sulecki
2018-06-24 17:52:38 +0000 UTCStudy up on algorithms too, they are your bestest of best friends when it comes to performance by far! :p
waffel
2018-06-24 10:12:43 +0000 UTCJust as a data point, for me the slowdown seemed to increase noticeably the more I clicked on menu items, even if I wasn't doing anything that brought in a new character (unless that is happening in a way I can't detect/control). I assumed it was something related either to the shading/textures or the action history.
Dubsington
2018-06-24 05:35:25 +0000 UTC