Android :: Android OpenGL Game - App Architecture / Threading Logic
Apr 8, 2010
Surprisingly, I don't seem to have issues with the OpenGL side of things (which is very unusual), but my problems stem from getting a clear idea for app architecture and a few other problems. Right now, most tutorials on the net just describe the render portion. I know that when I create a GLSurfaceView and hook a Renderer into it, it uses it's own thread for rendering.
I want to do logic operations and other gameplay stuff (like moving characters and whatnot) in it's own thread as well. Can anyone explain a good approach to this? I'm guessing the two threads will have to be synchronized (do logic, render, repeat), and limited based on time so that it performs smoothly across different devices.
View 1 Replies
Aug 27, 2009
I'm converting an app I've written from Canvas to OpenGL, and not having too hard of a time yet. However, I've run into one snag that I can't seem to get around. My old app was threading image loads, because there are a ton of them, however, it looks like the OpenGL implementation protects itself to a single thread. I have a basic loadBitmap() function as follows:...............
View 4 Replies
View Related
Mar 7, 2010
I'd like to announce the release on the Android Market of our last creation: 1 Minute Game. The main concept is very simple. The computer shows puzzles based on numbers, shapes and colours: the player must solve them and touch the correct answer to go to the next round, trying to be as fast as possible. We implemented 3 different modes that must be unlocked by playing more and more. You can play games under the "Training" areas so to train yourself and challenge your friends locally (there are 6 slots to store the profiles of the players).
Online Challenge
But the core of 1 Minute Game is the online challenge, which allows the players (once per day) to play a special match and to send the result to an online leader board. Each score shows also the nationality selected by each player try to get your country at top of the ranking. The ranking is visible both through the application and visiting the web site of the game.
Free DLC
In order to make the game more appealing and let you enjoy it for more time, we are developing new games to be released for free in the next versions of the application. For example, this morning (it's a matter of minutes) we will release the version 1.1 which contains a brand new game in the training section: The intruder. In each round, all of the objects shown on the screen share the same characteristic (same shape, colour, number or animation) except for one: that's the Intruder!
New games of logic will be released once they are completed and fully tested through future news.
LITE version
There is also a LITE version in the Market: 1 Minute Game LITE (limited number of levels, no online challenge and 2 slots to store the users' profiles), so you can try it and see if it is worth to buy the Full one. This LITE version includes the additional training "The Intruder" as well.
DOWNLOAD
the game can be downloaded from the Android Market. Just search for its name or click on these links with the browser of your Android smartphone:
FULL version - market://search?q=pname:com.wepromite.oneminutegame
LITE version - market://search?q=pname:com.wepromite.oneminutegamelite
View 7 Replies
View Related
Aug 26, 2010
I know this is more of a general programming question, but my Android friends here have always been helpful. I am trying to make an image move from one part of the screen to a position the user touches, as a constant speed. I don't know the best way to go about doing this and the way I have been trying to get to work is taxing my brain too much.
I have been using geometry to calculate slope, then using Sin * movement speed to calculate the difference in X,Y coordinates.
This is the codecode...
The problem that I'm having is the image is veering way of course when traveling in Y heavy paths. When traveling horizontally it works almost perfect.
I know there is probably an easier way though I don't know how to use a lot of things (like OpenGLES) so if your advice is to use a different method please link a tutorial for that method if you know of one.
View 7 Replies
View Related
Aug 24, 2010
Now I have (1: the UI-loop, there my SurfaceView is placed), (2: a second thread, there the draw function from the UI-loop is called AND the update calculations from my Engine) and (3: the engine, there all the calculations stuff are).Now I wonder how the best and smoothest way to do the SurfaceView independent from the actual frame rate. How shall I do so it will compensate if there is a low frame rate?
View 2 Replies
View Related
Jul 25, 2010
I've read the article "Supporting Multiple Screen" on Android developers site. But that doesn't apply to game logic.Let me get straight to the point. My situation is as follows:
- I'm creating a game using LunarLander code as a base.
- In my game, there'll be an object flying up from the bottom of the screen. The object will fly in projectile motion.
- I set the starting velocity, gravity and angle so that the highest point(of projectile motion) is almost at the top of the screen.
- The screen tested is Motorola Milestone. (480x854 resolution) Meaning the object travels around 854 pixels vertically.
I'm thinking of adjusting starting velocity based on screensizes. But that sounds unreliable when we've so many devices/resolutions out there. How do you combat these kind of problem when making games?
View 3 Replies
View Related
Oct 13, 2010
What do you think is the best phone for OpenGL ES based game development? Large screen, OS 2.0.1+. Maybe even having the shaders path accessible from NDK.
View 19 Replies
View Related
Sep 14, 2010
im currently playing around with a Game that architecture is basically like the example 2d Games like JetBoy / LunarLander and so on. But as things now running (and animating continuously) they have kind of "hiccups" when the GC is running. I have done all i can to allocate as much Objects in front. There is nearly nothing that is created "new" besindes some Strings that are used to set the Score and so on. (TextView doesn't take int's =( - So do you have similar Problems that the GC is "lagging" your 2s game ? any solutions ?
View 12 Replies
View Related
Feb 12, 2009
I need to draw a background of 320 x 480 (fullscreen) for a OpenGL game. What I did was to stretch the texture to 512 x 512 and mapped it to 320,480 quad and then drew the rest of the game elements. I tried changing the texture image to 256x256 and no noticeable improvement in speed. Game was horribly slow even on the real device. It is actually slower on the device than on the emulator... I think i am the first one to have such a situation.. I am drawing a max of 12 triangles only 2 for background and rest are 64 x 64 textures. on 5 quad made with 10 triangles. I have disabled Depth, Lighting already. Only blending enabled as I use transparent PNG for texture of sprites. render cycle is like this - draw the background - draw the sprites (only 5) [with 10 triangles only] - swapbuffer... Please don't advice me to use 2d canvas, bitmap etc... I need to do it in OpenGL only. don't think OpenGL ES 1.0 is so incapable that it can't give me atleast 25-30 fps with just 12 triangles which you one 256x256 texture and one 64x64 textures (used by 5 quads...
View 20 Replies
View Related
Nov 16, 2009
I have a the beginnings of an Open GL game running, and have gotten to the point where it would be nice to have the FPS displayed. Since I will probably want to be able to put score or other info up anyway, I started searching for how to do that. I found the SpriteTest example, It looks nice, but really complex. Is there an easier way?
View 5 Replies
View Related
Jun 18, 2009
My game runs fairly well on my phone, but i want to increase the performance by using opengl. However currently i use the Canvas. I am a beginner in opengl. I have to port all my drawing code to opengl. However can somebody give me directions. For example how do i do the following in opengl:
c.save();c.scale(0.3f+scale, 0.3f+scale, width/2, height/2) c.drawBitmap( bMsg.bitmap, width/2 - bMsg.bitmap.getWidth()/2,dy+height/2 - bMsg.bitmap.getHeight()/2, MESSAGE_PAINT);c.restore();
And why cant i just use Canvas as an abstraction layer (facade) for opengl. An implementation of canvas could call the correct opengl methods in order to render. Why do i have to port all my code. I thought the canvas was a good abstraction interface to a drawing surface, why do i have to bother with opengl? It looks like this is possible, when is see the following contructor: "public Canvas (GL gl)" Also the this seems usefull. SURFACE_TYPE_GPU Surface type: creates a surface suited to be used with the GPU So what should i do? Re implementing the GamePainter completely and call opengl functions directly? Or is there some kind of abstraction mechanism, so that i can use OpenGL with just a few lines of code?
View 4 Replies
View Related
Sep 18, 2009
I've been working on a game framework for a little while, and while its far from perfect, I've put the current version online. To be honest, I haven't used much OpenGL in the past. Before last week I had never tried using it. If anyone would like to take a look, please do, I'd appreciate all the help possible on speeding it up. There are many features I have in mind and am planning at the minute, but so far it supports:
# Texture and Sprite management # Text, using TTF fonts # Organised layers # Two audio management classes, one optimized for music, the other for sound effects # Sprite dynamics (acceleration, terminal velocity, collisions) # Animation # Handlers to manage events fired through movement, animation, screen touches, accelerometer input, device shaking and collisions # Several minor features aimed at speeding development, such as screen settings and vibration.
View 1 Replies
View Related
Feb 4, 2010
I'm trying to develop a 2D game to android using opengl. I know how to print images on the screen and animate them. But in my game I have a map and a want to zoom in and out and scroll the map. But I can't figure out the best way of doing it.
View 2 Replies
View Related
Nov 8, 2010
I'm planning to develop a 2D game for Android devices without a dedicated GPU, like the HTC Wildfire. I remember from the PC that OpenGL is generally to be chosen over something like SDL for 2D graphics because of speed and features. On Android, there are two APIs for graphics: A "normal" 2D API (does it have a name?) OpenGL ES 2.0 Which one should I favor for a 2D game that should run on Android devices without a dedicated GPU?
View 1 Replies
View Related
Nov 12, 2009
I'm scoping a new software project and haven't had much experience with software development. This is a multipart question.
What are some recommended books for web application architecture?
We are basically looking to develop several front end applications (mobile and websites) that can query a central application pool that'll hit our backend database to retrieve the data. Is there a name for this kind of architecture?
View 3 Replies
View Related
Apr 27, 2013
getting a dev board for use as a mini pc. Wondering can you compile android on arm hardware or only on x86 hardware. If you can compile android on arm I will get a high end quad core dev board, if not will just go for a mid range dual core board. Thought it would be a fun project to have an auto android builder along with file and print server. Yes I know it will be slow to compile.
View 2 Replies
View Related
Aug 11, 2010
i'm currently trying to specifically target ARMv7 custom hardware and I'm facing issues when trying to install the APK. When I try doing "adb install app.apk" Logcat informs me that: W/PackageManager( 1062): Native ABI mismatch from package file And does not install the APK. With searching I was able to trace down that the problem might have something to do with the architectures not matching on the APK and the platform. Is this it? How does the PackageManager find out the architecture from the APK file? I'm guessing it's not trying to execute the binary or anything, it just checks the files meta data? If so, is there a place in the APK where this information is located? Or am I completely hitting blank here and I should look somewhere else?
View 3 Replies
View Related
Jul 23, 2010
In the same way a web or desktop app might have 3 or n tiers - UI, Business, Data for example - what is the suggested structure for an Android application? How do you group classes together, what layers do you have etc.? I'm just starting Androi dev (an internet based app that must respond to incoming notifications) and have no real feel for the structure I'm aiming at.
View 2 Replies
View Related
Jul 6, 2010
I have written a Music player app and it works great but when a flip action happens or when I return the the player view I have to stop the player and restart it at the potion that it was at when the action happened. That all works but it means a breif stop and start. How can I run the media player in a different thread and still update my seek-bar?
View 2 Replies
View Related
Apr 26, 2010
Does the Live Wallpaper run in the same process as the Launcher? I looked through the Launcher code and cannot really figure out where the wallpaper "layer" fits in. I am looking at this with the lens of memory consumption and safeguards that the Launcher has in place against a bloated Live Wallpaper.
View 2 Replies
View Related
Aug 30, 2010
I am using the default Android Media Player in an Activity, trying to play back a couple of video files. However I have a problem with programming what I want. The desired program outcome would be the following:
A video file is played back After that, a dialog is shown, asking the user something A pause of 5 seconds occurs The next video is shown and so forth. How am I to program this? Currently, I use a paradigm like the following:..................
View 1 Replies
View Related
Mar 1, 2010
I am using following code to display progress on andorid activity when i call web service method to getposts it show progress. but when call of serivce is complete my application gets crashed.
What mistake am i doing or any other alternative way to achieve this goal?
CODE:........................
View 2 Replies
View Related
Nov 24, 2010
Can anyone recommend any books or resources for learning smart phone architecture (specifically iphone or droid)? I am looking to learn and get into smart phone development, having been doing desktop development for a few years now.
View 3 Replies
View Related
Feb 25, 2009
Single Threaded OpenGL game ! (check bottom, you can download and use the helper class) Lighting disabled ! Depth Buffer disabled ! Culling enabled ! Textures disabled !
Just 176 integers (x,y values only) making 88 vertexes along with 132 index numbers making "44 triangles only"
Framerates I get is
with GL_BLENDING disabled - 145 fps approx only! enabled - 110 fps approx only!
I have the screenshot of exact code in the draw function here.. just 2 damn lines ! I have hidden only the comments.. click here to see it http://prasna991.googlepages.com/drawframe.png
variable details in the 2 lines of code =========================== ipts = 176 elements (only x and y for each vertex) totallinetriangles * 3 = 176 lineindexes = 132 elements - type "short"
Here is the screenshot of output drawing and how it will look like http://prasna991.googlepages.com/screen.png
OpenGL single threaded Initialization Helper ================================ Here is my OpenGL helper class.. makes the OpenGL initialization for newbies a cakewalk http://prasna991.googlepages.com/OpenGLHelperclass.txt
I tested by rendering on the touch event only.. frame rate drops only when u touch and drag and here I have just tested by tapping and releasing gently on the emulator and on the device
Is this the device limitations ? So graphics is actually a lot lot lot slower than on iPhone ?
View 8 Replies
View Related
Jul 24, 2010
I would like to be able to use the OpenGL API from both Java and C (via NDK).
In Java, there is a GL object passed, which has all GL methods on it.
In C, you just talk to the native library.
In a single onDrawFrame callback (for which Java is passed a GL), can I use methods on the GL object, and also call NDK methods which access the openGL library?
In other words, is the GL object just a wrapper for the same instance of the native library?
View 3 Replies
View Related
Nov 4, 2010
I've been stuck for ages now trying to implement threading or background image loading for a custom tile overlay class I've been working on. I'm pretty useless when it comes to Java so threading isn't something I've had any experience with. Basically I have extended an ItemizedOverlay and in the draw() method calculate the tiles I need to display over the standard google tiles then fetch those images with a URLConnection and using BitmapFactory decode them and draw them to the canvas at the correct position on the screen so that the images are on top of the google tiles with about 50% opacity (the custom tiles are cellphone network coverage png's which are used for our web app). I initially got this all working with the tiles loading in the correct places but hit issues with memory and "freezing" while panning so implemented some basic caching and memory management to only store the tiles that are displayed on the map in memory and when downloading a tile store it to SD card.
Then I figured the freezing while panning is due to the blocking nature of downloading the images so, have been trying to implement threading. I created a class that extends AsyncTask to download the images in the background and store them to SD, in the onPostExecute method I then try to draw all the tiles. But onPostExecute never seems to fire, now I know that the AsyncTask has to be called in the main ui thread so tried to debug the execution with Thread.currentThread().getId() calls through out the code. The thread Ids through out is 1 and then 10 for the doInBackground method for the AsyncTask. Now I'm not sure if 1 is the main UI thread or not. In the extended MapActivity class I have, the onCreate method's Thread.currentThread().getId() returns 1 but I'm not sure if the MapActivity class is executed in the main ui thread? Here Romain Guy mentions that the onPostExecute method should have @Override but when I do that eclipse flags it as an error
"The method onPostExecute(Boolean...) of type TileCache.ImageLoadTask must override or implement a supertype method"
So I guess something is wrong there but the only fix eclipse offers is to remove the @Override
So I guess with out post all my source code, the question's I have are:
Is the MapActivity onCreate method called in the main ui thread?
What does the @Override error mean? or why does it show that error
Does anyone have an example of a custom tile overlay implementation with background image loading and tile caching?
View 1 Replies
View Related
Mar 31, 2010
I am looking for a tutorial that explains the logic for fast, robust location finding.Basically I am sick of Google Maps finding my location so incredibly fast and accurately while my own application struggles to get a location.I would be fine with pseudo code responses and I will explain what I am doing so maybe I can be shown what I am doing wrong.
1. Get the locationManager object.
2. Do a 'get best provider' call.
3. Get a list of all available providers.
4. lm.requestLocationUpdates(bestProvider, 0, 0, this); hit the location provider as much as I can to get my first signal
5. Send a delayed message.If a location cannot be found in 10 seconds, switch to a different provider and try again with lm.requestLocationUpdates(nextProvider, 0, 0, this);
6. Repeat step 5 until I have a location.
7. Once a location is found determine if it is the most accurate provider.If it is not try again with the most accurate provider on an 8 second delay.If it is the most accurate provider then set lm.requestLocationUpdates(currentProvider, 30000, 0, this); to conserve battery
8. Make sure to lm.removeUpdates(this); before changing the requestLocationUpdates
Now it occurs to me that it may be possible to iterate through my list of providers and do requestLocationUpdates for all providers at once.Is this a viable option or can you only listen to one provider at a time?I have seen that location from onLocationChanged has getProvider()to let you know who provided the location information so that I can know which provider is actually finding a signal and turn off the others.
View 5 Replies
View Related
Jun 19, 2009
I have a ListView. When I click a row Item (which are just TextView instances) I want them to remain hilighted (default orange color). The default behavior is that they flash orange.
Strangely, if I use the key pad (arrow up/down) to move between items, it has the exact behavior I want. Why is the logic different between using the keypad or with finger tapping?
View 7 Replies
View Related
May 1, 2010
I am calling a PreferenceActivity from another activity and then updating the application state (ie: changing the font size) on onActivityResult, based on the preference changes. I was thinking it would be better to put the state update logic in the PreferenceActivity. That way I don't have the duplicate the logic in each activity that calls the PreferenceActivity. What's the best or correct way to do this?
View 2 Replies
View Related
Jan 7, 2010
Anyone know how to disable SMS threading on the Moment? I was able to do it via registry tom-foolery on my last phone (Palm Treo Pro), but I don't know where to start on this Android phone. I like having each SMS be its own little thing, not a string of SMS's.
View 11 Replies
View Related