Low performance maybe related with images - android

I don't know exactly what happened, I developed a simple memory game that mostly uses ImageViews, at some point all ok in performance terms, but after exported and signed, the game looks so laggy in my xperia sola, it takes too long to press buttons when you just open the game, after 3-4 buttons pressed all go back to normal performance, those issues aren't so noticeable on better devices (xperia sp or lg optimus g as testing examples).
But, the fact is that I have not changed nothing on code either before or after last testings (when game was ok), I just made changes on Images, used a picture editor to remove imperfections on all images and get something more polished, of course game size increased (from 826kb to 1.85mb after edit) and nothing else.
I'd really like to show you code but is too long.
Maybe can you help me to identify the issue?

Related

problem with exporting a game to android in unity

I created a trial 2D game in unity which consists of 4 scenes. In each scene there are several objects. Generally game is not very demanding in terms of components. The problem is exporting the game to android. The application stutters a lot as if it had 5 fps and the graphics deteriorates significantly. I tried to export the application to my computer and the game does not stutter but there are slight blurring of objects in addition I noticed that when I turn on the game the computer starts to howl, I checked what is the reason and it turned out that the application consumes all the graphics prosesor I do not know why. In the application (on android) were also strange errors among other things when scaling the buttons in the menu (they are very small) and the animation of loading the scene (also very small does not cover the entire area). It is possible that it is about "player settings" but I am not sure.
I am focusing more on android so this is the problem I would like to solve the most.

Ripple effect on all clickable items is slow

I do not know what could it be, but does not look like a performance issue (like doing too much work on the background) because there is no message on LogCat saying Slow measurement, Frames skipped or ConstraintLayout issues. The app animations work perfectly. But, unfortunately, all the clickable elements that I added on the xml:
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"
are too slow. That slow, that whenever I click, instead of the smooth animation that moves and starts on the exact pixel I click on, it appears an awful shadow and remains like so for a while (~2 sec).
If it is indeed an android performance issue, how to debug it? Also, I do not know where to start and which information I need to add in order to add valuable information to this question but, if needed, please, ask for it and I will try to add as much information as possible.
The only thing I could say in advance is I am using MVVM and coroutines, so there is no performance issues on that matter, but maybe only UI related?
EDIT:
Samsung J2 Prime and Samsung Galaxy Note 3 work good, all animations are good (even though is a small and old device)
Motorola Zoom and Redmi Note 8 Pro are working with laggy animations (animations are meant only the clickable animation (Ripple effect), the ConstraintLayout animations are working smooth.

Adapting to Samsung S8-like screens with 'blind pixels'

How to avoid 'blind pixels'? S8's round-cornered screen may affect layout in a significant way. How to know where I can safely draw anything, and where I have to be aware that some part of drawn pixels may never actually display?
I don't want to force non-fullscreen mode. I just want to know where is my "safe rect". How to get that information?
(possibly in a way that can be applied to every phone no matter what company manufactured it, but device-specific solutions are also very welcome)
edit: added picture for everybody still in 2016:

Video on canvas with panning - how to solve performance issues (also: HTML5, Flash or something else?)

Long version:
I have a very particular issue. I'm a multimedia artist working at the moment together with an animator - we are trying to create an interactive animation that I want to make available online as a website and as free app on the App Store and the Android Market.
But here's the key problem I am faced with now.
The output video of the actual animation will be massive in resolution - probably something like 4 or more times the HD resolution, but it's for a reason. The idea is to let the viewer only watch a part of the video at one time - like when panning around in Google Maps or any other canvas-like view (eg. MMORPG or strategy computer games). So you only see a part of the whole image at one time, and then you can move around to see what's "behind the corner".
So the animation would be a Google Maps-alike canvas (panning and perhaps zooming if there's enough time to implement it) but with video instead of images.
The big problem that comes up is performance. I was thinking that the best way to make it run would be to scale down the video for different devices accordingly. But then even just considering desktop computers for now - scaling down to 720p for HD screen means there is in total of about 4 times 720p in resolution, which is probably too much for an average computer to decode (Full HD is quite often already problematic) - and the output resolution would be more than the 4K standard (5120 by 2880, whilst 4K is 4096x2160). Anyhow, that is unacceptable.
But I reached the conclusion that there is really no point in decoding and rendering the parts of the video which are invisible to the user anyway (why waste the CPU+GPU time for that) - since we know that only about 1/6th of the full canvas would be visible at any given time.
This inspired an idea that maybe I could split the output video into blocks - something between 8 to 64 files stacked together side by side like cells in a table, then have a timecode timer playing in some variable and enabling the video-blocks on demand. As the user drags the canvas to the visible element it would automatically start the playback of the file at the given timecode read from the global variable. There could be some heuristics anticipating users movement and prematurely activating the invisible blocks in order to remove any delay caused by seeking within video and starting the playback. Then blocks which are no longer visible could deactivate themselves after a certain amount of time.
So my first attempt was to try and see what are my choices platform-wise and I really see it comes down to:
HTML5 with JavaScript (heavily using <video> tag)
Adobe Flash (using Flash Builder to deploy the apps to all the different devices)
And HTML5 would really be more preferable.
So I did some research to see if it would be at all possible to even synchronize more than one video at a time in HTML5. Unfortunately it's far from perfect, there are two available "hacks" which work well with Firefox, but are buggy in Webkit (the videos often get out of sync by more than a few frames, sometimes even up to half a second, which would be quite visible if it was a single video split into blocks/segments). Not to mention the fact that I have not even tried it on mobile platforms (Android / iOS).
These two methods/hacks are Rick Waldron's sync as shown here:
http://weblog.bocoup.com/html5-video-synchronizing-playback-of-two-videos/
And the other one, also developed by Rick is the mediagroup.js (this one doesn't work in Chrome at all):
https://github.com/rwldrn/mediagroup.js
My test here: http://jsfiddle.net/NIXin/EQbAx/10/
(I've hidden the controller, cause it is always playing back earlier than the rest of the clips for some reason)
So after explaining all that I would really appreciate any feedback from you guys - what would be the best way of solving this problem and on which platform. Is HTML5 mature enough?
Short version:
If I still haven't made it clear as to what I need - think of a video zoomed in at 600% so that you can't see everything (some bits are off screen) and you need to pan around by dragging with your mouse (or flicking your finger on mobile devices) to see what's going on in different places of the video. How could I do that (have the video run smoothly) across platforms, while retaining the high quality and resolution of the video?
Thanks a lot, let me know if you need any more details or any clarification of the matter.

OpenGL goes green on tablets

Description:
My OpenGL game runs fine on phones. However, after a couple of seconds of running on a tablet the 3D rendering goes all green. The 2D overlays (gl) are mostly fine.
This might be triggered by rotation, I can't be sure; no access to a tablet.
A user kindly recording it happening, which I have posted online:
http://www.youtube.com/watch?v=DRfDM673TRA
Questions:
Has anyone seen this before, or know of a possible cause/cure?
Also, can anyone confirm this is is still happening? (BB Rally Lite is free).
Other info:
The game is locked into landscape mode so I wouldn't expect it to do anything on rotation.
Update:
This was a bug in my code.
Tablets have a different default orientation,
which was triggering conditional (bugged) code that never got run on a phone.
The green screen was a result of the bug causing the model's matrix to contain nan (or inf, I can't recall).
If you suffer from a green screen I suggest you start by looking at your matrices.

Categories

Resources