-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved rendering speed on Mii Maker #303
base: dev
Are you sure you want to change the base?
Conversation
Hello, thanks for your contribution! While I fundamentally agree with the fact that the speed of the current miieditor implementation is... really bad, I'm not sure that sending so many requests to the Mii rendering API is a good idea. Like, I'm worried they might add authentication or CORS headers (bypassable through a cors proxy, but that could expose us to the risk of our proxy ip being banned). To be fair though, I'm not an expert with regards to how Nintendo handles many requests, so I'll pass this along to @jonbarrow, who has crashed official Pretendo servers twice. |
Hello @gitlimes! Thanks for the reply. I think it's a great idea to wait for Jon's response, but here are some important points:
Another consideration that could be taken into account would be to rewrite the API using our own images, which would take time, but I could make a contribution regarding that. |
You raise good points! The issue with using our own images is that, unless we were to make our own assets, we'd be committing copyright infringement, which is something Nintendo doesn't exactly... uhh... take lightly. |
What is the average number of requests being made per page transition. I agree with @gitlimes about being worried of over using the rendering API. Even just an extra request effectively doubles the amount of traffic we would otherwise send to the API, growing exponentially. I do agree that it's probably unlikely that they'd outright block things. But I stay in the habit of not stepping on Nintendo's toes. Pretendo as a uniquely positive relationship with Nintendo currently (we were directly involved in getting the December 2023 NN connection issues fixed, for example), and I'd like to keep it that way. As for the renderer in general, it's important to note that @shutterbug2000 is currently working a new renderer that doesn't use Nintendo's servers at all. Instead it would use our own servers, running the Miitomo Mii renderer either through an emulated Android device or QEMU. |
The average number of requests being made per page is 12. Some pages with range inputs require more requests (about 50), like when changing eyebrows position, size, etc. Also, when changing range inputs the images are cached again to apply the changes correctly to all possible inputs in the page. |
This PR improves the Mii Maker rendering speed by caching all the possible images from a tab before being selected.
Detailed changes
Basically, when the user selects a tab, subtab or page, all the images from that section are cached, including all possible changes that the user can do.
It gets all the inputs in that tab and all the possible values of each.
This improves a lot the speed because when the user input something the images are loaded and ready to be rendered into the canvas!
Also, added some little changes to the mii maker handlebars code, so we only cache what's really needed, to avoid the application to slow down.
The images are deleted after they aren't needed anymore so we don't need to worry about memory consumption.
Also, if the user have a really slow internet speed, the blur effect is still used when needed.
Video demo
2024-05-26.07-45-26.mp4
Any suggestion, feedback or bugs just message me! :)