Out of Memory

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Bruni Multimedia
Regular
Posts: 114
Joined: Mon May 15, 2017 12:23 pm
Projects: Yomi Alliance
Organization: Bruni Multimedia
itch: brunimultimedia
Contact:

Out of Memory

#1 Post by Bruni Multimedia »

Hey guys.
I am trying to use webm files to animate the characters of my game. Idle animations mostly.

This is the sample code I used to test everything:

Code: Select all

# The script of the game goes in this file.

# Declare characters used by this game. The color argument colorizes the
# name of the character.

define e = Character("Eileen")
image sulijanmovie = Movie(play="sulijan_idle.webm", mask="sulialpha.webm")
image serenamovie = Movie(play="serena_idle.webm", mask="serena_idle_alpha.webm")
image mivakmovie = Movie(play="mivak_idle.webm", mask="mivak_idle_alpha.webm")
image mkrellmovie = Movie(play="mkrell_idle.webm", mask="mkrell_idle_alpha.webm")

# The game starts here.

label start:


    scene command_center_4

    show sulijanmovie at left
    show serenamovie at right
    show mivakmovie
    show mkrellmovie:
        xpos 750 yalign 1.0


    e "You've created a new Ren'Py game."

    e "Once you add a story, pictures, and music, you can release it to the world!"


    return
If I load all four of them the game crashes with a "memory error". It looks like the game can't handle the movies...
All files are less than 3MB in size.

Is there a walkaround to make it work with more than 3 chars?

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: Out of Memory

#2 Post by hell_oh_world »

Uh... Are you trying to show animated sprites in the form of movie? I think that's really bad. What you want to do instead is extract all the frames of each movie and animate them with atl.

Code: Select all

image char_idle:
    "frame01.png"
    0.03
    "frame02.png"
    0.03
    repeat

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Out of Memory

#3 Post by trooper6 »

The OP is using the Movie Sprite functionality, documented here: https://www.renpy.org/doc/html/movie.ht ... ie-sprites

So using movie sprites shouldn’t be a problem in and of itself. Do they all have the same frame rate? The documentation says that could be a problem.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
Bruni Multimedia
Regular
Posts: 114
Joined: Mon May 15, 2017 12:23 pm
Projects: Yomi Alliance
Organization: Bruni Multimedia
itch: brunimultimedia
Contact:

Re: Out of Memory

#4 Post by Bruni Multimedia »

Mmh no, I'd rather NOT extract all the frames because that would mean having even 600 frames to code for each movie, and that would mean tens of thousands lines. That's why as trooper6 says I'm using the Movie Sprite function.

Every movie has the very same frame rate... They're pretty basic, in 1440x900 resolution, they shouldn't hinder system's memory that much (I own a very powerful PC either, but they shouldn't be a problem even for smaller systems)

User avatar
PyTom
Ren'Py Creator
Posts: 16096
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: Out of Memory

#5 Post by PyTom »

Can you please post a link to the demo for me, or send it via private message? I wouldn't expect this to run out of memory.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
Bruni Multimedia
Regular
Posts: 114
Joined: Mon May 15, 2017 12:23 pm
Projects: Yomi Alliance
Organization: Bruni Multimedia
itch: brunimultimedia
Contact:

Re: Out of Memory

#6 Post by Bruni Multimedia »

Done, thank you!

User avatar
Bruni Multimedia
Regular
Posts: 114
Joined: Mon May 15, 2017 12:23 pm
Projects: Yomi Alliance
Organization: Bruni Multimedia
itch: brunimultimedia
Contact:

Re: Out of Memory

#7 Post by Bruni Multimedia »

Mmh, any news? :)

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: Out of Memory

#8 Post by hell_oh_world »

pytom must be busy, if you have a discord and joined in the renpy server, you can pm him directly... lsf is a bad place to send dms i think...
https://discord.gg/6ckxWYm

User avatar
Bruni Multimedia
Regular
Posts: 114
Joined: Mon May 15, 2017 12:23 pm
Projects: Yomi Alliance
Organization: Bruni Multimedia
itch: brunimultimedia
Contact:

Re: Out of Memory

#9 Post by Bruni Multimedia »

Wrote him on Patreon :D

I hate Discord, I tried to befriend it but we are definitely incompatible ahahah

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: Out of Memory

#10 Post by hell_oh_world »

well, you need to make it work, honestly I think he's more active in the discord. i chatted with him once and my question got answered immediately, besides, sometimes he's there to have small talk with others, so i really think that discord is your best bet of getting faster response from him, and he's not really responsive in patreon, clearly you can see that in the discrepancies of the post dates of each article...

User avatar
PyTom
Ren'Py Creator
Posts: 16096
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: Out of Memory

#11 Post by PyTom »

I've spent a lot of time on this (over six hours), and I'm not particularly closer to figuring out what's causing this. I do know that this isn't a problem in the 7.4 master branch, which has changed the internals of Ren'Py such that this doesn't seem to be a problem.

It seems to have to do with the size of the sprites - having eight 1440x900 videos playing at once (four for the color, four for the alpha) seems to fill memory to the point where Ren'Py can't process it. It's not the size of the images that are the problem - I calculate that it's about 200MB uncompressed. My guess is that on the 32-bit platforms, memory is getting fragmented, and that fragmentation eventually means that there isn't a spot for new frames, and things crash.

I would suggest potentially cropping the videos. Right now, they're using space inefficiently - you have a 1440 wide image, but only about 400 or so pixels of that actually contain image data. Doing so would likely reduce your memory consumption by about 2/3rds. Since memory fragmentation problems often get worse the more memory is being used, it's likely that a crop would improve things.

While the crop might affect the layout of images, I suspect you could place the movies inside a 1444x900 Fixed, which would let you retain the existing layout.

At this point, with 7.4 not having this problem, I'm going to focus on getting it into a prerelease.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
Bruni Multimedia
Regular
Posts: 114
Joined: Mon May 15, 2017 12:23 pm
Projects: Yomi Alliance
Organization: Bruni Multimedia
itch: brunimultimedia
Contact:

Re: Out of Memory

#12 Post by Bruni Multimedia »

Thanks A LOT for your help and the time you spent on this.

I just don't understand this part: "I suspect you could place the movies inside a 1444x900 Fixed"

The videos were made in that format so I can move the characters like I would with static images while the background is 1920x1080... Are you suggesting I put the images in a smaller background container? I think I don't get it...

Post Reply

Who is online

Users browsing this forum: Ocelot, snotwurm