Camera size in andengine for tablets - android

I'm writing a game specifically for Android tablets, using andengine. If I use fixed camera,
andengine will scale the view to fill the device screen. What values I have to use for CAMERA_WIDTH and CAMERA_HEIGHT, so that the game will work fine on most popular tablets?
Thanks.

I think you should consider writing for a particular size - say a 7" tablet - the Nexus 7 has a resolution of 1280 x 800. Then let AndEngine use a RatioResolutionPolicy to adjust for the differences in any other screen sizes. See this answer for more info
Sprite size on different screen size Andengine Android

Related

What are the criteria to select the appropriate resolution to build a 2D game?

I'd like to know, how can I select the best resolution to build a 2D game in android?
You can go with 1920*1080 - this will give you a clear output on most current devices - and use FitViewPort or ExtendViewPort as you wish.
I'm rendering my graphics in 2K resolution (i.e. in 3040 x 1,40 - aiming most popular high-end phones of today, i.e. Samsung S10) so it will definitely look well on screens with higher resolution. And then I'm using camera zoom to display it properly on current screen resolution. It does take a bit more space for graphics and it's probably loosing some frame per second but on today's devices it's acceptable loss. My games run smooth even on older devices, so I don't think it's an issue at all.

Camera2 video recording with custom resolutions?

Currently, I am following google's sample code in Kotlin for Camera2 API. Everything seems working fine in terms of video recording. However, I do have different requirements for my project as listed below.
I need to record a video in three possible ways 640 x 640(square), Y x 640(portrait), or 640 x Y(landscape) in portrait screen where Y is a number less than 640. 
640 x 640(square):
I have Samsung S9+ which supports only one resolution with 1:1 aspect ration which is 384x384, but when I post on Instagram they create a video with 720 x 720 resolution with good quality. So the question is how Instagram is enlarging a low-resolution video without losing quality?
W? x 640(portrait):
I need to find out an equal or high resolution with the closest matching aspect ratio and later on, I can run the FFmpeg command to match with the required size, right?
640 x H?(landscape):
I can follow the same thing as in the portrait use case. However, the real question is how to record a video in the landscape if your screen is in Portrait orientation?
I have already researched a lot on each use case and now open for any possible solutions like FFMpeg, OpenGL, MediaMuxer, MediaCodec or anything else?
Any hint, links or suggestion would be highly appreciated. Thanks in advance.
640 x 640(square): Instagram is likely capturing video at 720p (1280x720) and then cropping to 720x720 in their own code.
Generally, camera has only a few resolutions available, and they all tend to be landscape. If you need portrait resolutions (or landscape resolutions in portrait orientation), you will probably need to do your own cropping.

Optimum Unity Android splash image resolution

I've Unity Plus and I'm trying to find out the optimum android splash screen size that fits all android devices as there's no option to specify multiple images with different resolutions for android.
So far I've tried 768x1024, 1536x2048 on every option(center, fill, fit), however some nexus tablets/phones won't display the splash image full screen correctly.
Is there an optimum/suggested image resolution/configuration for android devices that most likely fit all?
There is a Splash Scaling property in Player Settings for Android builds. Try setting it to Scale to fill (cropped). Your splash image will be scaled without changing the aspect ratio.
We are using 1280x720 image in Unity 5.3.4 for android builds without any problem.
The image will be cropped but if there is not any sensitive text or symbol on the edges that will not be a problem.
Hope this helps.
Generally, you'll want to include multiple copies of the image at different resolutions and aspect ratios in your deployment. For example, small and large, both with different ARs. You would read the screensize of the device and select the appropriate size image for the device.
To give more detail here, I worked on a game that targeted devices from small screen sizes (Galaxy Ace), to large tablets (Galaxy Note 10.1). We used our own splash screen implementation rather than unity's, and we calculated the aspect ratio of the device. We then checked the screen resolution. After that, we had enough info to select the appropriate resolution image for the screen. It costs a bit more space, but it looks nice and crisp on almost every device.

Converting iOS game dimensions for Unity2d android

I recently started working learning Unity2d from an iOS background. I am using the FWVGA Landscape (854x480) dimensions. I resized a 1136x640 background image (which I use for iOS) to 854x480 and made a sprite with the image but it only took a small portion of the screen. I had to resize the image in Unity. What are the general rules for converting dimensions from iOS to Android on Unity to get the dimensions to fit?
1136x640 is the ratio 16:9, as is 1920x1080 (1080p). Note a quick way to check the ratio: 16/9 = 1.77r. 1920/1080 = 1.77r. 1136/640=1.77r, 854/480 = 1.77r. All the same 16:9 ratio.
So, for Android phones that are also 16:9 you don't "need" to resize your assets unless say you want to up the resolution for quality sake on more powerful Android devices.
If you want to do it quick and easy then you want to draw your game in a camera at 1336x640 and then scale the camera view to match the resolution of the device you are running on (be it 1920x1080, 640x480, etc - all the same ratio).
You get problems with devices that are not 16:9 like tablets or phones that are say 16:10, 5:3, 3:2, or the iPads and Nexus 9 tablets at 4:3. This is a long subject though and there are lots of guides around to help. Try searching for "Unity 2d multiple screen ratios".
I think there are just too many variables to make this work "simply"
854x480 doesn't sound like a 'standard' HxW to me. and Unity is a 3D game engine which means its camera is on the Z axis when you are "looking down upon" a 2D game.
So the camera Z axis(Which apparently Unity tries to 'adjust' to match the phone's size, the phone's physical size, the size of the image you are using, etc. There are just a lot of variables. I would recommend https://stackoverflow.com/a/21375938 to see if that helps.

Android different screen size issues (Testing on Galaxy S1, S2, S3 and Note2 etc)

I'm working on a game, it's almost complete (just tweaking & testing), I have Samsung galaxy S1, so graphics works just fine on Galaxy S1 and S2, however.. tested on Samsung galaxy S3; had to create image resizer function to resize all the files when loaded, now it works just fine on that. But, I don't have all Android devices to test the graphics on different screen size. I've created different screen size devices on emulator(AVDM), tried on them, but bad result (ramsize, heap size had to be unreal to test properly).
That's a background info. Ok, let me get to the point;
I haven't tested the game on bigger screen devices but tested on Samsung Galaxy S3, graphics were smaller on S3 since it loaded images from mdpi folder. So, what I'm doing with my graphics is, loading pre-resized images and I get the device's screen size and trying to resize them manually with float values to make sure the graphics is not too small nor big for current screen while the "AnyDensity=false" on manifest.xml. It's easier to do that when you actually test on the specific devices to get expected result. I've disabled the auto-resize function to fasle to avoid "OutOfMemoryError" when android resizes graphics automatically. It works, but it's hard to assume the float value when you can't predict the screen size.
I want to hear your experience on this, what do you guys suggest on such situation? How do you resize your graphics for different screen size devices to fit perfectly on the screen knowing current screen width and height values?
An example: forest_1.png width/height: 600 x 400 px on Samsung Galaxy S1 (533 x 320) screen would render perfectly, but how to predict the exact values to resize forest_1.png image for Android Note II without having the device to test? (Note II screen size is 1280 x 720 )
Any comments / suggestions would be appreciated, thanks!
In my opinion you will need to resize the image programmatically. Examples you can find in answers here:
Image crop and resize in Android
And this is how you get the dimensions of your device: Get screen dimensions in pixels

Categories

Resources