Before I begin, here are my pc stats:
Intel Core i7 870 @ 2.93GHz
14 GB Ram
Windows 10 x64
GeForce GTX 1050 Ti 4GB (Display)
GeForce GT 730 2GB (secondary, for cuda render stacking)
It is a fairly old machine, but it handles most other things, and other game engines like Unity, with relative ease, so I assumed it isn't the machine, but I could be wrong.
Anyway onto the game. It's currently quite short (2k words / 2300 lines) consisting of 137, 1280x853 sized PNG files that have been compressed down for size. These files are pre-rendered images, so in game, all I'm doing is loading an old image out, and placing a new image in - no need for layering sprites over them, it's a slideshow of sorts. I initially was using show and hide, but switched to using scenes and turning all of the images into children of a single scene (sc 1 - sc 100, for example) as I read this minimizes memory usage since you're unloading the old ones and loading in the new ones as needed. Here is an example of a short section:
Code: Select all
scene s 45
with dissolve
tay "Do you hang with Tash much?"
scene s 55
with dissolve
desi "Oh, actually not really. More like, friend of a friend type of deal?"
scene s 60
with dissolve
tay "She does seem to hang with a different crowd now..."
scene s 55
with dissolve
desi "She wasn't always a party animal?"
scene s 46
with dissolve
tay "Our version of partying was smoking up and watching anime..."
scene s 63
with dissolve
Code: Select all
screen handbagOptions1():
add "buttons/map2_ground.png"
imagebutton auto "buttons/m2_wine_%s.png" action Jump('wine') xpos 0 ypos 0 focus_mask True
#imagebutton auto "buttons/m2_perfume_%s.png" action Jump('perfume') xpos 0 ypos 0 focus_mask True
#imagebutton auto "buttons/m2_brush_%s.png" action Jump('brush') xpos 0 ypos 0 focus_mask True
imagebutton auto "buttons/m2_cigg_%s.png" action Jump('cigg') xpos 0 ypos 0 focus_mask True
#imagebutton auto "buttons/m2_cream_%s.png" action Jump('cream') xpos 0 ypos 0 focus_mask True
#imagebutton auto "buttons/m2_eyeliner_%s.png" action Jump('eyeliner') xpos 0 ypos 0 focus_mask True
#imagebutton auto "buttons/m2_lighter_%s.png" action Jump('lighter') xpos 0 ypos 0 focus_mask True
#imagebutton auto "buttons/m2_lippy_%s.png" action Jump('lippy') xpos 0 ypos 0 focus_mask True
#imagebutton auto "buttons/m2_tamp_%s.png" action Jump('tamp') xpos 0 ypos 0 focus_mask True
#imagebutton auto "buttons/m2_marker_%s.png" action Jump('marker') xpos 0 ypos 0 focus_mask True
#imagebutton auto "buttons/m2_monz_%s.png" action Jump('monz') xpos 0 ypos 0 focus_mask True
#imagebutton auto "buttons/m2_teddy_%s.png" action Jump('teddy') xpos 0 ypos 0 focus_mask True
imagebutton auto "buttons/m2_spliff_%s.png" action Jump('spliff') xpos 0 ypos 0 focus_mask True
imagebutton auto "buttons/m2_sucker_%s.png" action Jump('sucker') xpos 0 ypos 0 focus_mask True
#imagebutton auto "buttons/m2_pen_%s.png" action Jump('pen') xpos 0 ypos 0 focus_mask True
#imagebutton auto "buttons/m2_water_%s.png" action Jump('water') xpos 0 ypos 0 focus_mask True
if seenEyeTut == False:
add "buttons/eye_tut.png" xalign 0.0 yalign 0.0
elif seenEyeTut == True:
add "buttons/eye.png" xalign 0.0 yalign 0.0
call screen handbagOptions1()
Some of the troubleshooting I've done based on other posts I've found here:
- I was initially scaling all of the images when they were defined to 1920x1080, so removed the scaling code and changed the project size, which led to some improvement.
- I've tried making use of $ renpy.free_memory() at regular intervals, and this has led to further minor improvement, but there are still issues.
- I've increased the projects image cache to 64, with no noticeable difference.
- I've locked the framerate at 30, again with no real difference.
- I've rollbacked renpy to 6.99.13 (which seemed to help a lot, the most recent update was crashing occasionally even while idling, which I'm no longer getting).
I am also using a custom cursor, for reference.
Here are my questions:
- Am I doing anything obviously wrong in how I'm approaching the game, I've only made a few renpy games in the past and I'm still constantly learning, so please point anything out. I am still a noob with Python.
- What are some things I can try out to optimize the project that I haven't tried, so that it can run the best it can, considering I'd like to have it run on iOS and android. It seems like such a small game in comparison to other games I've seen on Ren'Py and I have no idea what I'm doing wrong.
- And most importantly, how can I fix the regular but seemingly random out of memory errors?
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 2018, in script
$ renpy.pause(.5, hard='True')
File "game/script.rpy", line 2018, in <module>
$ renpy.pause(.5, hard='True')
MemoryError:
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "F:\DAZ 3D\Daz Renpy\renpy-6.99.13-sdk\renpy\bootstrap.py", line 305, in bootstrap
renpy.main.main()
File "F:\DAZ 3D\Daz Renpy\renpy-6.99.13-sdk\renpy\main.py", line 499, in main
run(restart)
File "F:\DAZ 3D\Daz Renpy\renpy-6.99.13-sdk\renpy\main.py", line 147, in run
renpy.execution.run_context(True)
File "F:\DAZ 3D\Daz Renpy\renpy-6.99.13-sdk\renpy\execution.py", line 795, in run_context
context.run()
File "game/script.rpy", line 2018, in script
$ renpy.pause(.5, hard='True')
File "F:\DAZ 3D\Daz Renpy\renpy-6.99.13-sdk\renpy\ast.py", line 827, in execute
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
File "F:\DAZ 3D\Daz Renpy\renpy-6.99.13-sdk\renpy\python.py", line 1764, in py_exec_bytecode
exec bytecode in globals, locals
File "game/script.rpy", line 2018, in <module>
$ renpy.pause(.5, hard='True')
File "F:\DAZ 3D\Daz Renpy\renpy-6.99.13-sdk\renpy\exports.py", line 1304, in pause
rv = renpy.ui.interact(mouse='pause', type='pause', roll_forward=roll_forward)
File "F:\DAZ 3D\Daz Renpy\renpy-6.99.13-sdk\renpy\ui.py", line 287, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "F:\DAZ 3D\Daz Renpy\renpy-6.99.13-sdk\renpy\display\core.py", line 2553, in interact
repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
File "F:\DAZ 3D\Daz Renpy\renpy-6.99.13-sdk\renpy\display\core.py", line 2916, in interact_core
self.draw_screen(root_widget, fullscreen_video, (not fullscreen_video) or video_frame_drawn)
File "F:\DAZ 3D\Daz Renpy\renpy-6.99.13-sdk\renpy\display\core.py", line 1980, in draw_screen
renpy.config.screen_height,
File "renpy/display/render.pyx", line 430, in renpy.display.render.render_screen (gen\renpy.display.render.c:6938)
rv = render(root, width, height, 0, 0)
File "renpy/display/render.pyx", line 196, in renpy.display.render.render (gen\renpy.display.render.c:2983)
rv = d.render(widtho, heighto, st, at)
File "F:\DAZ 3D\Daz Renpy\renpy-6.99.13-sdk\renpy\display\layout.py", line 702, in render
surf = render(child, width, height, cst, cat)
File "renpy/display/render.pyx", line 110, in renpy.display.render.render (gen\renpy.display.render.c:3445)
cpdef render(d, object widtho, object heighto, double st, double at):
File "renpy/display/render.pyx", line 196, in renpy.display.render.render (gen\renpy.display.render.c:2983)
rv = d.render(widtho, heighto, st, at)
File "F:\DAZ 3D\Daz Renpy\renpy-6.99.13-sdk\renpy\display\im.py", line 503, in render
texture = cache.get(self, texture=True)
File "F:\DAZ 3D\Daz Renpy\renpy-6.99.13-sdk\renpy\display\im.py", line 248, in get
ce.texture = renpy.display.draw.load_texture(ce.surf)
File "renpy/gl/gldraw.pyx", line 684, in renpy.gl.gldraw.GLDraw.load_texture (gen\renpy.gl.gldraw.c:9897)
rv = gltexture.texture_grid_from_surface(surf, transient)
File "renpy/gl/gltexture.pyx", line 889, in renpy.gl.gltexture.texture_grid_from_surface (gen\renpy.gl.gltexture.c:11852)
tex.load_surface(surf, x, y, width, height,
File "renpy/gl/gltexture.pyx", line 330, in renpy.gl.gltexture.TextureCore.load_surface (gen\renpy.gl.gltexture.c:4175)
self.premult = premultiply(
File "renpy/gl/gltexture.pyx", line 1180, in renpy.gl.gltexture.premultiply (gen\renpy.gl.gltexture.c:16689)
rv = PyString_FromStringAndSize(<char *>NULL, w * h * 4)
MemoryError:
Windows-8-6.2.9200
Ren'Py 6.99.13.2919
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
error: Out of memory
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "F:\DAZ 3D\Daz Renpy\Renpy v6.99.14.3\renpy\bootstrap.py", line 306, in bootstrap
renpy.main.main()
File "F:\DAZ 3D\Daz Renpy\Renpy v6.99.14.3\renpy\main.py", line 524, in main
renpy.display.interface.finish_pending()
File "F:\DAZ 3D\Daz Renpy\Renpy v6.99.14.3\renpy\display\core.py", line 3524, in finish_pending
self.check_background_screenshot()
File "F:\DAZ 3D\Daz Renpy\Renpy v6.99.14.3\renpy\display\core.py", line 2106, in check_background_screenshot
self.bgscreenshot_surface = renpy.display.draw.screenshot(self.surftree, self.fullscreen_video)
File "gldraw.pyx", line 1349, in renpy.gl.gldraw.GLDraw.screenshot
File "F:\DAZ 3D\Daz Renpy\Renpy v6.99.14.3\renpy\display\pgrender.py", line 116, in surface
surf = Surface((width + 4, height + 4), 0, sample)
File "src/pygame_sdl2/surface.pyx", line 164, in pygame_sdl2.surface.Surface.__init__ (gen\pygame_sdl2.surface.c:2738)
error: Out of memory
Windows-8-6.2.9200
Ren'Py 6.99.14.3.3347