OpenGL Optimization Issues (profiled a running game)

JLowther

Veteran
Veteran
Joined
Feb 20, 2016
Messages
327
Reaction score
38
First Language
English
Primarily Uses
I ran a profiler while launching a completely fresh game deployed from RMMV on an iPad2 and this is what I got (though this will affect both iOS and Android devices):


profile.png


Even with a completely fresh game (no events, no external plugins, etc.), the renderer is seeing issues all over the place, mostly in terms of inefficient handling of graphical resources.


Here's the trace file itself:


https://dl.dropboxusercontent.com/u/67091205/fresh_trace.trace.zip


From the looks of things, we could be getting substantially better performance on both iOS and Android devices if some of these issues were ironed out. Is there any chance of making that happen?
 

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
RMMV uses the PixiJS library to handle rendering, so unless that gets updated, it's probably not going to be something that we'll see on MV, because that would mean that KDKW would then have to maintain a branch of Pixi for the engine, which is unlikely to be something the company would do, given how reluctant it is to even allow modifications to the software they do make themselves.


But now I have a few questions regarding the profile itself:


How long did the profile run for? From what I can see, it looks like it's around 1m 40s, but the warnings/errors stop appearing around 40 seconds in.


Does the iPad run the game in WebGL mode, or canvas mode? This is a little harder to find out without a keyboard, but you can modify the code in the game to show the FPS monitor by default, which will display the renderer's mode in it.


If you leave the trace running longer, do the numbers increase, or do they stop around the number of occurrences as shown in your picture?


What version of RPG Maker was this project created in? MV was updated several times over its lifetime, and a newer version may have fixed some of these warnings.


And finally, was the performance of the game on the iPad 2 bad? Was the game playable? Did you notice a reduced frame rate?
 

JLowther

Veteran
Veteran
Joined
Feb 20, 2016
Messages
327
Reaction score
38
First Language
English
Primarily Uses
RMMV uses the PixiJS library to handle rendering, so unless that gets updated, it's probably not going to be something that we'll see on MV, because that would mean that KDKW would then have to maintain a branch of Pixi for the engine, which is unlikely to be something the company would do, given how reluctant it is to even allow modifications to the software they do make themselves.


That's what I was afraid of... :(

But now I have a few questions regarding the profile itself:


How long did the profile run for? From what I can see, it looks like it's around 1m 40s, but the warnings/errors stop appearing around 40 seconds in.


Just ~40 seconds, in this case.

Does the iPad run the game in WebGL mode, or canvas mode? This is a little harder to find out without a keyboard, but you can modify the code in the game to show the FPS monitor by default, which will display the renderer's mode in it.


I'm actually looking for this command in another thread right now!


What's the command and I'll get back to you on this ASAP? :)

If you leave the trace running longer, do the numbers increase, or do they stop around the number of occurrences as shown in your picture?


I'll test this soon.

What version of RPG Maker was this project created in? MV was updated several times over its lifetime, and a newer version may have fixed some of these warnings.


Very latest, and created the new project today.

And finally, was the performance of the game on the iPad 2 bad? Was the game playable? Did you notice a reduced frame rate?


It runs somewhere around 20-30FPS most of the time, even though the iPad is definitely capable of better.


Here's a side by side comparison of the same project running on a Macbook Pro and an iPad2:


https://dl.dropboxusercontent.com/u/67091205/party_compare.mp4


As you can see, the iPad isn't just running at a lower framerate but the entire game is running more slowly, as the party on the MBP makes it to the edge of the screen way faster, despite starting moving after the iPad's party does.
 

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
In an autorun event, put this in a script event to show the FPS monitor:


Graphics.showFps();




Do remember to disable the autorun event after it runs :p
 

JLowther

Veteran
Veteran
Joined
Feb 20, 2016
Messages
327
Reaction score
38
First Language
English
Primarily Uses
Okay, it's running in Canvas mode and hovers around 28-34 FPS. Is there a way to force it to use WebGL because the reports I'm reading say that the iPad2 does support WebGL (as of IOS 5.0, actually).


Here's a screenshot of around 1:30:profile2.png


Seems like the numbers just keep climbing, even while sitting idle on the map.
 
Last edited by a moderator:

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
I don't suppose the warnings will tell you where in the code the issues are coming from? Without that, fixing these warnings probably has no chance of being done. With that information, it might be possible, but it's also a relatively isolated issue that most people won't have to deal with, and therefore won't give much attention to it.


How old is the iPad 2 nowadays? I have no idea how old they are or how well they'd be expected to perform. If it doesn't support WebGL, that'll likely be an age problem, and thus quite an issue for running MV on it.
 

JLowther

Veteran
Veteran
Joined
Feb 20, 2016
Messages
327
Reaction score
38
First Language
English
Primarily Uses
I don't suppose the warnings will tell you where in the code the issues are coming from? Without that, fixing these warnings probably has no chance of being done. With that information, it might be possible, but it's also a relatively isolated issue that most people won't have to deal with, and therefore won't give much attention to it.


It does. What in particular would you like me to dig into further?


I can go down to the stack trace level. Whatever it is, I can find it.


Sadly, there's no easy export feature I can find for the text, but I can go error by error and copy paste each chunk of code into a massive text document if necessary.

How old is the iPad 2 nowadays? I have no idea how old they are or how well they'd be expected to perform. If it doesn't support WebGL, that'll likely be an age problem, and thus quite an issue for running MV on it.


According to this, the iPad2 can handle WebGL:


https://blog.ludei.com/webgl-ios-8-safari-webview/


But I'm not sure how we'd go about making it try to use WebGL instead of canvas...


EDIT: I can go to this site on the iPad2 and it DOES show the cube that confirms webGL support:


https://get.webgl.org/


EDIT2: Is there a script command we could use to make this default to WebGL?


From rpg_managers.js:


SceneManager.preferableRendererType = function() {
    if (Utils.isOptionValid('canvas')) {
        return 'canvas';
    } else if (Utils.isOptionValid('webgl')) {
        return 'webgl';
    } else if (this.shouldUseCanvasRenderer()) {
        return 'canvas';
    } else {
        return 'auto';
    }
};


EDIT3: Okay, so I forced it to WebGL and it's even less of a happy camper now, though the framerate does occasionally spike higher than it does when in canvas mode.


I'll be back in a few hours, BTW.
 
Last edited by a moderator:

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
You can force it to use WebGL by making that function return 'webgl'. Now, was this project built using Crosswalk, or Cordova? I believe that these export options are based on Chromium (the basis of Google Chrome), which maintains a blacklist of GPUs that have been known to have issues with chromium, and are thus ignored for the application. I'm not sure about directly building with Cordova, but I know Crosswalk has a built argument to disable the blacklist, so that any GPU should be capable of running WebGL. It's possible that Google deemed the iPad 2's GPU to be unstable and thus placed it on the blacklist, which may be why the game is forced to run in Canvas mode, which is a lot slower than WebGL.
 

JLowther

Veteran
Veteran
Joined
Feb 20, 2016
Messages
327
Reaction score
38
First Language
English
Primarily Uses
I was able to switch to WebGL but it doesn't run very well at all, sadly.


So with that out of the question, do you think optimizations are possible or is it a lost cause?
 
Last edited by a moderator:

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
I'm not very familiar with safari's debugging tools, only Chrome's, so I'm not sure how to run a profile on an iPad's application to see how well it performs. On Chrome, I know you can take a CPU profile to see what parts of the page (game) are taking the longest to process, and from there you can try to identify areas that can be improved upon, but other than that, I'm not exactly sure how to help. I don't know anywhere near enough about Pixi to try to fix rendering warnings of any sort.
 

JLowther

Veteran
Veteran
Joined
Feb 20, 2016
Messages
327
Reaction score
38
First Language
English
Primarily Uses
I noticed that pixijs is actually up to version 4.3.0 while the version used by RMMV is 4.0.3.


But I'm guessing the odds of them updating RMMV to work with it are pretty slim, given that there's no reason for them to work to update to the newest version since it runs on most devices, right?


I would work with a developer to ferret out all of the causes of slowdown, but again, it would have to be something they'd feel would be worth their time. :\
 
Last edited by a moderator:

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
Well, it's quite possible that the update to 4.3.0 won't involve much, if any, changes to MV's code, the Pixi devs have always been pretty good at not changing the API too much  between releases, even major updates (i.e 2.0.0 -> 4.0.0 didn't  change a lot of important things, or things that were renamed were at least partially supported (For example, the main object type PIXI uses to display scenes is now called a Container. In the past, it was DisplayObjectContainer. When they changed it, they displayed a warning, and then created a Container for you)). So I'd say try making a copy of all your Pix files, and then see if updating them breaks anything.
 

JLowther

Veteran
Veteran
Joined
Feb 20, 2016
Messages
327
Reaction score
38
First Language
English
Primarily Uses
Already done and it broke things a great deal, heh...


Do you happen to know who I would ask about future updates? Who on these forums would actually know about future updates and whatnot?
 

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
@Archeia is typically the main person to talk to, as aside from Touchfuzzy, I believe she's in charge, so it's probably best to try to fo through her, but just keep in mind that as she would be the one that gets the most contact, she's also the most busy and so she might not get to your request immediately, or might not be able to help you as much as you'd like her to.


If Archeia doesn't respond, or is unable to help, he's not very active on the forums, but @Hackerham works on Pixi, or is at the least familiar with it, though I wouldn't expect him to help you personally with your project because I'm sure he's busy, but I suppose it couldn't hurt to try asking him.
 

JLowther

Veteran
Veteran
Joined
Feb 20, 2016
Messages
327
Reaction score
38
First Language
English
Primarily Uses
Yeah, I fully expect them to be busy, and the other issue at hand is that the current pixijs is working just fine for what's currently needed from it. Plus, I'm not even certain if the new pixijs optimizes anything.


What I'm really talking about here, I suppose, is a refactoring of the RMMV engine, something that's time consuming but good for the overall health of the application. I can't possibly be the only person who's attempting to release RMMV games on iOS and would lament missing out on the iPad2+3s marketshare in the process.


RMMV has massive potential for so much more than just RPGs. I've built a complete children's book app for iOS with it already (complete with a card matching memory memory game and everything). The only issue is that it runs sluggishly on popular hardware. :\
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.
time for a new avatar :)

Forum statistics

Threads
106,018
Messages
1,018,358
Members
137,803
Latest member
andrewcole
Top