so I have a max size world map, I don't want to use tiles but instead I'm painting manually a huge background image I'm adding with parallax, in game it works just fine. but when I open the menu and then close it it freezes for a second or two. I've tried saving the parallax to a cache so it doesn't have to load the data again, but I've found that the freeze happens after the parallax is assigned, so it seems like the problem is not what I thought.
something is taking a long time to process but I don't know what, and it only happens when I have the big parallax in the room. Anybody knows something about this?
It simply means that your computer has not enough RAM to handle that.
When the menu opens the engine takes a screenshot to use as a menu background. When the menu is closed, that screenshot can be removed from memory - but that takes a bit of time.
And what you describe seem to indicate to me that the picture cache is almost full, so that the added background screenshot pushes it over the limits, causing lag due to missing RAM.
Which is also no wonder due to that extremely large parallax.
A few years ago I still told people that you'll need a top-of-the-line computer to handle 150x150 tile parallax maps without problem. Today's computers are better, but you still need one hell of a RAM to handle that large of a parallax.
Just think of it - a tiled map needs one number per tile, multiplied by the number of map layers.
A picture needs 3 color numbers (RGB ) for each pixel, with 48x48 pixels per tile. And multiply that if you use additional layers for above player or light or similar.
So it is no joke to say that a parallax map needs around two thousand times the RAM of a tilebased map.
And a picture cannot be compressed while being used, so the compressed file size does not count. Save your background as BMP to see its real size - BMP has no compression.
I assumed that I was using events that were not plugins, however, here are some comments about map transitions and event movements on large maps.
The maximum menu size that I achieved was using 4 screens, a map defined by a specific size, and as the screen resolution allowed, I could create up to 4 of these maps in different positions, straight lines, in an "L" shape or squares.
This specific limit value was precisely because of the limitations, both of event lag and frame drops.
Therefore, the larger the map, the more detrimental it is to controlling events on it. I think that the limit of map events is only 1000, while a 256x256 map far exceeds this amount of tiles.
Even the amount of variables associated with the event would be exceeded, since there are directions, map positions and screen positions and their storage, which would take something around 10 variables per event.
I know, so a 256x256 map is a lot to map, it's the maximum limit for maps, isn't it?
You can use the parallax marked on the map in its properties, and reduce the number of events on it.
maybe I could create my own custom menu so that it doesn't make a whole new scene every time the player opens the menu...
Maybe you can plit the image if it is bigger than 1000 or 2000 pixels. Not sure if every computer can load large textures without performance drops.