Large background image: 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
cosmo
Regular
Posts: 120
Joined: Mon Aug 29, 2011 11:01 am
Projects: | ZUKUNFT | Wayang Kulit - A Shadow Play (WIP version 0.1) |
Location: Germany
Contact:

Large background image: Out of memory!

#1 Post by cosmo »

My current game crashes with the notice
While running game code:
File "game/script.rpy", line 270, in script
" "
error: Out of memory
Honestly this is not a big surprise: In line 269 I try to load a new background image. A PNG with transparent parts that has a size of nearly 22.000px x 15.000px and that uses around 22MB on the harddisk. I now know that I just have to do it different – but: Does anyone know how much memory such a PNG uses in RAM? It must be by far more than just 22MB. I do have 3GB RAM here and the RAM gets not full. The loading of the image also needs some seconds in the image viewer already until it shows up… But it doesn't crash at least…

This might be a load problem somewhere in python, pygame or in Ren'Py… I don't know. But where is the breaking point? What is still possible?


Just as an explanation: In my current project I use large background images where the scenes take place. I use zoom to navigate from one point to the next.

I wish there would be something that could stick background images together! Maybe like: 6 hex fields and new hex fields would be added to the surrounding background while navigating and moving.

Are there different ideas to work with large backgrounds?
Attachments
out_of_memory_traceback.txt
(3.71 KiB) Downloaded 86 times
Project: Wayang Kulit - A Shadow Play
Status: First demo version "Proof of Concept" of my first project is out.

ShirakiHime
Regular
Posts: 45
Joined: Sun Oct 30, 2011 2:40 pm
Projects: Mermaid Revelation (GxB otome)
Contact:

Re: Large background image: Out of memory!

#2 Post by ShirakiHime »

.png format usually is very large file, comparing to .jpeg. One way to decrease its size is by decreasing its "quality". I am not sure if I understood your problem. >o<

Weakjounin
Veteran
Posts: 258
Joined: Sun Oct 09, 2011 3:11 pm
Location: Sarasota
Contact:

Re: Large background image: Out of memory!

#3 Post by Weakjounin »

I'm sorry. 22,000 by 15,000? couldn't you shrink that? Does anyone have a monitor that's 22,000 by 15,000 pixels? isn't 1920x1200 already pretty big?

User avatar
Alex
Lemma-Class Veteran
Posts: 3095
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Large background image: Out of memory!

#4 Post by Alex »


User avatar
Desu_Cake
Veteran
Posts: 300
Joined: Mon Aug 15, 2011 2:03 pm
Projects: Secret, Secret and Secret
Location: Ireland
Contact:

Re: Large background image: Out of memory!

#5 Post by Desu_Cake »

Are you 100% sure that the image is the problem, and not a memory leak or something elsewhere?

AxemRed
Veteran
Posts: 482
Joined: Sun Jan 09, 2011 7:10 am
Contact:

Re: Large background image: Out of memory!

#6 Post by AxemRed »

22000 * 15000 = 330000000 pixels
4 bytes per pixel * 330000000 pixels = 1320000000 bytes
1320000000 bytes = 1.23GiB

The image is stored in memory 2~3 times, so 2.46GiB~3.69GiB total.

32-bit Windows programs have a 2GiB per-process limit unless compiled with a special flag.

cosmo
Regular
Posts: 120
Joined: Mon Aug 29, 2011 11:01 am
Projects: | ZUKUNFT | Wayang Kulit - A Shadow Play (WIP version 0.1) |
Location: Germany
Contact:

Re: Large background image: Out of memory!

#7 Post by cosmo »

@ShirakiHime It would reduce the size on the disk. But JPG does not have transparency which is needed in this case. It also produces ugly artifacts which would be easy to see in this special case :(
@Weakjounin Yes, you are right of course! In my public current demo I use a size of 16 screens (4x4) with a size of 4096x2816. That works just great with zooming in and out. The Ren'Py screen has just a with of 1024 pixel.

Another example of the effect I would like to use is the concert in the tutorial – which you may have seen?! :) It also uses an image that is bigger than the screen.

@Alex Yes! Thanks, that looks usable!
@Desu_Cake It is likely that there are some limits … wherever they are… More likely than a hardware failure…
@AxemRed Ah! thanks! That is useful, too! Fine! I use Linux … but it doesn't matter in this case as your values are already a hint!

Ok, will have a closer look now!
I am still thinking how to solve my problem though… But maybe I have to change my challenge… :(

Edit:
btw: Thanks! Such a lot of answers! Great! :)
Project: Wayang Kulit - A Shadow Play
Status: First demo version "Proof of Concept" of my first project is out.

Post Reply

Who is online

Users browsing this forum: Bing [Bot]