OpenGL vs Unity Android live wallpaper - android

I created Android live wallpaper using canvas but it seems to be quite slow in performance. I was thinking of shifting towards OpenGLES 2.0 but it is very difficult to code from scratch because there are a lot of animations. I want a sincere opinion which one is the best for making live wallpapers Unity or OpenGLES 2.0, also give a basic idea whether unity slows down the wallpaper or not.
Thanks in advance.

I'd suggest using Unity.
Unity engine is pretty good for highly-visual stuff, with its visual editor, good asset import pipeline and tons of stuff on Asset Store that would help to boost your development. It'd be very hard to beat it performance-wise. There are other game engines that you could use for live wallpapers, but it'd be a much more tedious task.
The negative side of using Unity is that it might be somewhat heavy - it's expected to have an minimal APK of around 9 MB in size This doesn't really matters if you have a resource-heavy live wallpaper, though.
What makes it possible, is that recently I've released uLiveWallpaper - a Unity asset that makes it possible to create live wallpapers for Android using Unity 5. It is well-tested and reliable, creates projects for Android Studio, complete with placeholder code to get you started.
Check it out:
http://forum.unity3d.com/threads/ulivewallpaper-develop-android-live-wallpapers-with-unity-5.375255/

I don't think you can create a live wallpaper using Unity. At least not easily, Unity is not intended for this. Usually a live wallpaper consists of a service, a Settings activity, and some sort of resource which defines your live wallpaper. Everything you create in Unity will be compiled packaged magically transformed into an activity with a launcher. This means your Unity "game" will not be in the wallpapers list, but in the apps list. Also, by default it will run in the front, not in the back of a home screen like a live wallpaper would do.
To make it work as a wallpaper would require a lot of altering to what Unity outputs when building, because Unity does not offer any live wallpaper settings. That seems like a lot of work. Also, it seems a bit overkill to use a game engine or OpenGL for a live wallpaper.
Keep in mind that you should not try to create a >30 fps live wallpaper, because that would drain an Android device's battery pretty fast. If I were you I would try to make the wallpaper look good with <30 fps. Try not to have fast animations, pre-render 3D stuff and optimize what you already have.

Related

Should I use mobile shader if not necessary in Unity

For some time I'm creating simple google cardboard vr game. It's one of my first games so I probably dot know many things. My problem is that i was uing standard shader all the time, but recently I noticed that there is mobile shader available. Then when I was browsing through Unity's standard assets i found AutoMobileShaderSwitch script(I suppose it switches between shaders depending on the platform). The thing is that I have been using standard shader all the time and it worked just fine(on my phone).
Is there any reason to use this moblie shader in this case. Maybe it will increase performance sginificatly? Aleso do you know what shoul I do with this AutoMobileShaderSwitch script? Should I just attach it to any gameobject?
Usually what you do is to develop with standard shaders. Don't worry about mobile shaders until you are about to release for mobiles, then you switch the shaders to mobile. By doing this, you will know that the images you see during developing is the highest quality of what your game would look like.
Also, when making your game, always check for the framerate once in a while, on your mobile device. If it gets down to something you consider to be unacceptable for your game, then you can switch the shader to mobile and see if that makes a difference before spending time, optimizing you code.
And yes, mobile shaders will improve performance, especially when using transparent shaders. Mobile shaders are optimized for mobile devices. Basically, things were stripped out from them to make them faster and lighter on mobile devices. The down part of this is that some mobile shaders don't look good like the standard ones because things were removed.

UI using OpenGL

I've been given a task of designing an app in android with the UI created in OpenGL. The reason for this approach is the fact that the app will be a port from iPhone and Android does not have such smooth animations and graphics as IOS.
I have experience in Android development but I'm totaly new to OpenGL.
Is that approach reasonable to create GUI in OpenGL? If not, why? If yes, how do I start?
Is your application a game? because if not, I think using OpenGl just for creating a fancy UI might be too much. It leaves the door open to do things inefficiently, and probably, get a lot of bugs.
You can get a lot fo smootth animations using the different animations of Android.
If you still want to go with OpenGl, I will first advice you to start with Android Documentation

Android 2D game development without an engine

I want to know the best way or a tool for making a good Android game!, I mean by "good" that the game must have a nice performance no lags or something like that, ..
So I will begin by 2D game development, and I want to avoid "Game engines"! ..
So what's the best way?! - to make it by Open GL ES or there another way?! ..
You should be able to learn a lot about open gl graphics programming by looking at Replica Island. Its an open source 2d Platform game which uses no engine.
The author gave some talks on Google IO which might be of interest to you:
http://www.youtube.com/watch?v=U4Bk5rmIpic
http://www.youtube.com/watch?v=7-62tRHLcHk
http://www.youtube.com/watch?v=cdvaPyq_eBU
It's possible that this is considered too broad a question - we can't tell you how to make a game. But in response to your last question: yes, OpenGL is the best way to make a high performance game in 2D or 3D. If you have a more slow moving, turn based game, then you could stick to a Canvas on a SurfaceView or even use basic View widgets to build up the layout of a game board.
But if it's your first game, unless you have a lot of time and patience, I would strongly urge you to try an existing game engine. You may not realise how much work goes into a decent game engine until you're halfway (or 10% of the way) into making one. Have a look at the source of an engine like LibGDX and think about whether it's the sort of thing you'd be able to write.
There's plenty of info in the Android graphics dev guide.
You do not need a game engine to develop a 2D game in Android. You do not need to use SurfaceView either. SurfaceView, OpenGL and AndEngine and (maybe other game engines) have issues with consistent sprite animation speed and size of sprites across the various Android devices. Especially when the game has complex sprite movements. I went crazy trying to build a 2D game with consistent speed movement of sprites and sprite sizes in relation to screen size and density (e.g. tablets vs phones). So, I decided to drop the game engines and this is how I accomplished my first recently published 2D Android game:
Use drawable-nodpi for sprite images (gives sprite size consistency
across screen densities and sizes)
Use different layouts to support various screen sizes (e.g.
layout-large, layout-xlarge, etc...)
Use TranslateAnimation and ObjectAnimator to animate sprite movements across screen
Use math to figure out sprites collision (e.g. screen coordinates and sprite location etc.)
Use handlers and condition statements to control the game events
You can test the outcome of following the above guide to developing a 2D Android game without game engine by checking out the game. It is called Yum Yum Pow available on Google Play. The free limited version is available also on Google Play. I can only link to free apps I think, so here it is:
https://play.google.com/store/apps/details?id=com.wildroid.yum.yum.pow.limited
If u are planning to build a simple game then stick with Basic android.If it is a big game,With out game engine your game developing will be a heavier process.if u want to use a lot of images then memmory problem will occur(OOM).if u are comfort with the game engine that will be easy for future game developing.if u are making a simple game then there is no need of game engines.
there are so many game engines available
andengine,libgdx,cocos2d..

3D chess Using adobe flash cs5 and OpenGL on android project possible?

Can I Use both Adobe Flash cs5 and OpenGL to create an application on an android OS4.3 device?
I am creating a 3D chess game compatible for an android OS 4.3, so I am using eclipse and the SDK obviously.
The problem I have now is I am meant to make the chess pieces human like. For instance, the pawn pieces should look like miniature foot soldiers and the king piece should be a figure of a person sitting on a throne etc. I started with OpenGL but because I am new to it, I might not be able to carry put displaying the graphics with OpenGL. So I decided to use adobe flash cs5 to create the pieces and use OpenGL to make the chess board because I can do that and also because in my specs, I said I would be using OpenGL.
I want to know if this will actually work and also if there is a much easier way of doing this I just haven't thought of. Any suggestions would be appreciated, especially how to implement this with the A.I.
If anyone has a sample or an idea I could work with, I will also be very grateful.
Adobe has said that "Stage 3D" support will be coming to mobile devices in the future, but in the meantime, there are not any ways to accelerate 3D with Adobe AIR.
Although Away3D or another 2.5D library would be fast enough for the web or desktop, I am not sure how well this will work for mobile, as AIR moves slow enough even for 2D games.
Since chess is a relatively static game, you might be able to create 3D graphics, then render to 2D sprites. I was the lead engineer for a large Facebook game, and we used this approach. ALthough it required more file size, it worked very well for quality and performance. The end result was something similar to Diablo 1, but in a cowboy theme instead of medieval.
Although it does not have true 3D support, yet, you might also consider looking into NME. That Facebook game I made ran at 5-6 FPS using Flash, but topped 30 FPS using NME on my old Palm Pre (so not the fastest phone in the world). That might help give you extra overhead to be able to lean into rich graphics. The framework will also publish as a true C++ NDK application, so it is actually possible to extend or modify the framework (it's open source) with your own OpenGL calls.
Here's the website if you're interested: http://www.haxenme.org

Android Live Wallpapers -- OpenGL vs Canvas

I am a fairly "newb" Android developer, and I would like one of my first projects to be a live wallpaper, however I am conflicted on whether I should be focusing on Canvas or OpenGL for it. Being new to this I know I should master Canvas first since it is easier to use, but I prefer to learn from real world projects that I have an interest in, even if it's a little backwards at times.
I have used both before in very basic ways, and I understand the general concepts to them, but I am not sure how they transfer over to the realm of live wallpapers. I figure that the full blown speed of OpenGL isn't required on a live wallpaper, since running it at max FPS would just run down the battery more than it necessary, but at the same time I am worried that using Canvas would cause lags and stutters when doing things like changing home screens.
I have been leaning towards using OpenGL ES 2.0, both to keep performance optimal and because my initial ideas for the wallpaper involve a lot of layering that I am not sure Canvas is capable of, but I'd like a more experienced developers opinion on whether or not all of the extra work involved in using OpenGL (especially in relation to live wallpapers, from what I've read) is worth it.
If you can get away with just drawing to a canvas (e.g. cube example in SDK), that's much less work. Because of the simplicity of the animation (no bitmaps), the cube is able to achieve a high frame rate without difficulty.
If you want to use OpenGL, you will need to use a supplemental package, such as GLWallpaperService, AndEngine, or RenderScript.
http://www.rbgrn.net/content/354-glsurfaceview-adapted-3d-live-wallpapers
http://www.andengine.org/forums/tutorials/live-wallpaper-template-t258.html
Browse the Android source code to see how the stock wallpapers (e.g. Grass, Galaxy) are implemented using RenderScript. This link may work, but no guarantees: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android-apps/4.1.1_r1/com/android/wallpaper/ (then scroll down to the wallpapers)
Moonblink has discontinued his project, but if you're really keen, you can try researching his work (Substrate) starting here: http://code.google.com/p/moonblink/source/browse/wiki/Setup.wiki
I ended up using OpenGL as halfway through the project, canvas drawing proved to be too slow for what I was trying to achieve. Using OpenGL caused a massive performance boost. Unfortunately I had to refactor my code, so I would reccomend using OpenGL from the start. Dirty rendering is supported by OpenGL as well as the wallpaperservice's structure doesn't rely on the way you render things so you would still be able to create a wallpaper that doesn't drain the battery. Actually a well programmed wallpaper doesn't render when it's hidden. As the wallpapers shipped with android don't follow that pattern, live wallpapers now have the bad name of being battery suckers. Really a shame..

Categories

Resources