Parallax maps vs lag/game crash

Status
Not open for further replies.

Elliott404

Game404
Veteran
Joined
Jul 4, 2018
Messages
735
Reaction score
2,307
First Language
English
Primarily Uses
RMMV
What is/are the common issue(s) with parallax maps for most lags, and game crashes? What is the most effective solution?
I've played Gaia's Melody: Echoed Melodies, and despite that most of the maps are parallax maps, I didn't have a major issues with lags nor game crashes. What are Echo's secrets lol
 

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,060
Reaction score
2,652
First Language
Greek
Primarily Uses
RMMZ
To be honest I don't understand. I am not sure Parallaxing can cause any lag.
It is like showing two pictures fixed on a screen.
Of course level size matters.
Also the number of events, especially the ones set in Parallel are also a huge concern.
You should mind not using a ridiculous number of moving events too.

A preload manager can help out on loading times.
A Wait 10 Event Command on EVERY Parallel Event can help a lot.
Limiting your design to specific map sizes and amount of events is essential though in my opinion.

By the way, the game you refer to was made in RPG Maker XP.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,122
Reaction score
10,614
First Language
Czech
Primarily Uses
RMMV
Map size can be an issue. Hardware can be an issue. Picture size can be an issue. Your game not being compatible with WebGL can be an issue. Plugin incompatibilities can be an issue. Unless we see concrete info, it's difficult to pinpoint the exact source of your problems.
 

Elliott404

Game404
Veteran
Joined
Jul 4, 2018
Messages
735
Reaction score
2,307
First Language
English
Primarily Uses
RMMV
Oh, I'm asking as a general question, not for specific problem.

@Dreadshadow
She've remade them in MV
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,573
Reaction score
6,496
First Language
Indonesian
Primarily Uses
RMVXA
What is/are the common issue(s) with parallax maps for most lags, and game crashes?
Oh, I'm asking as a general question, not for specific problem.
Then lemme try to answer as general as possible. Your device whether it's PC or Mobile is lacking memory thus take up space. This is why you don't use parallax for mobile deployment.

What is the most effective solution?
Don't deploy on mobile
OR
Don't use parallax
 

Elliott404

Game404
Veteran
Joined
Jul 4, 2018
Messages
735
Reaction score
2,307
First Language
English
Primarily Uses
RMMV
I see.
By what Dreadshadow said, I'm guessing that the engine by default preload every single resource even the unused one, so using a preload manager would decrease the lagging issue, right?
@TheoAllen Too straight up-- not using parallax is a difficult solution--
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,573
Reaction score
6,496
First Language
Indonesian
Primarily Uses
RMVXA
By what Dreadshadow said, I'm guessing that the engine by default preload every single resource even the unused one, so using a preload manager would decrease the lagging issue, right?
The opposite. Usually, you trade between faster processing by preload everything but cost more memories. Or load when you need, usually less fast but you don't need that much memory. Either way, it still boils down into the spec of your hardware, more processing power, more memories. This is for programmers though (i.e, plugin makers/scripters), so I'm not really sure if you understand what I'm saying.

Also, you can opt to use doodads. It's much lightweight compared to parallax.
 

Elliott404

Game404
Veteran
Joined
Jul 4, 2018
Messages
735
Reaction score
2,307
First Language
English
Primarily Uses
RMMV
Somewhat. I can guess that if the size is too much for my pc's hardware to handle, it'll lag, or worse crash. sorry- I can barely understand some issues with my own pc lol--

I was considering to use Doodads if it came down to this, but the major issue with them is that they're all passables, so I thought using them in impassable areas are better than nothing.
This means. . I could replace the unused tilesets with the ones I've modified to save my project--
 

megumi014

Veteran
Veteran
Joined
Mar 8, 2017
Messages
130
Reaction score
212
First Language
Spanish
Primarily Uses
RMMV
It is a very annoying solution, but you can always make the parallax map on any painting programm and then chop it down in terrain, furniture and top furniture and paste it on a tileset, then draw it normally on the rpg mv engine. It *is* a pain but it says goodbye to lag. Or try a different plugin for the parallax binding.
 

Elliott404

Game404
Veteran
Joined
Jul 4, 2018
Messages
735
Reaction score
2,307
First Language
English
Primarily Uses
RMMV
I've tried, for almost 7 months, to find solutions for parallax maps but to no avail. . So it came down to this latest solution. Simple yet annoying. But saves up alot of datas and some unnecessary crashes.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,122
Reaction score
10,614
First Language
Czech
Primarily Uses
RMMV
You have to remember that you cannot optimize the game for every situation.

MV loads resources on demand, so it sacrifices CPU for RAM, but ultimately results in lag.

Parallax mapping sacrifices RAM for CPU power, because you don't have to render and handle X objects. Nevertheless, too much can lead to crashes.

TDDP preload manager and SRD's preloader core sacrifice RAM for CPU too. They will preload the assets you will ask them to (However, they are constructed in such a way that when the garbage collector flushes the images, the empty pointers will remain. Then they notice the pointers are empty, so they will load new assets without releasing the previous pointers, essentially resulting in memory leak that will ultimately lead to a crash).

Doodads are a nice solution. But they increase map transition lag, because they use a ton of CPU resources, especially in larger numbers (of hundreds).

Essentially the best way to optimize the MV engine would be to make the loading asynchronous with a smart preloader. However, from experience I can say that is a very tedious thing to do.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,573
Reaction score
6,496
First Language
Indonesian
Primarily Uses
RMVXA
but the major issue with them is that they're all passables
It's trivia matter I think if you want some spot impassable you can just use an empty tile and make it impassable, or maybe you can try to search/request to make a certain tile impassable by putting a certain region id or something.
 

Elliott404

Game404
Veteran
Joined
Jul 4, 2018
Messages
735
Reaction score
2,307
First Language
English
Primarily Uses
RMMV
Asynchronous with a smart preloader?

@TheoAllen
Yea. I thought about that solution.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,122
Reaction score
10,614
First Language
Czech
Primarily Uses
RMMV
Yup, asynchronous with a smart preloader. For example in my parallax mapping engine I made a preloader that is kinda smart. It's not foolproof, because when you make something you intend to release to public, it's hard to make it foolproof.

Anyway....
If it detected a teleport event from an autostart, it preloaded the map.
If it detected a teleport event 5 squares from the player, it preloaded that map.
The problem with that is, I needed to preload one resource multiple times, because PIXI doesn't like it when you make multiple sprites from a single texture and the GPU usage goes up quite quickly. So the RAM usage could get quite high quite quickly depending on the maps preloaded.
 

Elliott404

Game404
Veteran
Joined
Jul 4, 2018
Messages
735
Reaction score
2,307
First Language
English
Primarily Uses
RMMV
@Poryg
I think I'll stick to the current solution for now. Your method seemed more complex than it looks. Thank you tho.
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,492
Reaction score
408
First Language
German
Primarily Uses
RMMV
The last users who were concerned about to many parallel events making their games lag, it wasnt their parallel, it was because of:
Tinting the Screen 60 times per second and in other cases it was Change Actor Graphic 60times per second.
When he than added more stuff his project started to lag specialy with the change actor stuff.
But it wasnt his new added stuff causing the lag, it just used the last bit of performance reserves left, not its fault that non were left.

If your Game Lags because of parallax maping, than that is strange and normally should not happen. Correct me if iam wrong, in vx-ace it was no problem. Maybe you made one of the 2 Errors mentioned above.
 

Elliott404

Game404
Veteran
Joined
Jul 4, 2018
Messages
735
Reaction score
2,307
First Language
English
Primarily Uses
RMMV
I wonder if it because the size was too large because of my project's resolution of 1152x648, so the maps were 2 times larger. So, I am trying to resize them as much as I can to avoid these issues.
Another problem was a pixel movement plugin, when I've turned it off, the lag decreased much more and chances to crash was little as well. So I have to either give it up, or find a better replacement.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,711
Reaction score
7,365
First Language
German
Primarily Uses
RMMV
@Elliott404
let's get some mathematics on the difference.
In both cases (parallax and tiled) you have a viewport of what you can see and the map storage itself.
The viewport is only dependent on the screen size and mostly identical for both cases, so let's ignore that for now.

But how is the rest of the map stored? It always needs to be completely in memory for the map to work, and that uses RAM.

A single tile of a tiled map uses one number for each layer ("Place tile number # here"). MV has three mapping layers, so that are three bytes of storage per tile.
A parallax part of the same size has 48x48 pixels per layer to store. The color is usually coded with three bytes (24-bit-color, 8 bit per base), and most parallax maps use two layers (ground and above). That multiplies to 13824 bytes per tile-sized area.

YES, a parallax map needs 4600 times the RAM of a tiled map.
Do not be confused by the small filesize of your parallax images on the harddrive. That is compressed size and pictures can be compressed a lot.
But you cannot work on a compressed map, for the map the player moves on the data needs to be uncompressed.
Save your parallax as a BMP as a test only - that file format has no compression, and that will tell you how much RAM you really need to reserve for that map picture while the player moves on that map.

The mathematic are a bit more complex than that - the tilemap has an overhead of storing the tileset, but on the other hand the tile storage doesn't vanish for the parallax map, especially if you use it for passability and so on. But those numbers are minor, especially once the maps get larger (and you need larger maps if you increase the screensize).

And now you also know why the suggestions for mobiles are to limit parallaxes to screen size (20x20 tiles) and on full computers don't go beyond 100x100 tiles for parallaxes (150x150 if you have a powerfull computer with a lot of RAM)

EDIT:
If you are below the numbers above, then any halfway decent computer should be able to handle them, especially if there is no other drain on the resources.
But as @Bex said above, lag is cumulative and if you have any of the other causes of lag, then sooner or later it sums up. and yes, pixel movement does require more processing resources than tile movement.
But that does not mean that the pixel movement alone is a bug - you just have to manage your resources and find out where the limits are. Adding too much (especially badly written parallel processes) will always result in lag even on the most powerfull computer.
 
Last edited:

Elliott404

Game404
Veteran
Joined
Jul 4, 2018
Messages
735
Reaction score
2,307
First Language
English
Primarily Uses
RMMV
@Andar
13824 BYTES?!?!?!?! I knew parallax takes alot of space than tiles but omg, I did not expect this much-
I'm trying to not have any maps way too large, at least not larger than 50. Speaking of which, do excessive use of animated tiles create these issues too?
I need to check again how much RAM my pc have.
 
Last edited:

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,492
Reaction score
408
First Language
German
Primarily Uses
RMMV
How are they animated? Standard A1 Tilesheet? Or something else?
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

If any composer here would like me to use their music as background on my plugin videos, just let me know.
Wee icons I've been making. I've totaled probably around 30 of them now! I'm trying to see if I can make a little spin on the status buff and nerf status effect icons. Want to add a bit of flair while making sure they are effective at communicating what's needed.
I think I like to draw, but with pixels it seems difficult.

Making my character able to jump around the map because I'm bored and I already did my childhood "I'm bored" punishment of doing dishes.
Actor2_7 added!

Forum statistics

Threads
103,081
Messages
997,115
Members
134,544
Latest member
chatiago
Top