_id
int64
0
49
text
stringlengths
71
4.19k
7
ANDEngine 3d rotation in Particle System Im using ANDEngine and wants to create confetti particle system. But im unable to make flipping and rotation of confetti particle around z axis Since andengine is 2d engine, it doesnot support that. However like in the following example , 3d rotation has been implemented for a single sprite http code.google.com p andengineexamples source browse src org anddev andengine examples Rotation3DExample.java I want to do this for the particles. Am i missing something ? or do i hv to modify the particle system code.
7
Overdrawn pixels vs many polygons, which affects performance the most? I know that having overdrawn pixels is not desirable as well as having many polygons since they can decrease performance. Often when I model I have an option to decrease the number of polygons by having disconnected polygons over. For example, considering this Let's imagine it has more turns that are not visible in this picture. I can decrease the number of polygons by having a pathway as a single disconnected face As a result I would have less poly count, but the bottom geometry would be overdrawn in many areas. Or I can model this as a single continuous mesh. As a result I would have more poly count, but no overdraw I very often have similar situations and I'm wondering which of these would be more performance efficient and cause less performance decrease on mobile devices?
7
android game how to approach mutliplayer I'm making a single player game that is near completion, and I am already starting to think about giving the game multiplayer. The multiplayer would basically be finding someone to play against, likely in a waiting room or just have a match making function, and then having a pokemon style battle between the people in real time. I think it would be relatively simple as I'm just sending information about each attack(move chosen and damage) and what it did back and forth, but I'm not sure what resources to consult for this. I am very new to Android Java development and really just learning as I go. I have heard a bit about Skiller, but I'm still unfamiliar with using other SDK's and how easy it may be. Does anyone have any suggestions as to what SDK's or methods for accomplishing this. I currently have no money to spend on software development, but I'd like to get started on learning how to do this.
7
Export Blender 3D animation to be played by Android OpenGLES Below code snippet shows the way to export coordinate of bones def export bone matrix(armature, bone, label, file handler) SystemMatrix Matrix.Scale( 1, 4, Vector((0, 0, 1))) Matrix.Rotation(radians(90), 4, 'X') if (bone.parent) Export babylon.write matrix4(file handler, label, (SystemMatrix armature.matrix world bone.parent.matrix).inverted() (SystemMatrix armature.matrix world bone.matrix)) else Export babylon.write matrix4(file handler, label, SystemMatrix armature.matrix world bone.matrix) I have create a 3D character in Blender, and add keyframes in it by transforming in some frames. From the graph editor, you can easily tell the all displacement of transformation translate, rotate, scale are all measured with respect to the original value in frame 0. Is it possible to write OpenGL in Android to animate the same 3D animation in Blender? I'd like to transform the 3D character translate, rotate in each frame according to the displacement value exported from Blender. Below lists the python function to export translate, rotate displacement in each frame def get bone action location(action, bonename, frame 1) loc Vector() if action None return(loc) data path 'pose.bones " s" .location' (bonename) for fc in action.fcurves if fc.data path data path loc fc.array index fc.evaluate(frame) return(loc) def get bone action rotation(action, bonename, frame 1) rot Quaternion( (1, 0, 0, 0) ) the default quat is not 0 if action None return(rot) data path 'pose.bones " s" .rotation quaternion' (bonename) for fc in action.fcurves if fc.data path data path and frame gt 0 and frame 1 lt len(fc.keyframe points) rot fc.array index fc.evaluate(frame) return(rot) Or I need to transform the meshes with vertex group controlled by root bone by the transform matrix SystemMatrix armature.matrix world bone.matrix? And for those controlled by child bones by the matrix in terms of (SystemMatrix armature.matrix world bone.parent.matrix).inverted() (SystemMatrix armature.matrix world bone.matrix)?
7
Augmented reality on Mobile platform iOS Is there a way that we can control the iOS device camera to an extent what colors it sees, what shapes it sees ? etc I'm speaking about the ability to read information before the image is captured. Consider my question as Possibility of making an augmented reality game on iOS phones. I dont find relevant help for my query in internet iOS developer site. Hence posting here.
7
android game change background image at every level? I want to be able to have a different background image at each level of my game. Presently I have only one. There is no layout folder shown in Android Studio and all info I have searched shows how to do it with the layout xml. I have found this code in GameLayer.java of my game. Actually I am reskinning the game so everything is already there, I just need to know how to have different bg images now. Code background CCSprite bg new CCSprite("game game bg.png") bg.setPosition(G.displayCenter()) addChild(bg)
7
Using Unity3D from within Eclipse Is it possible to use Unity3D from within Eclipse? I've seen that I can import a Unity3D project into Eclipse, but I cannot seem to be able to access classes such as Terrain or Ray. I don't know if that's because I haven't imported the correct libraries or if that's a limitation and that data can only be accessed by methods within Unity3D. I am designing an Android game within Eclipse and would prefer to use Eclipse than Unity3D, even if that means my game will only be available for Android. The only real reason I'm using Unity3d is for use of the 3D terrain and to hopefully help in getting the data, such as slope, terrain type, collisions, etc.
7
Make a callback to android methods from libgdx How can I make a callback from libgdx to an Android method? I want to use the method to overwrite a file in the internal memory.
7
Monetizing an Android library? I'm developing a library ( i.e. a JAR file that you put into the libs folder in eclipse ) which would extend surfaceView, which other people would hopefully use to make games. I guess the best way to make any money off it would be to show banners on that surfaceview, right? Maybe someone had similar experience? What advertising company would you suggest? admob, leadbolt? would they agree that I would integrate their sdk into my library ( not a finished app )? Thanks!
7
How to move a sprite automatically using a physicsHandler in Andengine? I use a DigitalOnScreenControl (knob with a four directional arrow control) to move the entity and the entity which is bound to a physicsHandler. physicsHandler.setEntity(sprite) sprite.registerUpdateHandler(physicsHandler) From the DigitalOnScreenControl, I know which direction I want my sprite to move. Inside its overridden onControlChange function, I call a function animateSprite that checks which direction I chose. Based on the direction, I animate my sprite differently. Problem I want to automatically move the sprite to a specific location on the scene, say at coordinates (207, 305). My sprite is at (100, 305, which means it has to move down by 107 pixels. How do I tell the physicsHandler to move the sprite down by 107 pixels? My animateSprite method will take care of animating the sprite's downward motion.
7
Recommended way to handle sprite assets for different screen densities (Android) I am currently working on a 2D game for Android. All of the images that I render were created as SVG's and then exported to PNG's which I have placed in my assets directory. These images are also all sprites that I render using a sprite batcher. My question is around using different versions of the sprites for devices with different densities. I know that when developing a traditional android app you could place separate directories for separate density levels inside of res and then place the correctly sized versions of the images in question in these sub directories of res. What is a good approach when dealing with sprite images in the asset directory? Should I just have one copy of the sprites at a really high density resolution that I use for everything and I just render them on a coordinate system that is independent of screen size or should I resize the image based on screen density before I process it to create all my texture regions? Or is there another solution entirely? Currently I have one high resolution set of sprites that I use for everything, it just seems wasteful and inefficient for the lower density devices.
7
Drawing game app How to use vector graphics instead of bitmap in Android? I have a problem concerning the concept of using vector graphics instead of bitmaps in order to draw on canvas. Usually to draw on canvas we set a bitmap to that canvas and we start drawing pixels on it by simply moving our finger on the screen. However, this method will result very pixelated relatively low quality drawings. It is noteworthy that there are some drawing apps that result in very smooth curves when you want to draw via them. After doing some googling and researching, I knew that there is the new concept of use vector graphics that is being used in order to draw smooth edged drawings on the screen. Look guys, the thing is when I developed my drawing app, I used bitmap (which was already there as an object given by Android) in order to draw cubic Bezier curves. No matter how much I tried to smooth my drawings out, I always get stair like edges. If you are interested in how I developed the curve, please read this. If not, just ignore this bold paragraph In order to draw the cubic bezier curves I simply took the sampled touch points and for every 4 points in these sampled points I calculated the 2 intermediate control points (the ones that the curve never touch) to create a bezier through the sampled points. For the curve to appear, I used bitmap and paint objects given by android. After getting the undesired result (low quality curve), I decided that I want to use vector graphics in order to do the same thing but with a higher quality. The thing is that I am very new to Vector Graphics, that I don't know where to start. My question is simple as is Is there a platform given to me by Android in order to use vector drawable like in the case of bitmap? If not, am I supposed to start this from scratch? I am clueless and any tip or hint from you will be greatly appreciated.
7
How do I access device camera in GameMaker Studio 1.4? I've looked everywhere in the documentation for GameMaker and I didn't find anything about how to access the camera.
7
Multiplayer game sdk for ios and android I am working on a multiplayer game supporting Android and IOS. For IOS Game Center seems promising. But its IOS only. OpenFeint could be a option, but now GREE has stopped supporting it. Is there any other multi platform SDK which I can use for both IOS and Android? EDIT I could not find any good service which provides their own server and SDK for both IOS and android. So finally I chose to go with my own server on AWS EC2 python tornado Websocket. If anyone want to know more plz contact...
7
How do I use TextureRegion? I can't understand how to use texture region. I have a png file which has images (sprite sheet) and I must "extract" every image I want. From here it just says TextureRegion(texture, 20, 20, 50, 50) Where 20, 20, 50, 50 describes the portion of the texture, How can I find which portion has the image I want to extract? Should I open the png file with Gimp for example? And then I am search for some coordinates? And if yes, how?
7
Android LibGDX 1.9.6 Augmented Reality captured images are black Using LibGDX for an AR application and capturing image and merging lines and texts on LibGDX with image with this code. private Pixmap merge2Pixmaps(Pixmap mainPixmap, Pixmap overlayedPixmap) merge to data and Gdx screen shot but fix Aspect Ratio issues between the screen and the camera Pixmap.setFilter(Filter.BiLinear) float mainPixmapAR (float) mainPixmap.getWidth() mainPixmap.getHeight() float overlayedPixmapAR (float) overlayedPixmap.getWidth() overlayedPixmap.getHeight() if (overlayedPixmapAR lt mainPixmapAR) int overlayNewWidth (int) (((float) mainPixmap.getHeight() overlayedPixmap.getHeight()) overlayedPixmap.getWidth()) int overlayStartX (mainPixmap.getWidth() overlayNewWidth) 2 Overlaying pixmaps mainPixmap.drawPixmap(overlayedPixmap, 0, 0, overlayedPixmap.getWidth(), overlayedPixmap.getHeight(), overlayStartX, 0, overlayNewWidth, mainPixmap.getHeight()) else int overlayNewHeight (int) (((float) mainPixmap.getWidth() overlayedPixmap.getWidth()) overlayedPixmap.getHeight()) int overlayStartY (mainPixmap.getHeight() overlayNewHeight) 2 Overlaying pixmaps mainPixmap.drawPixmap(overlayedPixmap, 0, 0, overlayedPixmap.getWidth(), overlayedPixmap.getHeight(), 0, overlayStartY, mainPixmap.getWidth(), overlayNewHeight) return mainPixmap In 1.9.6 Pixmap.setFilter(Filter.BiLinear) is not available and it does not merge 2 pixmaps correctly. I tried setting BiLinear filter for both pixmaps or one at a time but none works.
7
Graphical Android game Bad performance in some situations I am developing a simple graphical game for Android (Java and OpenGL ES). There is no high end graphics involved, basically a few (less than 10) sprites and some (about 10) dynamically drawn primitives. The performance of the game is quite fine, I get about 50 60 FPS on my HTC Desire. However, there is one specific performance issue. In my game I can fire a characters' gun, which then fires a laser beam that moves over the screen following its velocity vector. This beam is dynmically drawn. The thing is when I fire the gut the first time, the laser beam is moving very unsteady (its "hopping" over the screen). But, after this first time, when I then fire the gun for how often I like, the laser beam is moving very smooth over the screen. I first thought this might be an issue with Android's garbage collector. But I double checked my code. Not one single new object is created within the main game loop, I solely use pre created objects (i.e. class instances). I also doubt the problem is related to the dynamic drawing of my primitives (laser beam), because as said its working fine and very smooth for every gun shot after the first one. It is solely this first shot where I encounter this performance issue. So my question is, does this behaviour sound familiar to anyone of you guys? I would appreciate any idea very much.
7
Box2DLights in libGDX Bad quality of the light gradient on Android I am facing a problem while porting one of my libGDX project from desktop to Android My game uses Box2DLights. While the light effect look very fancy on the desktop version of the game, it looks really ugly on the Android version. The light gradient is not smooth at all. Take a look at the comparative screenshot below To use Box2DLights in my game, I use this code in my GameScreen rayHandler new RayHandler(world) rayHandler.resizeFBO(Gdx.graphics.getWidth() 5, Gdx.graphics.getHeight() 5) rayHandler.setBlur(true) RayHandler.useDiffuseLight(true) rayHandler.setAmbientLight(new Color(0.15f, 0.15f, 0.15f, 0.1f)) Of course, I tried to play with different parameters, such as RayHandler.useDiffuseLight(fasle) Or rayHandler.diffuseBlendFunc.set(GL20.GL DST COLOR, GL20.GL SRC COLOR) Or rayHandler.shadowBlendFunc.set(GL20.GL DST COLOR, GL20.GL SRC COLOR) Everything I tried so fare gave the same ugly light gradient. I already played games that uses Box2DLights that rendered very well on my tablet, thus, I don't think it's due to a limitation of Android. Does anybody know what's the trick to overcome this problem ? Thanks !
7
Receive UDP packet in android I'm sending UDP packet to android over a wireless network from some other software . how can I receive that in android ? should I write a client in android to get the data?
7
Adobe Air Mobile AS3 app challenges and how to overcome them? I made a PC flash game for LD 26 minimalism and I am working on porting it to Android. Some questions I'd like to ask Is it bad to heavily use vector graphics (ie. this.graphics.lineTo()) in Mobile Air? Does Stencyl completely alleviate this issue? Are there any inherit disadvantages to using Air Mobile that I'm missing? Where is the documentation for Air mobile (I googled and found no recent books or documentation pdf so far)
7
LibGDX strange status bar in background BUG I released an app and I noticed that some devices has a strange "bug" which I don't know if it's caused by Android, me or LibGDX. That bug is related to status bar, normally app let you see the bar (time, battery percentage ...). In my app the statusbar shouldn't be showed but it seems to exist in some devices. What is strange is that the bar isn't the same of the device but a general bar with random time and battery percentage. Sometimes the bar showed is an older Android version.
7
How can I delete an enemy's bitmap from a canvas? I'm learning to create an Android shooter game where I'll have multiple enemies. I must control the position on the screen and be able to delete each of then (via, for example, a die() function). But I use a canvas, which is most recomended, is it possible to delete just one bitmap and not the entire canvas (by delete I mean make it vanish from the screen, not just erase its value)? If so, how? Another approach, I guess, would be using the Android image view, which can be deleted and as well as controlled and positioned, but I think that can make my game run slow if I create various objects of a class enemy is that correct?
7
Loading Bitmap by name in Android Currently, I'm loading images as follows sampleimage BitmapFactory.decodeResource(context.getResources(), R.drawable.sampleimage) This automatically chooses the correct image from the drawable hdpi, drawable mdpi or drawable ldpi folders. How can I load the bitmap using the image name as the string "sampleimage.png"?
7
What's wrong with this Open GL ES 2.0. Shader? I just can't understand this. The code works perfectly on the emulator(Which is supposed to give more problems than phones ), but when I try it on a LG E610 it doesn't compile the vertex shader. This is my log error(Which contains the shader code as well) EDITED Shader uniform mat4 u Matrix uniform int u XSpritePos uniform int u YSpritePos uniform float u XDisplacement uniform float u YDisplacement attribute vec4 a Position attribute vec2 a TextureCoordinates varying vec2 v TextureCoordinates void main() v TextureCoordinates.x (a TextureCoordinates.x u XSpritePos) u XDisplacement v TextureCoordinates.y (a TextureCoordinates.y u YSpritePos) u YDisplacement gl Position u Matrix a Position Log reports this before loading compiling shader 11 05 18 46 25.579 D memalloc(1649) dev pmem Mapped buffer base 0x51984000 size 5570560 offset 4956160 fd 46 11 05 18 46 25.629 D memalloc(1649) dev pmem Mapped buffer base 0x5218d000 size 5836800 offset 5570560 fd 49 Maybe it has something to do with that men alloc? The phone is also giving a constant error while plugged ERROR FBIOGET ESDCHECKLOOP fail, from msm7627a.gralloc Edited "InfoLog " refers to glGetShaderInfoLog, and it's returning nothing. Since I removed the log in a previous edit I will just say i'm looking for feedback on compiling shaders. Solution More questions Ok, the problem seems to be that either ints are not working(generally speaking) or that you can't mix floats with ints. That brings to me the question, why on earth glGetShaderInfoLog is returning nothing? Shouldn't it tell me something is wrong on those lines? It surely does when I misspell something. I solved by turning everything into floats, but If someone can add some light into this, It would be appreciated. Thanks.
7
WiFi Game Controller Protocol I'm wanting to use mobile devices to control a game. I'd like to use an industry standard protocol for wifi game controllers rather than roll my own, but have been unable to find any standard. Does there exist any industry standard wifi game controller protocol? Is there some unofficial protocol many implement, preferably with quality Android iPhone client implementations available?
7
Android, apply a pixelshader on a canvas Can an opengl pixelshader be applied on a Canvas? I want to render a bitmap on a canvas, then apply a pixelshader to get, for example, a blur effect. Is this possible? I don't want to simulate the blur effect by creating a new bitmap and then blur this from java code because i'd like to be able to re use the shaders in openGL apps too.
7
Android multi screen rendering Is it possible on Android to render specifically only, to the connected Monitor TV on the hdmi port? If so, is it possible to use OpenGL ES to render a different scene on the monitor and on the device's screen? I would like the tablet to become more of an input device when it is connected with a monitor tv and my game to be rendered just to this screen. If nothing is connected, then the device's screen should be used. Ideally I would render a small interface (with buttons and text only) on the android tablet and the game itself on the monitor. Can this be done? How?
7
Libgdx Scene2D second screen animating and accept input while still loading I'm currently developing an app Scene2D that involves a small number of screen switches. I am having a problem that after calling set screen there appears to be a pause of a second or two (I think it's the non UI logic is being performed in the new screen constructor to aid setting up UI actors), which is fine. But during that second pause. It appears my second screen is already running in the background but not being rendered. I think this is happening because of two problems Animations and Actions that are supposed to begin when the second screen loads are already one or two seconds in progress by the time the second screen loads. During the pause before the second screen loads, the first screen is still rendered in freeze frame, but any user input is queued and processed in the second screen after it renders! Meaning that the user is effectively clicking on things that are not yet rendered which can cause some problems for their experience. I already am setting the input processor in the show method but it show appears to be called before the screen is actually visible and rendering frames. Is there something I have misunderstood about the life cycle? Or common pitfalls I may have fallen into? Only a problem on Android, Desktop is fine but possibly only because the loading times are too fast to notice either problem.
7
Using LibGDX within Android Fragment I want to use LibGDX with Android, but instead of modifying my Activity to extend AndroidApplication I want my to render my graphics inside Android Fragment The problem is that my class already extends Fragment, so I can't make it extend LibGDX AndroidApplication (Multiple Inheritance) is there any workaround for this ? Thanks
7
How do I create a scrollableparallax background in AndEngine GLES1 In my game I want my background to move side by side as the player moves on screen in AndEngine. I moved my sprite using analogScreenControl. I am using AndEngine GLES1. i don't want to move my background automatically but i want to move the background as per player moves on the screen with the help of analogScreenControl.
7
Detect android device rotation I am developing a game in android and I want to be able to use device rotation for moving. So, I am not sure what sensors should I use. I tried gyroscope, it will do, but there are not a lot of devices that supports gyroscope sensors. So, I want to use rotation around x,y,z axis not change like landscape portrait mode. What sensors would be the best? I already tried to google it but I couldn't find anything.
7
How do I draw a scrolling background? How can I draw background tile in my 2D side scrolling game? Is that loop logical for OpenGL es? My tile 2400x480. Also I want to use parallax scrolling for my game. batcher.beginBatch(Assets.background) for(int i 0 i lt 100 i ) batcher.drawSprite(0 2400 i, 240, 2400, 480, Assets.backgroundRegion) batcher.endBatch() UPDATE And thats my onDrawFrame.I'm sending deltaTime for fps control. public void onDrawFrame(GL10 gl) GLGameState state null synchronized(stateChanged) state this.state if(state GLGameState.Running) float deltaTime (System.nanoTime() startTime) 1000000000.0f startTime System.nanoTime() screen.update(deltaTime) screen.present(deltaTime) if(state GLGameState.Paused) screen.pause() synchronized(stateChanged) this.state GLGameState.Idle stateChanged.notifyAll() if(state GLGameState.Finished) screen.pause() screen.dispose() synchronized(stateChanged) this.state GLGameState.Idle stateChanged.notifyAll()
7
Centering GLViewport position within physical screen I'm developing my app on one device and want it to display at the same ratio on all other devices. Currently what I have is 'image 1' in my image below the game fits perfectly onto my development device's screen. If I keep the viewport at the same ratio then I get the results seen in 'image 2'. This is great, but now I need to center the viewport , and I'm not sure how to do that. What I'm aiming for is what is in 'image 3' just not sure how to get there. This is how I'm keeping the viewport at the same ratio the ratio is width height (this is 1.702127659574468 and we will use this explicitly) Set viewport size based on screen dimensions GLES20.glViewport(XVal, YVal, (int) (height 1.702127659574468), height) At the moment, XVal and YVal are both 0 I need to change XVal to move the image along. How do I work out the amount to move the viewport along by? (I know it will be equal to half of the space to the right of the viewport ('image 2') just not sure how to work this out.......)
7
How do I implement a subclass of CCSprite? Can someone tell me how to subclass CCSprite on Android? I've added this snippet of code into my CharacterSprite public static CharacterSprite sprite(String fileName) return new (CharacterSprite)CCSprite( CCTextureCache.sharedTextureCache().getTexture(fileName) ) But getTexture() can't be found. Can someone help me please?
7
Making use of the Android GPU debugging tools I tried following the manual to install the Android GPU debugging tools for android Studio 2.0. Unfortunately it has not been very successful. I have been following the instructions of the official documentation which are still for version 1 of the gpu debugging tools here http tools.android.com tech docs gpu profiler It also isn't that helpful otherwise. I am using an arm based emulator for testing since the abi specific folders specified in the manual are for arm abi's only. Also the red button above the gpu monitor that is used to start the debugging tools is grayed out for me and it tells me that the gpu debugging tools are not installed when I hover over it. Are there any extra steps I need to follow to get it to work?
7
Most common resolution used in Android phones as of 2013 Before making an Android app, I want to know what screen resolutions I should target. I know there are resolutions of 1280x800, 1280x720 and 800x480, but I would like to know which are most common. Are there any recent stats on the distribution of Android devices' screen resolutions?
7
Should I be using Lua for game logic on mobile devices? As above really, I'm writing an android based game in my spare time (android because it's free and I've no real aspirations to do anything commercial). The game logic comes from a very typical component based model whereby entities exist and have components attached to them and messages are sent to and fro in order to make things happen. Obviously the layer for actually performing that is thin, and if I were to write an iPhone version of this app, I'd have to re write the renderer and core driver (of this component based system) in Objective C. The entities are just flat files determining the names of the components to be added, and the components themselves are simple, single purpose objects containing the logic for the entity. Now, if I write all the logic for those components in Java, then I'd have to re write them on Objective C if I decided to do an iPhone port. As the bulk of the application logic is contained within these components, they would, in an ideal world, be written in some platform agnostic language script DSL which could then just be loaded into the app on whatever platform. I've been led to believe however that this is not an ideal world though, and that Lua performance etc on mobile devices still isn't up to scratch, that the overhead is too much and that I'd run into troubles later if I went down that route? Is this actually the case? Obviously this is just a hypothetical question, I'm happy writing them all in Java as it's simple and easy get things off the ground, but say I actually enjoy making this game (unlikely, given how much I'm currently disliking having to deal with all those different mobile devices) and I wanted to make a commercially viable game would I use Lua or would I just take the hit when it came to porting and just re write all the code?
7
Ranking system in an Android Open Source project This is my first question in any stackexchange board, but I've been reading Stack Overflow answers for a few months. I hope this question is appropriate for this one. I am developing a simple Android game using Java and libgdx. I want to make a typical ranking, a player who completes a level is awarded some points, and his score is compared with other players who sent theirs. This is all ok (well I still need to find a way to store players' scores). On the other hand, I may want my project to be released as an open source project, so others can look at its code freely. My question is, if anybody can get this code, modify it in order to get some advantatge, compile this game, and load it onto an Android device, how can I stop him her from sending his her score? It would by unfair to let them send highscores with a different game.
7
How do I run an APK in a device from the Unity IDE without rebuilding the binary? I know that the button Build creates the APK in my disk. And the button Build and Run creates it and sends it to a real device if connected via USB. Question Is there any way to "Run" from the Unity IDE an APK in a physical device without having to re build it (provided you properly built it a few minutes ago, for example?)
7
Rotating each quad in a batch separately? Background In my app I use the following code to rotate my quad Code Rotate the quad Matrix.setIdentityM(mRotationMatrix, 0) Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f) Matrix.rotateM(mRotationMatrix, 0, angle, 0, 0, 0.1f) Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f) And then apply the matrices Combine the rotation matrix with the projection and camera view Matrix.multiplyMM(mvpMatrix2, 0, mvpMatrix, 0, mRotationMatrix, 0) get handle to shape's transformation matrix mMVPMatrixHandle GLES20.glGetUniformLocation(iProgId, "uMVPMatrix") Apply the projection and view transformation GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mvpMatrix2, 0) The above code works great when I'm drawing single quads. Problem However, if I have a few quads with the same texture to draw, I batch them up and draw them with one call to glDrawArrays. I can't work out if it is possible to rotate each individual quad before drawing them (or how to do it if it is possible) I realise, they will all be rotated the same amount at the same time but this isn't an issue). Rotation method public void rotateBatchQuads(int coordinates, int angle) for (x 0 x lt coordinates.length x 2) Center of quad (Along the x) float centreX coordinates x quadWidth 2 Pseudo code float centreY coordinates x 1 quadHeight 2 Pseudo code Center of quad (Along the y) Rotate the quad Matrix.setIdentityM(mRotationMatrix, 0) Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f) Matrix.rotateM(mRotationMatrix, 0, angle, 0, 0, 0.1f) Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f)
7
Connect Micromax A100 with Eclipse I want to know that I can connect micromax a100 with the eclipse for android development or not. From other community I found that for development purpose micromax device can not be used. Also I doesn't found any usb driver for that. So please help to come out that.
7
Upgrades in game with leaderboards? I am working on an endless mobile game right now and I'm currently in the designing phase. Most (or all) mobile games especially endless ones now have leaderboards and a player's position in the board is determined by their score. I want to implement a store from which people buy upgrades, new cool stuff that help them gain more score. Will this cause an unfair leaderboards. Should I remove the upgrades and replace them with only customizations in the store like clothes that don't affect the score? Thanks in advance.
7
How do I find an optimal FPS for best user experience while preserving battery life? I'm developing an Android game. The "graphics" I'm using need little CPU GPU, so they run with high FPS. Because saving energy is important on Android devices, I want to limit frame rate (if deltaTime lt limitDeltaTime gt Thread.sleep(...) ). How high should the frame rate be to get an optimal balance between saving resources and a "fluid" gameplay experience. At which point is the user experience optimal or no longer improving?
7
How to move a Entity without moving its children in AndEngine? I have a Entity in AndEngine and when I move it, all child move together with it. Which is great. But, sometimes, I need to move it without moving its children. Is it even possible? And, if it is, how can I do so?
7
Different kinds of collision detection in Android Are there any other ways to detect collision between two objects besides the bounding rectangle method and downloading another class to put into Android?
7
How do i set gravity towards a point in the centre in AndEngine with Box2D? I have a scene and i can set gravity in the PhysicsWorld like this.mPhysicsWorld new PhysicsWorld(new Vector2(0, SensorManager.GRAVITY EARTH),false) but i would like all bodies to gravitate to a point. I tried physicsWorld.setGravity(new Vector2(centerX, centerY)) but that has not worked i assume because i need to calculate the vector to the centre. But I'm not sure how to do that and where to calculate it so it changes. I would like the input (of force) to be from the touch handler of the sprite. The sprite at the moment can be moved via Override public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) this.setPosition(pSceneTouchEvent.getX() this.getWidth() 2, pSceneTouchEvent.getY() this.getHeight() 2) if (pSceneTouchEvent.isActionMove() pSceneTouchEvent.isActionDown() pSceneTouchEvent.isActionOutside()) this.setX(pSceneTouchEvent.getX() this.getWidth() 4) this.setY(pSceneTouchEvent.getY() this.getHeight() 4) return true I would like to do the calculation in there so as the sprite is dragged, the vector changes, then when it's released it should 'fall' to the centre EDIT Mass can be set as 1 unit since it's not relevant Thanks for the help.
7
Simple way to detect collision between two bitmaps on android surface view I'm looking for a standard way to detect collision between two bitmaps inside a surface view. I tried the intersect method with two rectangles, but it doesn't log. practiseA new Rect(500, 500, 500, 500) practiseB new Rect(500, 500, 500, 500) public void isIntersecting() Log.d("yeah", "hello") if (practiseA.intersect(practiseB)) Log.d("collision", "yes") So can someone tell me what I'm doing wrong or give me a different method? I saw this complicated algorithm but didn't understand what to feed it sqrt( ( ax bx ) 2 ( ay by) 2) lt aR bR What's aR and bR?
7
CopperCube game engine Android export failed I am using CopperCube 6.0.2 to develop my game. I am able to export my game to exe and webgl format, but when I try to export it to .apk format it says aapt tool .exe missing error I downloaded the sdk pakage and it now shows failed to find the android jar How can I resolve this issue?
7
How to emulate knob turning, based on x y movement? I'm doing a game where one component is that you turn a knob. I'm having trouble getting good "knob behavior". I know the current touch mouse X,Y location, and I keep track of the previous X,Y location, so I can determine if I'm going left or right and or up or down. It works, but it's crude. I suspect I have to take an average of any given direction over a period of time (say, last quarter second) to eliminate jitter because people don't move uniformly in the same movement every moment. I can't really use touchdown release because you should be able to put the touch down, then move left right up down continuously without release, and the knob would turn, just as if you had a free spinning audio control or video shuttle (say). Any thoughts in this direction on how to even it out?
7
Grayscale color mode texture not rendering in libGDX I am about to develop a game completely in shades of grey using libGDX and just for testing purposes, i created two textures in photoshop 2048 x 2048 plain white png image with RGB color mode of size 19.1KB 2048 x 2048 plain white png image with grayscale color mode of size 7.67KB ... so basically both are just plain white images to look at, but the GREY.png one takes comparatively less space than the RGB.png. While rendering the both the images one at a time, RGB image renders perfectly but the grayscale one does not render at all and the output is completely black. My code Override public void create() texture new Texture (Gdx.files.internal ("GREY.png")) ...just change to "RGB.png" to render RGB.png image.. batch new SpriteBatch () Override public void render() Gdx.gl.glClearColor (0, 1, 0, 1) Gdx.gl.glClear (GL20.GL COLOR BUFFER BIT) batch.begin () batch.draw (texture, 0, 0) batch.end () Override public void dispose() texture.dispose () This is all it...No cameras are used, just 2 lines in create() and 5 lines in render() method and 1 line in dispose() method, nothing fancy at all... Also it will be really stupid to load 19.1KB texture and render it in greyscale using shader when you can directly load same looking image of 7.67KB size. I don't understand why libGDX does not render the image with grayscale color mode, is it not supported? UPDATE grayscaled images are supported by libGDX and texture new Texture (Gdx.files.internal ("gs.png"), Pixmap.Format.LuminanceAlpha, true) solved my problem.
7
How do I handle game lag due to background apps I'm developing a game using libgdx and have noticed on several occasions that other background apps running can cause lag in my game especially when those apps are being updated in the background. I'm talking serious lag like from 50 60 fps down to under 10 fps while the other app installs. How should I handle this very noticeable lag? Thanks!
7
Button change texture after click I need to make a button with texture. After button is pressed I want to change texture of button permanently. For example on of sound button. I tried this but it changes image only while I hold button. Thanks mSoundButton new ButtonSprite(30, 30, ResourceManager.getSoundButtonTR(), tiled texture region with image for sound on and sound off ResourceManager.getEngine().getVertexBufferObjectManager()) Override public boolean onAreaTouched(TouchEvent pTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) if(pTouchEvent.isActionDown()) SFXManager.toggleSoundEnabled() this.setCurrentTileIndex(1) return super.onAreaTouched(pTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY) mScene.registerTouchArea(mSoundButton) mScene.attachChild(mSoundButton)
7
Cocos2d x supporting multi resolution using density independent pixels Is there a way to use Density Independent pixels(dp) in cocos2d x? I am developing an Android game using Cocos2d x 3.0. The Android reference http developer.android.com guide practices screens support.html tells me not to use pixels in code but use dp when supporting multi resolution support. It also tells me to provide different images for different screen size groups and different density groups. However, cocos2d x tutorials use pixels for multi resolution support. If I were to use pixels, I think it means I need to have images for all these different resolutions 240x320, 240x400, 240x432 320x480 480x640, 480x800, 480x854 600x1024 640x960 1024x600, 1024x768 1280x768, 1280x800 1536x1152 1920x1152, 1920x1200 2048x1536 2560x1536, 2560x1600 Even if I don't support every screen resolutions, I think this requires more work than following the Android reference's best practice. Am I missing something on how supporting multi resolution works or do I indeed do need to do much more work using cocos2d x?
7
Profiling the GPU of a tablet We are working on a tablet game in Unity Pro (for the first time). Unity's profiler works great for probing the CPU, but the tablet's GPU isn't supported in the profiler, so we have no idea where the rendering bottlenecks are. Are there any other means of profiling the GPU of an android tablet? (We are working with a Samsung galaxy tab 2 10.1 ) How do other mobile devs do this? We are basically looking for any ways of getting info from the gpu as we're running the game. Benchmarking software wouldn't help we don't need benchmark scores. Cheers!
7
Android Density Independent Pixel Drawables Resource Folder I'm trying to get to grips with DIP in Android (using Eclipse). I'm writing a little game with OpenGL ES 2.0. Could I get some guidance and tips on what I'm not understanding doing right. From what I understand I need to make different sizes of the same image so that they appear correctly on different devices. This is because each device has a different aspect ratio and a 1cm by 1cm sprite on one screen might not be 1cm by cm on another screen. I read here that I need to place my sprite images in the res drawables folders. I did this, but when I try to reference the resource using mySpriteTexture new Texture(context, R.mysprite) the R class fails to find the .png. I have tried cleaning, rebuilding etc., and tried variations like R.res.mysprite. Although I don't see the point in trying R.res.drawables XXX as according to the article Android is meant to pick the correct images on running... I think it must be something to do with the XML manifest? But I have no clue. Any help would be welcome.
7
Polygon Collision Detection Android I am starting to try and figure out polygon collision detection in my Android game. I am currently doing pixel level collision detection and it just seems to be too slow (though it works). I was looking at this tool and it seems like it would be really handy to give me a set of vertices for my images. Does anyone have any ideas about how I should go about implementing this? Basically once I have a list of vertices that form a polygon, how can I detect if polygon A intersects polygon B? I can see that these vertices can be used easily with Box2D but I want to try to do this without Box2D first.
7
How do I implement tilt controls that work even when the device is not vertical? I'm using libGDX to develop an Android game. The main character can be moved freely in the 2d plane by tilting the phone. The relevant part of my current implementation looks somewhat like this Vector2 mainCharacter float speedX, speedY public void render(float delta) speedX 0.6f speedX 0.4f Gdx.input.getAccelerometerX() speedY 0.6f speedY 0.4f Gdx.input.getAccelerometerY() mainCharacter.move(speedX, speedY) This simple implementation works quite well as long as the player sits or stands upright. But there are two situations where this approach fails If the player holds his phone almost horizontally (e.g. if he lies in bed, see fig. 1). Neither the computation of speedY nor the computation of speedX works properly in that situation. Inside a moving vehicle. When the vehicle speeds up or slows down, this has a strong impact on the values returned by Gdx.input.getAccelerometerX Y. So my question is Is there anything that can be done to solve these two problems? How can I get satisfying results independent of whether the player is lying, standing or sitting? And is there a reasonable way to reduce the influence that the movement of a vehicle has on the output of the accelerometer? fig. 1
7
Is a separate thread for game loop compulsory for simple games? I am new to game development. In order to learn I am recreating this game on android platform. You can observe the game play video at the above link. It is a simple game. I have read a lot of articles on getting started with game development.Almost all of them recommended using a game loop on separate thread, which makes sense for other games. However, for this particular game do I need to start a separate thread ?
7
"Non additive" alpha blending in OpenGL ES 2.0, Android (AndEngine) I have several monochromatic sprites and I render them with alpha 0.25 (all of them the same value). I want to "paint" with them, so when they overlap, the alpha won't be added. I am not sure if I can express myself properly in English here is an image of what I want to achieve (background visibility is important). Is this achievable in OpenGL ES 2.0? I was trying to figure out the different modes of alpha blending, but without success. Also if anyone can tell me, how is this called, I can continue my search. If this is not possible, I was thinking maybe I can somehow render the monochromatic sprites (alpha 1) to a texture and only then render this texture on screen. How can this be done in AndEngine?
7
How do I change windows commands to android commands? I created a game and would like to test it on android, but it does not respond to any touch on the screen, I think it's because I have to adapt the game code for android. Click Touch I developed it and tested it with the selected target (windows) I was able to put it to run on an android virtual machine, but it does not respond to any commands How could he do that? How to adapt the function if (point in rectangle(window mouse get x(),window mouse get y(),60,250,104,313)) amp amp config false for example? For something that works for android. I hope I have been clear. What I want exactly is to turn all game mouse clicks into screen touches. Sorry for any translation error and thank you already
7
Upgrades in game with leaderboards? I am working on an endless mobile game right now and I'm currently in the designing phase. Most (or all) mobile games especially endless ones now have leaderboards and a player's position in the board is determined by their score. I want to implement a store from which people buy upgrades, new cool stuff that help them gain more score. Will this cause an unfair leaderboards. Should I remove the upgrades and replace them with only customizations in the store like clothes that don't affect the score? Thanks in advance.
7
How do I handle user input with good class structure architecture for an Android game? How do I handle user input having quot good quot class structure and following normal game architecture ?(see below). At first I didn't think this question was Android specific, although, after seeing a great response in C I would appreciate some insight on this question using Android architecture. Current way I handle input for my Android Game Created controller class that takes X,Y screen events and X,Y character position and returns an int that represents a direction the character should move. Call the controller method in the game's update. Send that direction value to my character update. Character's update calls move (which is also passed this value). Basic switch statement determines the direction my character moves. Getters and setters for the position of the character.(should I have them for this direction also) Is there a better way of handling input? This doesn't feel like the best way. Where does input fit in with class structure and game architecture? I'm going to accept the C answer but I would really like to see a Java answer for Android in the future. D
7
How do I correctly destroy a MobFox ad? Is anyone here using MobFox to display their Android app's ads? I was previously using the AdMob SDK but recently switched to MobFox and while it only took a short time to integrate it, there are a few outstanding issues which I can't work out. With the AdMob SDK, in my onDestroy method, I would have this line adView.destroy() However, I've looked through MobFox but I can't see an equivalent, am I missing something?! (there is all the usual pause() , resume methods etc..... just can't find a destroy() method)
7
Why does my game display the wrong "required Android version" on Google Play? I'm porting a Unity game to Android, and I've set up the "Minimum API Level" in the Player settings to "2.3.3 (API level 10)". However, on the store, it says "Requires Android 1.6 and up". On the Google Developer Console I didn't find this setting, so I guess the store is just trying to "guess" it examining the application, and failing. Did I miss something?
7
Box2DLights in libGDX Bad quality of the light gradient on Android I am facing a problem while porting one of my libGDX project from desktop to Android My game uses Box2DLights. While the light effect look very fancy on the desktop version of the game, it looks really ugly on the Android version. The light gradient is not smooth at all. Take a look at the comparative screenshot below To use Box2DLights in my game, I use this code in my GameScreen rayHandler new RayHandler(world) rayHandler.resizeFBO(Gdx.graphics.getWidth() 5, Gdx.graphics.getHeight() 5) rayHandler.setBlur(true) RayHandler.useDiffuseLight(true) rayHandler.setAmbientLight(new Color(0.15f, 0.15f, 0.15f, 0.1f)) Of course, I tried to play with different parameters, such as RayHandler.useDiffuseLight(fasle) Or rayHandler.diffuseBlendFunc.set(GL20.GL DST COLOR, GL20.GL SRC COLOR) Or rayHandler.shadowBlendFunc.set(GL20.GL DST COLOR, GL20.GL SRC COLOR) Everything I tried so fare gave the same ugly light gradient. I already played games that uses Box2DLights that rendered very well on my tablet, thus, I don't think it's due to a limitation of Android. Does anybody know what's the trick to overcome this problem ? Thanks !
7
How can you check your users' unlocked achievements (Google Play Game Services)? Is it possible to see how many of your users have unlocked certain achievements on the Google Play Developer console? This information would be very useful. I guess that one could achieve this through integration with Google Analytics but I was wondering if there was a simpler way to get this data.
7
LibGDX Android Textures reload other textures, and transparent images get black backgrounds Pictures I have very strange problems with my LibGDX Game in Android The problem is that sometimes the textures get black backgrounds when they should be transparent, and sometimes when I remove the texture, or press the back button, the textures get replaced with other textures that I have. To clarify I'm using x texture to show the status of health. I'm using three x textures to show how many lives the player got, and when I lose health, and remove one texture, the x texture get replaced with y or z texture, or the remaining x textures get black backgrounds. Sometimes it works flawlessly, and the x texture gets removed, and the backgrounds are still transparent. I'm loading my textures via an AssetManager, and just load them on create(). In my render I use this Gdx.gl.glClearColor(1, 1, 1, 1) Gdx.gl.glClear(GL20.GL COLOR BUFFER BIT) Gdx.gl.glBlendFunc(GL20.GL SRC ALPHA, GL20.GL ONE MINUS SRC ALPHA) batch.enableBlending() batch.begin() for (Entity life LifeEntities) life.render(batch) batch.end() I'm also using this in my Launcher Class. AndroidApplicationConfiguration cfg new AndroidApplicationConfiguration() cfg.r cfg.g cfg.b cfg.a 8 MainGame myGame new MainGame(arrayName) initialize(myGame, cfg) I do dispose the textures also. I have looked up on google and on gamedev about this problem, but all the questions are for problems when the transparent always have black background, not when it is something that happens like a bug. Any suggestions on where the problem could be? Thanks a lot, if you need more code, please let me know. Pictures of the problem
7
Separate renderng thread in Android (OpenGL ES 2.0) I'm used to mainly working with the Canvas SurfaceView API on Android and have recently been learning openGL ES 2.0 With canvas I know that surfaceView gives you the ability to start a new thread to render on, but it doesn't specifically do this for you, so I was creating a new thread and managing that thread when the app was ended paused etc.... However, from what I've read with glSurfaceView it seems that this is actually done for you automatically? Does this mean I don't actually need to manually create start and manage my own rendering thread? (I'm talking specifically about a rendering thread (which could also be used for logic updates) which is separate the main UI thread. Clarification on this matter would be greatly appreciated.
7
2D Scrollable View with Matrix of Numbers on Android I would like to implement a 2D, scrollable view which can be scrolled horizontally, vertically or even diagonally (similar to a zoomed image which can be scrolled in any direction, but has bounds). In that scroll view, I would like to have matrix of numbers. Which component(s) should I use for this purpose.
7
Sprites are rendered as black rectangles in android 4.0.x only I have some problems rendering sprites correctly on a LG optimus vu (android version 4.0) with libgdx. Basically sprites are black rectangles, while other images that i declare as Texture are correct. I've tested my game with android 4.2 4.3 and 5.0 and I have no problems... Is there some difference between 4.0 and 4.2 in graphics rendering? Maybe it's Gl10 and not Gl20?
7
Sound isn't playing in Game Maker Studio when interacting with an object I'm making a small game in Game Maker Studio. I have a piece of code that moves the player to the next room when he touches obj star this works. I have another line that tries to play sound collect when the star is touched, but the game just moves to the next room without playing the sound. This code is in the Step event My code is as follows Get the player's input key right keyboard check(vk right) key left keyboard check(vk left) key jump keyboard check pressed(vk space) React to inputs move key left key right hsp move movespeed if (vsp lt 10) vsp grav if (place meeting(x,y 1,obj wall)) vsp key jump jumpspeed Horizontal Collision if (place meeting(x hsp,y,obj wall)) while(!place meeting(x sign(hsp),y,obj wall)) x sign(hsp) hsp 0 x hsp Vertical Collision if (place meeting(x,y vsp,obj wall)) while(!place meeting(x,y sign(vsp),obj wall)) y sign(vsp) vsp 0 y vsp Sounds if (place meeting(x hsp,y,obj star)) sound play(sound collect) Next Level if (place meeting(x hsp,y,obj star)) room goto next()
7
How much memory can i safely use on android? To make my game more fluid, I try to prevent memory allocations during the game I am writing. To that end, I allocate a whopping 16MB of buffers on startup and then use those as I go along. When I check in Eclipse my game now uses 24MB in total, which does not change noticeably during the game. This all works fine on the phone I have now (android 2.3, motorola defy) but I wonder if I'm going to run into problems with this on other phones or tablets that run android 2.2 or higher (which is what I'm aiming for)?
7
Unity5 build won't run on android 2.3.3 I made a game using one of the Unity tutorials on their site and now would like to run on my phone (LG P500). But when I try to run it on the device, it says Failure to initialize Your hardware does not support this application, sorry! What can I do in this case?
7
How to solve ArrayList outOfBoundsExeption? I'm getting 09 02 17 15 39.140 E AndroidRuntime(533) java.lang.IndexOutOfBoundsException Invalid index 1, size is 1 09 02 17 15 39.140 E AndroidRuntime(533) at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java 251) when I'm killing enemies using this method private void checkCollision() Rect h1 happy.getBounds() for (int i 0 i lt enemies.size() i ) for (int j 0 j lt bullets.size() j ) Rect b1 bullets.get(j).getBounds() Rect e1 enemies.get(i).getBounds() if (b1.intersect(e1)) enemies.get(i).damageHP(5) bullets.remove(j) Log.d("TAG", "HERE LOLTHEYTOUCHED") if (h1.intersect(e1)) happy.damageHP(5) if(enemies.get(i).getHP() lt 0) enemies.remove(i) if(happy.getHP() lt 0) end screen !!!!!!! using this ArrayList private ArrayList lt Enemy gt enemies new ArrayList lt Enemy gt () and adding to array like this public void createEnemies() Bitmap bmp BitmapFactory.decodeResource(getResources(), R.drawable.female) if (enemyCounter lt 24) enemies.add(new Enemy(bmp, this, controls)) enemyCounter I don't really understand what the problem is, I've been looking around for a while but can't really find anything that helps me. If you know or if you can link me someplace where they have a solution for a similar problem I'll be a very happy camper!
7
What should I keep in mind when making 2D games for multiple resolutions? I'm making a 2D (Android) game. Android devices vary quite a lot in screen resolution what do I need to keep in mind when making my game? Do I need to keep big versions of all images and scale down depending on the resolution (doesn't that waste space)? Do bitmap fonts scale well or do I need to use something else? Anything else I'm forgetting?
7
How can I check if someone bought a non consumable product on iOS Android? In my application are 10 free levels, everyone can play them without doing in app purchases. But if you want more levels, then you need to buy once a non consumable product in the application. After you purchased it, you will have access to all levels that are currently available and to all levels that will be released during the next weeks. But how can I know if someone bought the non consumable product? Is it necessary to send at every reboot of the application a request to the Apple App Store to check if the current Apple ID has bought the product?
7
Libgdx gesture dection I have made a card game, and have two methods that sort the players hand. sortHandBySuit() sortHandByValue() I would like one method to be called when the user slides their finger from left to right across the screen, and the other from right to left. public class InputHandler implements InputProcessor ............. public boolean touchDragged(int screenX, int screenY, int pointer) world.getHand().sortHandBySuit() return false ............. How can I use touchDragged to call my methods?
7
How remove banner adView from a Screen in libgdx? I have an AdMob banner in the game. But I need this banner not to be shown in Screen 1 and when user enter Screen 2 I need to show the banner. When I call AdView.gone() it dissapears from screen but coordinates becomes wrong and touch position doesn't match with coordinates. How can I properly remove AdView.
7
LibGDX Swipe Detection Left and Right I have displayed an image at the center of the screen with libgdx. If I swipe left, the image should move to the left and, if I swipe right, image should move to the right. Subsequent swipes to the left should move the image left. The same should happen for right. I used GestureListener. It works to some extent in the sense if I swipe left first image moves left. But after that if I try to swipe right the image still moves left. So how do I implement the expected behavior? class MyGestureListener implements GestureListener Override public boolean fling(float velocityX, float velocityY, int button) if (velocityX gt 0) iX 20 else iX 20 System.out.println("iX " iX) return true ... Gdx.input.setInputProcessor(new GestureDetector(0.0f, 0.0f, 0.0f, 5f, new MyGestureListener())) ... batch.draw(splashTexture, iX, iY)
7
Detecting image curve to move a truck on this surface I have an image background in surface view I want to move something according to black surface.But i can not do this using height of this image as it return same height.and one more thing bitmap.getPixel is also not working.and my background is moving.So what is the way to achieve this feat
7
Android OpenGL ES2 How do I set fragment shader value using C This should be easy So I am using the following to create a fragment shader. GLbyte fShaderStr "precision mediump float " "void main() n" " n" " gl FragColor vec4(1.0, 0.0, 0.0, 1.0) n" " n" I then render a circle (collection of lines) the circle comes our red. If I change the code to... GLbyte fShaderStr "precision mediump float " "void main() n" " n" " gl FragColor vec4(1.0, 0.0, 1.0, 1.0) n" " n" The circle is now purple. My question is how do I control this dynamically? So for example when I receive an input I toggle the two colors? I tried... GLbyte vShaderStr "attribute vec4 vPosition n" "attribute vec4 inColor n" "uniform mat4 Projection n" "varying vec4 fragColor n" "void main() n" " n" " gl Position Projection vPosition n" " fragColor inColor n" " n" GLbyte fShaderStr "precision mediump float " "varying vec4 fragColor n" "void main() n" " n" " gl FragColor fragColor n" " n" void initColor() LOGD("Initing Color") GLfloat vVertices 1.0f, 0.0f, 0.0f, 1.0f glVertexAttribPointer(1, 4, GL FLOAT, GL FALSE, 0, vVertices) However, this doesn't seem to work as the circle is now black.
7
What should I keep in mind when making 2D games for multiple resolutions? I'm making a 2D (Android) game. Android devices vary quite a lot in screen resolution what do I need to keep in mind when making my game? Do I need to keep big versions of all images and scale down depending on the resolution (doesn't that waste space)? Do bitmap fonts scale well or do I need to use something else? Anything else I'm forgetting?
7
My game is not shown in Play Market New Releases I've published my app for like an 36 hours ago. It is possible to find it with exact search query ("Village Keeper") and it is available via the direct link. Thing is I can't find it in "New Releases" ("New Free Games") and I can't find it by typing something like "village game" or "keeper". So I have only 3 installs by me and my friends. Is it a bug or is a new app not guaranteed to get in "New Releases"? I tried to google it but found no answers. If so, how can indie developer get into the market with no money for an ad campaign? P. S. I tried to contact Google Support twice and 24 hours after first email passed with no reaction.
7
In Android, neat way to send input info from GLSurfaceView to onDrawFrame in GLSurfaceView.Renderer ? The input is pinch drag for camera movement, which modifies a matrix to scale translate, and sent to a vertex shader. It's working, but ugly. What's the proper way to do it? I've noticed GLSurfaceView gets onTouch callbacks but Renderer has access to GL. Shaders and textures can only be loaded after the onSurfaceCreated() callback, so should be loaded there? Touch and graphics are on different threads, so should use queueEvent() or similar. Is there a game app on github that's a good example to follow? Thanks for any help!
7
How can I convert an image from raw data in Android without any munging? I have raw image data (may be .png, .jpg, ...) and I want it converted in Android without changing its pixel depth (bpp). In particular, when I load a grayscale (8 bpp) image that I want to use as alpha (glTexImage() with GL ALPHA), it converts it to 16 bpp (presumably 5 6 5). While I do have a plan B (actually, I'm probably on plan 'E' by now, this is really becoming annoying) I would really like to discover an easy way to do this using what is readily available in the API. So far, I'm using BitmapFactory.decodeByteArray(). While I'm at it. I'm doing this from a native environment via JNI (passing the buffer in from C, and a new buffer back to C from Java). Any portable solution in C C would be preferable, but I don't want to introduce anything that might break in future versions of Android, etc.
7
Why is this animation jerky? I am trying to create a simple game on android but I am unsure the best way to do the game loop. Looking at the LunarLander sample the game loop just loops like a variable time step loop (elapsed now lastupdate). I tried using this method to draw a circle that grows in size to a max radius then shrinks to a min radius and repeats. However, when I run the program the growing stage is very choppy and slow (it takes longer than it should to get to max radius). My Code public void updateSize(double elapsed) if (mGrowing true amp amp mRadius gt mMaxRadius) mGrowing false if (mGrowing false amp amp mRadius lt mMinRadius) mGrowing true if (mGrowing true) mRadius mDRadius elapsed else mRadius mDRadius elapsed mDRadius is the number of pixel the radius should change per second and elapsed is the number of seconds that has passed. I tried putting in a sleep of 2ms and 5ms in my game loop and I get the same result. I converted my loop to a fixed time step (only run physics update if now lastupdate TIME STEP) and the animation was a lot smoother. UPDATE I change the sleep to 15ms and it's a lot smoother. Every other example I've seen of an android game does not have a sleep in the main loop. Is this because my sample is just so simple that it takes virtually no time to update and all other examples just have a longer update time or am I missing something?
7
AndEngine edit elasticity on action I'm making a game for Android with AndEngine. It's going quite well, but now I'm stuck on something. My main character has a elasticity set in its fixturedef so it bounces around throughout the game. Now i want the user to be able to not let the player bounce when he does a control. So my question how can I modify the elasticity of my character? Because I saw you can adjust the setDensity and setFriction, but I cant see the setElasticity.... Thanks in advance!
7
What is the better way of generating levels in android game using LibGDX I downloaded the source code of metagun for android from https github.com libgdx libgdx tree master demos metagun metagun android The game uses a png image to create the level. It uses the following code. I am finding it difficult to understanding. The following code is from Level.java SuppressWarnings("unchecked") public Level (GameScreen screen, int w, int h, int xo, int yo, int xSpawn, int ySpawn) this.screen screen this.xSpawn xSpawn this.ySpawn ySpawn walls new byte w h entityMap new ArrayList w h this.width w this.height h for (int y 0 y lt h y ) for (int x 0 x lt w x ) entityMap x y w new ArrayList lt Entity gt () int col (Art.level.getPixel(x xo 31, y yo 23) amp 0xffffff00) gt gt gt 8 byte wall 0 if (col 0xffffff) wall 1 else if (col 0xFF00FF) wall 2 else if (col 0xffff00) wall 3 else if (col 0xff0000) wall 4 else if (col 0xB7B7B7) wall 5 else if (col 0xFF5050) wall 6 else if (col 0xFF5051) wall 7 else if (col 0x383838) wall 8 else if (col 0xA3FFFF) wall 9 else if (col 0x83FFFF) BossPart prev new Boss(x 10 2, y 10 2) int timeOffs random.nextInt(60) ((Boss)prev).time timeOffs add(prev) for (int i 0 i lt 10 i ) BossNeck b new BossNeck(x 10 1, y 10 1, prev) b.time i 10 timeOffs prev b add(prev) else if (col 0x80FFFF) Gremlin g new Gremlin(0, x 10 10, y 10 20) g.jumpDelay random.nextInt(50) add(g) else if (col 0x81FFFF) Gremlin g new Gremlin(1, x 10 10, y 10 20) g.jumpDelay random.nextInt(50) add(g) else if (col 0x82FFFF) Jabberwocky g new Jabberwocky(x 10 10, y 10 10) g.slamTime random.nextInt(30) add(g) else if (col 0xFFADF8) add(new Hat(x 10 1, y 10 5, xo 31 x, yo 23 y)) else if ((col amp 0x00ffff) 0x00ff00 amp amp (col amp 0xff0000) gt 0) add(new Sign(x 10, y 10, col gt gt 16 amp 0xff)) else if (col 0x0000ff) if (xSpawn 0 amp amp ySpawn 0) this.xSpawn x 10 1 this.ySpawn y 10 8 else if (col 0x00FFFF) Gunner e new Gunner(x 10 2, y 10 10 6, 0, 0) e.chargeTime random.nextInt(Gunner.CHARGE DURATION 2) e.xa e.ya 0 add(e) walls x y w wall player new Player(this.xSpawn, this.ySpawn) add(player) I want some advice as to whether this is a good idea or not? This game was developed in 2010 using LibGdx. The other example I found using TiledMap is at http chrismweb.com wp content uploads 2013 03 superkoala at the offical site of libgdx.
7
Open GL ES 2.0 Android Texture,Shader, etc... loading I have gotten texture's to load along with shader's however it seems that I can only create shaders and textures in onSurfaceCreated in my implementation of the render interface. Is this truly the only place one can create shaders, textures, ...?
7
Change the scale policy of OpenGL ES in Android? I currently develop a game for Android in OpenGL ES 1.0, use libgdx library. I target the 720x480 screen size. For example, I design only one arts pack for 720x480. And what will happen in Android phones with screen size smaller or bigger than it, 480x320 for instance? Could you please tell me how to change the scale policy of OpenGL ES in Android? Or in libgdx specially? Is there anything like "Resample Image" like photoshop?(Nearest Neighbor, Bilinear, Bicubic etc..) for libgdx? Edit I found some tutorials about texture filter in OpenGL, test it with Linear and Nearest. Linear is good for scaling but slow down the game, and Nearest is on the contrary. What should I do to get a balance between those?
7
HaxeFlixel, Font gets fuzzy android upscale I made a simple game for android with a small native resolution (320x480). When text gets upscaled it loses its sharpness. Tried having anti aliasing on and off and both results were fuzzy. The size of the text is 16 (read that with some fonts the size should be dividable by 8). Also tried different fonts, but had the same result. Any solutions to that?
7
Polygon Collision Detection Android I am starting to try and figure out polygon collision detection in my Android game. I am currently doing pixel level collision detection and it just seems to be too slow (though it works). I was looking at this tool and it seems like it would be really handy to give me a set of vertices for my images. Does anyone have any ideas about how I should go about implementing this? Basically once I have a list of vertices that form a polygon, how can I detect if polygon A intersects polygon B? I can see that these vertices can be used easily with Box2D but I want to try to do this without Box2D first.
7
How are buttons made to be clicked? I just want to ask a general question. According to that answer, I'll continue thinking. You know in games there are lots of clickable items. Play button, exit, combo boxes, etc. My question is Are those buttons drawn in same canvas with background and all other things, or for every different thing there is another canvas object? My question is a general sense. I'm not asking about a specific game, I'm asking how they are made generally. I'm planning to start a game on Android, and I'm confused actually how to design buttons, and other object. Probably I'm going to use View SurfaceView for now. I don't have much experience with OpenGL yet. Thanks in advance.
7
Android how to get opengl 3D coordinates in ontouch event I created a cube in opengl and it rotates in ontouch event. To to this I created a CustomSurfaceView as follows public class CustomSurfaceView extends GLSurfaceView Override public boolean onTouchEvent(MotionEvent e) float x e.getX() float y e.getY() Here x and y are screen coordinates. How can I get 3D coordinated from this? I have already looked gluProject and NeHe. But I dont know how to implement this in my project, it shows that there is no GLdouble,GLfloat class.
7
2015 android multiplayer server based Implementation There are a lot of old posts about multiplayer implementations on SE, so i'm looking for an up to date answer. What is the best server client implementation of real time multiplayer now? I have an Amazon MYSQL Server hosted by digitalOcean, I've made a REST web service that communicates with the Server and Android app, and I have my Android app running receiving and sending data. I want to add a multiplayer minigame to what I have right now where 2 players would see the same screen and one user would receive location data (which i'm already storing in the server and sending to all devices with the app) from the other and would have an interface to interact with the data they're receiving (like building towers around the location and deploying units). The computer AI would need to be synced between both devices. The matches would last maybe 3 minutes tops and the location data would have to be streamed constantly as well as the interaction from the other user. The computer AI would be streamed to both. I've done a lot of research on the topic, and most of my experience was from a bluetooth P2P game I created in 2011 using sockets. So what are the most common implementations today? What are the most common libraries? I'm currently using Android Studio for the app and Notepad for the PHP webservice. EDIT I'm fine with answers promoting their own products, but explain how your product is better than Google's Game Services (which appears to be the best choice right now). I'm really looking for a way to implement the multiplayer with the server I'm already using.
7
2D Scrollable View with Matrix of Numbers on Android I would like to implement a 2D, scrollable view which can be scrolled horizontally, vertically or even diagonally (similar to a zoomed image which can be scrolled in any direction, but has bounds). In that scroll view, I would like to have matrix of numbers. Which component(s) should I use for this purpose.
7
Efficiently detecting objects inside multiple radius I would like to create a game for mobile that require to calculate multiple time by seconds which moving objects are in the radius of moving points. The game is highly inspired from Gratuitous Space Battles, the radius being from the weapons. Thus, I would like to know if it's realist to expect to be able to know among 1000 moving objects, in which radius they are among 1000 moving points 100 times per seconds on an average android device. In term of complexity, if there is an algorithm better than O(N M), N being the number of moving objects and M the number of radius from M moving center and if an algorithm can benefit from the fact that the moving objects are near their precedent position.
7
Phone complains that identical GLSL struct definition differs in vert frag programs When I provide the following struct definition in linked frag and vert shaders, my phone (Samsung Vibrant Android 2.2) complains that the definition differs. struct Light mediump vec3 position lowp vec4 ambient lowp vec4 diffuse lowp vec4 specular bool isDirectional mediump vec3 attenuation constant, linear, and quadratic components uniform Light u light I know the struct is identical because its included from another file. These shaders work on a linux implementation and on my Android 3.0 tablet. Both shaders declare "precision mediump float " The exact error is Uniform variable u light type precision does not match in vertex and fragment shader Am I doing anything wrong here, or is my phone's implementation broken? Any advice (other than file a bug report?)
7
In OpenGl ES 2, should I allocate multiple transformation matrices? In OpenGl ES 2, should I declare just one transformation matrix, and share it across all objects or should I declare a transformation matrix in each object that needs it? for clarification... something like this public class someclass public static float 16 transMatrix new float 16 ... public static void translate(int x, int y) do translation here public class someotherclass ... void draw(GL10 unused) someclass.translate(10,10) draw verses something like this public class obj1 public static float 16 transMatrix new float 16 ... void draw(GL10 unused) translate draw public class obj2 public static float 16 transMatrix new float 16 ... void draw(GL10 unused) translate draw
7
Sounds make Andengine Scene junky I have a GameScene which has a character (animated sprite), AutoParallaxBackground background with quite large textures and no more than 3 other items attached to the scene at a time, previous 3 items are dispose() ed accordingly, background music and item sounds. Background music is instantiated with MusicFactory, Sounds are played on SoundPool. In between switching these scene we are loading resources asynchronously, reading the streams and instantiation is done in AsyncTask and the loading textures to the hardware is done on UpdateThread GLThread. If I turn off the background music, this starts to happen totally random. I'm experiencing scene junking on at first flow MenuScene 1st Stage (GameScene). After a while lag does not happen, rather than occasionally or random. Junk is happening when aforementioned 3 items are attached on the Scene and a sound is played along, note that background music is playing at the same time. Detaching previous 3 items is "optimized" to reduce GC calling almost perfectly. When the lag occurs GC EXPLICIT is showed in the logcat. What I have tried Playing the sounds and music on different thread, IntentService, dedicated Service. Reduced calls to mScene.detachChild(child) and other scene methods to avoid iterations over children of the scene. Detaching IEntitys with matcher to avoid iteration. Inspected sound files' integrity with ffmpeg for possible errors Could .dispose(), unloading the textures from hardware or detachChild() causing this junk? Could be marked object for GC from the async tasks be causing this? What else could be contributing to this issue?