Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
justabox21

Clear graphic cache for more memory

Question

My current RMXP project uses really big sprite graphics and after playing the game for so long I will get an error message and the game will crash. This is the message:

 

Script

'sprite_character' line45:RGSS Error occurred

failed to create bitmap

 

The way it's looking to me is the game is getting overloaded by the graphics' size over time and crashing. So my question is is there any way to maybe clear the cache files for both sprite and picture graphics during gameplay to keep the game from crashing?

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Is this for RPG Maker XP? I do know (if I recall correctly) RPG Maker VX has an issue when you try to create a Bitmap greater than a certain size...

 

Dunno if it applies to both versions.

 

However, to answer your question:

RPG::Cache.clear

Will clear the cache and call the garbage collector to cleanup all bitmaps that are created from RPG::Cache.xxxxx("filename")

 

I don't see why having too many graphic images loaded into memory would cause issues, but I don't know how RPG Maker is implemented so I could be wrong.

Share this post


Link to post
Share on other sites
  • 0

Yes, this feels like a very strange problem you've ran into. Also, the point of the cache is to prevent the game from loading the same graphics several times. What size are your graphics and how many of them do you have?

Share this post


Link to post
Share on other sites
  • 0

Confirmed for, a little bit of column A and a little bit of column B.

 

In an attempt to recreate the error; this is what I came up with:

s = Sprite.new
s.bitmap = Bitmap.new(18400, 18400)

Raises the exact same error.

 

 

s = Sprite.new
s.bitmap = Bitmap.new(18400, 500)

No error here

 

s = Sprite.new
s.bitmap = Bitmap.new(18399, 18399)

No error is raised here

 

s = Sprite.new
s.bitmap = Bitmap.new(18399, 18399)
s2 = Sprite.new
s2.bitmap = Bitmap.new(6300, 6300)

Raises the same error again.

 

bitmap = Bitmap.new(18400, 18400)

No error

 

bmp = []
for i in 0...500
 bmp << Bitmap.new(6000, 6000)
end

Same error, on the 11th iteration.

 

So, it appears to be triggered depending on:

1. the number of pixels in memory

2. whether the pixels are rendered on screen or not

 

So, it looks like, you are either trying to render graphics WAY too big OR, you were right and you just load TOO MANY big graphics. Clearing the cache may help.

Share this post


Link to post
Share on other sites
  • 0

@Moonpearl: The graphics are big, real big. A typical sprite frame is 2560X1920 because each frame is 640X480. But I also have some 8 frame animations that are 5120X1920.

 

@Kellessdee: I'm gonna try your idea and see what it does. You're right though, RMXP is trying to load graphics that are very big.

 

Wow... Well holy crap, that fixed the problem! I can now play from the beginning to the end of part one of my game without having to F12 it to avoid crashing! I've been looking for a fix to this for a very long time! Thanks guys, you've done me a HUGE favor!

Edited by justabox21

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...