_id
int64 0
49
| text
stringlengths 71
4.19k
|
---|---|
7 | Edge Detection on Screen I have a edge collision problem with a simple game that i am developing. Its about throwing a coin across the screen. I am using the code below to detect edge collisions so i can make the coin bounce from the edges of the screen. Everything works as i want except one case. When the coin hits left edge and goes to right edge the system doesnt detect the collision. The rest cases are working perfectly, like hitting the right edge first and then the left edge. Can someone suggest a solution for it? public void onMove(float dx, float dy) coinX dx coinY dy if (coinX gt rightBorder) coinX ((rightBorder coinX) 3) rightBorder if (coinX lt leftBorder) coinX (coinX) 3 if (coinY gt bottomBorder) coinY ((bottomBorder coinY) 3) bottomBorder invalidate() |
7 | Best method for 2 layer tile based map scrolling What is the best general approach to implement scrolling for a 2D tile based game? I need to scroll the map with a constant speed, lets say 2 pixels every frame (like in a top down shooter). The tiles are 32x32 and the map is quite big, lets say 10 x 300. There are 2 layers first is the background layer second is the forgeground layer with obstacles and enemies The target plattform is android and I want to use OpenGl. What is best practice? a) Draw only the visible Screen all the time (every frame) b) Load complete map into memory and just move the camera Is there a difference in performance and determining collision etc.? Thanks for any help! |
7 | Word game board implementation? I'm working on a boggle type game for android, using libgdx. The user is presented with a 4x4 grid of letters and must find words by dragging their finger over the letters. Unlike boggle I want used letters to disappear. Remaining letters will fall down (to the bottom of the board, screen orientation is fixed) and the board is refilled from the top. Users can rotate the board to try and put hard to use letters in a better place by strategic word selection. An example d g a o u o r T h v R I d G n a If i selected the word GRIT, those letters would disappear and the remaining fall down d u g a h o r o d v n a and then get replaced by new letters d w x y u g a z h o r o d v n a I'm stuck figuring out how to represent the board and tiles. I tried representing the board as a matrix to keep track of tiles selected and valid moves and the tiles stored in a matrix as well so that there was an easy mapping. This works, but I had to write some convoluted code to rotate the board. How do other games handle this problem? EDIT So thinking about it, I should really just process my touch point according to the board rotation so cells stay constant. Attached an image of what I'm thinking. |
7 | Libgdx Hud with two stages I have an app that's currently working with a single stage but i need to add a side display section as a HUD, with scores lives etc on it, so that the HUD is on the left, and the main hand screen on the right. The main game screen will be fixed and will not move around. From researching I've found a couple of solutions. 1 two stages 2 a group with two groups to it, possibly using a horizontalgroup 3 two cameras one stage 4 one stage, one camera, but changing the position of the camera for each set of actors. I think, option 1 is my preference, but i have some questions. Do stages always fill the whole screen, or can i start then where i want? This would make it easier for the right hand screen to calculate positions based on 0,0 of that screen rather than always having to add the width of the HUD on to any calculations. Do i need to work about viewports? Currently I'm not using one (which i think means my stage is set to scaling by default) but nothing looks stretched as a result of this. I don't know much about viewports, but there always seems to be a compromise to be made with them, i.e. black bars top or sides. If I have two stages, do they each have their own camera? Do I need to with about this? Can I possibly aim the right hand camera at an offset so i can still draw things from 0,0 with that being the bottom left corner of the right stage, not the whole screen? Finally, off topic, I am a little confused about spritebatch. I'm not currently using one, because I use a stage. Is that OK, or should i still be using one in conjunction with a stage somehow? And add all my actors to that? |
7 | Multiplatform game, save game state and resume it on other platform This is for a personal and knowledge acquiring project. I want to create a little TIC TAC TOE multiplatform game, app amp web. The choosen technology for the app will be Android or Flutter and for the web Angular. My doubt is, during a game if the user wants to change from the mobile version to the web version, how to resume or change the game to the web application? What would be the best way to save the game state and load it into the other platform? Having in consideration that the user will play only in one platform at a time, which is the best way to implement this restriction too? Is this as simple and hard at the same time as implementing all controls in both platforms and storing all the data required in the database? |
7 | 2D collision detection Let's assume I'm using this character. (source iconbug.com) How would you implement collision detection for it? Using a bounding box doesn't seem to be a good approximation, because the bird's shape is nowhere near a square. I was thinking of having a sort of quad tree data structure inside the object that represents portions of the image. Each leaf could be either false (in case it covers the white transparent space outside the bird) or true (in case it represents an area of the bird i.e. beak, eye etc). Then somehow test the only obstacle in the scene for collision with the bird. But my problems in my approach are I don't know how to initialize the quad tree. Once the quad tree is initialized, I'm not sure how to traverse amp use it once the obstacle is within the coordinates of the image. How would you do collision detection with non squarish characters? LE The other approach I've seen was to use multiple bounding boxes. For example I'd have one or a few bounding boxes for the beak, then a few of them for the hair or the tail. But it can get tedious. If this is a valid approach in my case, how would I generate those bounding boxes? I doubt I'd have to have them hardcoded in my program. LE2 I care about fairly precise collisions. I can't imagine how a single bounding box or circle can at least approximate decently that shape, so this approach won't work. |
7 | On Android, why would you handle expansion files yourself instead of using Google Play? Why aren't all Android games using Google Play's ability to serve their expansion files? Why some are handling it themselves inside their apps? |
7 | How can I develop my Android game for different phone resolutions? For instance, the Motorola Droid is as wide as the G1, but has more height. Should I try to spread the UI out across the extra height found on the Motorola Droid? How do others handle this problem? I'm not using OpenGL, but a SurfaceView for a 2D game. |
7 | How to clip or mask entity in android andengine? I want to implement masking with sprite in Andengine. I want same functionality as in ios class called SKCropNode which works like an masking node! Is there any workaround like this in andengine opengl ? Thanks. Edit This is something I was trying to mask an entity, got no effect, any suggestion? public class ClippingEntity extends Entity BaseSprite protected int mWidth protected int mHeight public ClippingEntity(float pX, float pY, int pWidth, int pHeight, TextureRegion t) super(pX, pY) , pWidth, pHeight, t) mWidth pWidth mHeight pHeight Override protected void onManagedDraw(GL10 pGL, Camera pCamera) pGL.glPushMatrix() pGL.glEnable(GL10.GL SCISSOR TEST) pGL.glScissor(0 (int) mX, 800 mHeight (int) mY, mWidth, mHeight) super.onManagedDraw(pGL, pCamera) pGL.glDisable(GL10.GL SCISSOR TEST) pGL.glPopMatrix() I have also tried Stencil Test but it just clears the color of rectangle. ref opengl mask tests Ultimate goal is to disable drawing changes in specific entity where it may aslo have transparent background. |
7 | TMX crashes in Tablet 10 Android 7.0 with Andengine I've developed a video game that has worked fine so far. When testing it in a Samsung Galxy A6 tablet (10" resolution with Android 7.0), I get the following error and the map won't load Blockquote 12 09 12 49 20.940 E AndroidRuntime(9369) Process cam.main, PID 9369 12 09 12 49 20.940 E AndroidRuntime(9369) java.lang.NullPointerException Attempt to read from field 'org.anddev.andengine.opengl.texture.region.TextureRegion org.anddev.andengine.entity.layer.tiled.tmx.TMXTile.mTextureRegion' on a null object reference 12 09 12 49 20.940 E AndroidRuntime(9369) at org.anddev.andengine.entity.layer.tiled.tmx.TMXLayer.drawVertices(TMXLayer.java 220) 12 09 12 49 20.940 E AndroidRuntime(9369) at org.anddev.andengine.entity.shape.Shape.doDraw(Shape.java 102) 12 09 12 49 20.940 E AndroidRuntime(9369) at org.anddev.andengine.entity.Entity.onManagedDraw(Entity.java 991) 12 09 12 49 20.940 E AndroidRuntime(9369) at org.anddev.andengine.entity.shape.Shape.onManagedDraw(Shape.java 120) 12 09 12 49 20.940 E AndroidRuntime(9369) at org.anddev.andengine.entity.Entity.onDraw(Entity.java 875) 12 09 12 49 20.940 E AndroidRuntime(9369) at org.anddev.andengine.entity.Entity.onManagedDrawChildren(Entity.java 1008) 12 09 12 49 20.940 E AndroidRuntime(9369) at org.anddev.andengine.entity.Entity.onDrawChildren(Entity.java 1000) 12 09 12 49 20.940 E AndroidRuntime(9369) at org.anddev.andengine.entity.Entity.onManagedDraw(Entity.java 993) 12 09 12 49 20.940 E AndroidRuntime(9369) at org.anddev.andengine.entity.scene.Scene.onManagedDraw(Scene.java 233) 12 09 12 49 20.940 E AndroidRuntime(9369) at org.anddev.andengine.entity.Entity.onDraw(Entity.java 875) 12 09 12 49 20.940 E AndroidRuntime(9369) at org.anddev.andengine.engine.Engine.onDrawScene(Engine.java 517) 12 09 12 49 20.940 E AndroidRuntime(9369) at org.anddev.andengine.engine.Engine.onDrawFrame(Engine.java 509) 12 09 12 49 20.940 E AndroidRuntime(9369) at org.anddev.andengine.opengl.view.RenderSurfaceView Renderer.onDrawFrame(RenderSurfaceView.java 154) 12 09 12 49 20.940 E AndroidRuntime(9369) at org.anddev.andengine.opengl.view.GLSurfaceView GLThread.guardedRun(GLSurfaceView.java 617) 12 09 12 49 20.940 E AndroidRuntime(9369) at org.anddev.andengine.opengl.view.GLSurfaceView GLThread.run(GLSurfaceView.java 549) 12 09 12 49 21.531 E ApplicationPackageManager(4011) checkSettingsForIconTray value 0 Rest of screens that are Android native work well. Please help! |
7 | Selling Android apps from Android Market unsupported countries I am in Latvia (which the Android market doesn't support as a country for selling apps from), and I am thinking about the best way of monetizing my app. So far I've come up with these options Pretend I am from a supported country. Get a bank account there, etc. Use PayPal for in app purchases. The player gets, say, the first 10 levels for free, but is then asked to pay 0.99 for the rest of the game. Downside Players might not feel comfortable entering PayPal details into an app. Android market might not like it either. Making the app free and earning money through advertising. Let's do some calculation here Say I get 1M free downloads, each user during his playtime would see 10 banners, so 10m 1000 0.3 is about 33k if we use AdMob with their 0.3 per 1000 impressions. On the other hand, if we use PayPal and in app purchases, we need a 3 conversion rate to beat this.. What should I do? Edit From what I just read all over the net, it looks like advertisers will change their eCPM price a lot without telling you. Using in app PayPal purchases at least allow you to monitor the cash flow. |
7 | How to use the box2d contact listener in android (java port)? I don't have any idea about the box2d collision detection in android. I googled and got results that suggest to use the contact listener but I don't know how to use it in android java. |
7 | Real cash gambling app I am making a cash game like deal or no deal for use as an android app, using adobe software. The idea is player wagers 50 pence through Paypal plays the game wins, say, 10 pounds and then cash out. How do I create a cash pay and play system probably with Paypal? I have done the art work and the basic flash script, i.e. actions and movie. I will also need some sort of data feedback to prevent hacking of game, I think, and to be able to send updates and be able to remotely alter win percentages according to profits and losses. Will the user need to be connected to a server? Can someone help guide me through what the steps I need to do? |
7 | Is it possible now to make something for android in Unity3d without buying any licenses? I was just talking to a game dev who said its possible, that it involves downloading the android sdk and few other things. If this is possible can someone tell me how? Also is it possible to build a .apk file and install on your device? Is it possible to release something developed this way on the play store? |
7 | libgdx continuous movement while touch and hold (even after jump)? So, I have these buttons where I have implemented a method to handle 'touch and hold' (without polling). If the player touches and holds the walk button ..it will keep walking till the button is released. Problem is when I combine jump with it ... In the update method, if (activeTouch) translateScreenToWorldCoordinates(touchCoords.x, touchCoords.y) if (touchPoint.x lt 5) Code for walk left else if (touchPoint.x gt VIEWPORT WIDTH 5) Code for walk Right else if ((touchPoint.x gt 6 amp amp touchPoint.x lt VIEWPORT WIDTH 6) amp amp player.isGrounded() amp amp player.getState() ! Player.State.Falling) Code for Jump The touchdown and touchup events, public boolean touchDown(int screenX, int screenY, int pointer, int button) touchCoords.set(screenX, screenY) activeTouch true return false Override public boolean touchUp(int screenX, int screenY, int pointer, int button) activeTouch false return false So i can move right,left and also jump. But my problem is, while walking if I jump ... it will jump and then stop walking. How to continue walking after the jump if the player is still holding onto the walk button? |
7 | Android opengles how to use glunproject How to use glunproject in my android app? I have the following parts in my engine A projection matrix A view matrix for the camera A model matrix for each of the objects in my world. This matrix is calculated from the parent objects model matrix and the objects own model matrix. These matrices are calculated from a translation, rotation and scale matrix. (this all works fine) These matrices are then multiplied and passed to my vertex shader. Now I understand glunproject needs the model matrix and the projection matrix and can caluclate a near and far 3d coordinate depending on the camera viewport settings ( for the near and far plane) Do I need to use glunproject for each of the objects in my world and then check if the ray produced by these near and far coords intersects my object? This seems quite expensive on the cpu? What is the proper use for glunproject |
7 | What would be the simplest way to create a 2D board game for Android? I'd like to create a very simple 2D board game for Android, it would be a concept mockup so I can see how the game works out. Let's for the sake of this question that it's a clone of Othello board game with score display, clickable game pieces spots on a square grid and some animations. I have to choose from these approaches do it all myself, draw the game on Canvas I've done one game this way, and it took some time to code it. Then, that was a casual action game and the animations would be hard to implement. implement it with Android widgets I'd use RelativeLayout TableLayout the pieces will be ImageViews this way I'd get the animations for free with Android tween animations. This would be the quickest of all solutions timewise, but I might run into some problems that may be a deal breaker. use AppInventor it may do the task, but don't know anything about it, this approach would also require some time to go through the tutorials. use a proper game engine. That will take time to learn how to use it, which I view as the biggest disadvantage as I do mostly business apps, not games. And I don't know which one to choose from. I really only want to throw this together in the shortest amount of time to see how it works, so I don't want to invest a lot of time to do it in the most "correct" way that I'll do later if the concept works. |
7 | Turn based multiplayer, Google services or Parse or.. I have a turn based game on Google play already (paid with around 2000 users and free with around 50k).i am thinking of adding multiplier option to it. I am unable to progress because I don't know which path to take (given its my first multiplier game). I need your help Like any turn based app, you have the concept of players joining in, rooms, scores and ranking (linking it with fb is preferred) For my backend server, which option should I go with? Google play game services, Parse, AppWrap.. Etc or simply me use my website server and do the server code? I am leaning towards Google Game services just because the infrastructure is there and it's free. But I don't find it to provide flexibility and control (such as using nicknames, listing rooms.. Etc) I just heard about Parse so no experience Any help or recommendations? Plzzzz need your advice |
7 | Keeping Android device awake I currently program a game in which the user don't need to interact with the screen. Is there any way to keep the screen awake? |
7 | How do I store level data in Android? I'm building a game where enemies come in waves. I want to create a file where I can define data about the waves ( of enemies, spawn times, speeds, etc.). I come from a background in iOS and would normally use something like a plist. What would be the best way to do something like this in Java and Android? |
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 | Adding Libxml2 to an Android project under Cocos2D X I am having problems porting Libxml2. I like it because it works under windows like a charm with lt libxml parser.h gt . When I reference the libraries I just cannot find the right path to them, their own references are broken and I don't know how to fiddle with Android.mk What is the procedure? |
7 | Examples of Android Joystick Controls? I can't seem to find any well executed code examples for Android joystick controls. Whatever it may be, algorithms, pseudo code, actual code examples, strategies, or anything to assist with the design and implementation of Android joystick controls I can't seem to find anything decent on the net. What are some well executed examples? More specifically, Pseudo Code Current Examples Idea Design Functionality Description Controller Hints Related Directly to Android Architecture What kind of classes will I have making this? Will there be only one? How would this be implemented to the game architecture? All things I am thinking about. Cheers! UPDATE I've found this on the subject Joystick Example1, though I am still looking for different examples resources. Answered my own question with a link to the code of the above video. It's a fantastic start to Android Joystick Controls. |
7 | libgdx handling battery warning I want to pause my game when the battery warning on Android pops up. How do I do this? I have a method that pauses the game but how do I call it when the battery warning pops up? |
7 | Getting the height of Keyboard on Android Hi I need to know the height of my keyboard so I can move up some textfield I have in my app. I'm using cocos2D X but the app don't recognize the keyboardWillShow method. Thanks |
7 | Sprite sheet or multiple resources When animating for the Android platform is it a better practice to create a sprite sheet with multiple states for each sprite on a single picture or should I instead export individual images for each character state etc.? Which option gives me a smaller file size for resources and which is easier for the programmer to animate? |
7 | AABB Collision Detection Why does the simple broadphase algorithm work better? Hi I am working on barrier detection. I used this swept aabb algorithm http www.gamedev.net page resources technical game programming swept aabb collision detection and response r3084. It suggests two ways to detect collision. 1. broadphase this is a shorter algorithm which can only detect non collision 100 . 2. In order to make sure that there is a collision, the more detailed swept aabb algorithm has to be executed right after the broadphase one. Strangely the broadphase algorithm alone detects a barrier collision each and every time and the more precise one actually doesn't at all times. What I do in my code is basically the following My object moves towards the barrier with a constand speed vx direction speed delta (that's the amount it moves each frame). So positionx positionx (direction speed delta) each frame. The broadphase collision is calculated each frame by using vx and vy. Are there some rare cases where the broadphase can actually detect a collision like in this one I described? Thanks so much for your help Thanks so much |
7 | Max texture size Android which settings for 2048x2048? I want to use a texture atlas of 2048 x 2048 in my game, and I would like to warn the users with a "too low" device to not download the game. With a texture atlas of this size, what requirements should I say, on ANDROID ? This image (source https stackoverflow.com questions 10392027 recommended limit for memory management in cocos2d ) shows the requirements for IPHONE, what about for ANDROID 512Mo minimum, with a 1GHz, is a correct requirement ? Thanks for your answer |
7 | How do I render Hindi text in Libgdx? How do I render Hindi text in Libgdx using any font? For example, I want to render the word " ". Here is what I have, so far import com.badlogic.gdx.Game import com.badlogic.gdx.Gdx import com.badlogic.gdx.graphics.GL20 import com.badlogic.gdx.graphics.OrthographicCamera import com.badlogic.gdx.graphics.g2d.BitmapFont import com.badlogic.gdx.graphics.g2d.SpriteBatch import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator public class MyGdxGame extends Game SpriteBatch spriteBatch BitmapFont font OrthographicCamera camera String text, text1 private byte myBytes (byte) 0xe0, (byte) 0xa4, (byte) 0xa8, (byte) 0xe0, (byte) 0xa4, (byte) 0xbf, (byte) 0xe0, (byte) 0xa4, (byte) 0xb6, (byte) 0xe0, (byte) 0xa5, (byte) 0x89, (byte) 0xe0, (byte) 0xa4, (byte) 0xa4 private String myName new String(myBytes, Charset.forName("UTF 8")) private String hindiStr " " " INV" Override public void create() camera new OrthographicCamera() camera.setToOrtho(false, 400, 640) spriteBatch new SpriteBatch() FreeTypeFontGenerator generator new FreeTypeFontGenerator(Gdx.files.internal("font mangal.ttf")) FreeTypeFontGenerator.FreeTypeFontParameter parameter new FreeTypeFontGenerator.FreeTypeFontParameter() FreeTypeFontGenerator.DEFAULT CHARS The characters the font should contain parameter.characters hindiStr parameter.size 15 font generator.generateFont(parameter) font.setColor(1.0f, 0.0f, 0.0f, 1.0f) generator.dispose() text " " text1 " " Override public void render() Gdx.gl.glClear(GL20.GL COLOR BUFFER BIT) Gdx.gl.glClearColor(1, 1, 0, 1) spriteBatch.setProjectionMatrix(camera.combined) spriteBatch.begin() font.draw(spriteBatch, " ", 10, 30) font.draw(spriteBatch, myName, 10, 100) spriteBatch.end() Override public void resize(int width, int height) camera.setToOrtho(false, width, height) Override public void dispose() font.dispose() spriteBatch.dispose() |
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 to do sprinkle effect of water in opengl in android? I want to achieve sprinkling effect of water in android using opengl. so, do i need to achieve it with graphics? is there any other way to do it using opengl? or how can i start working on this,any links? |
7 | Keeping track of onscreen objects in opengl es on Android In a small game Im working on I was able to implement ray picking with an opensource 3d engine called min3d but I cant figure how to keep track of what object is onscreen. I will some times have upwards of 120 objects to render within my scene and the raypicking is off occasionally. What id like to do is keep track of how many screen objects are within the camera and being rendered onscreen and set a boolean value based on that to add or remove objects from my arraylist I iterate through when the screen touch is registered and the ray picking method goes off. So how can I check for which objects are onscreen and offscreen in opengl es on android. |
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 | Implementing a basic jump in libgdx I have seen the document for libgdx and managed to move the character and also to implement bounds but the document does not show how to implement jumping. I have downloaded the superjumper demo code but it is too confusing for me. Is there anyone here who can guide me? Say for example we have a spritebatch Spritebatch batch How can I implement a jump for this spritebatch when the screen is touched? |
7 | Getting the height of Keyboard on Android Hi I need to know the height of my keyboard so I can move up some textfield I have in my app. I'm using cocos2D X but the app don't recognize the keyboardWillShow method. Thanks |
7 | Scaling and new coordinates based off screen resolution I'm trying to deal with different resolutions on Android devices. Say I have a sprite at X,Y and dimensions W,H. I understand how to properly scale the width and heigh dimensions depending on the screen size, but I am not sure how to properly reposition this sprite so that it exists in the same area that it should. If I simply resize the width and heigh and keep X,Y at the same coordinates, things don't scale well. How do I properly reposition? Multiply the coordinates by the scale as well? |
7 | Viewport and Camera setting For my first game in LibGDX and Android I got a Problem I have a background picture which is 2560px 720px. The screen is 1280 720. How do I have to set the viewport and camera in order to get the following result The picture is fited in height and shows the first 1280px in width. I tried so many things and it really confused me. Gamescreen.java package com.joelbrun.jetskirider.screens import com.badlogic.gdx.Gdx import com.badlogic.gdx.Screen import com.badlogic.gdx.graphics.GL20 import com.badlogic.gdx.graphics.OrthographicCamera import com.badlogic.gdx.graphics.Texture import com.badlogic.gdx.graphics.g2d.SpriteBatch import com.badlogic.gdx.scenes.scene2d.ui.Label import com.badlogic.gdx.utils.viewport.FitViewport import com.badlogic.gdx.utils.viewport.Viewport public class Gamescreen implements Screen public Texture jetski, wave, background public SpriteBatch batch public OrthographicCamera camera public Label score public static final int GAMESCREEN WIDTH 1920 public static final int GAMESCREEN HEIGHT 720 public static final int OBSTACLE TYPES 5 Viewport viewport private Texture texture Override public void show() texture new Texture OBSTACLE TYPES for (int i 0 i lt OBSTACLE TYPES i ) texture i new Texture(Gdx.files.internal("game obstacles obstacle" Integer.toString(i 1) ".png")) background new Texture("game background.png") jetski new Texture("game jetski.png") batch new SpriteBatch() float aspectRatio (float)Gdx.graphics.getWidth() (float)Gdx.graphics.getHeight() camera new OrthographicCamera() viewport new FitViewport(GAMESCREEN WIDTH, GAMESCREEN HEIGHT) viewport.apply() camera.position.set(GAMESCREEN WIDTH 2, GAMESCREEN HEIGHT 2, 0) camera.position.set(0,0,0) Override public void render(float delta) Gdx.gl.glClearColor(0, 0, 0, 1) Gdx.gl.glClear(GL20.GL COLOR BUFFER BIT) camera.update() batch.setProjectionMatrix(camera.combined) batch.begin() batch.draw(background, 0, 0, 5119, 720) batch.draw(jetski, background.getWidth() 2, background.getHeight() 2,128,128) batch.end() Override public void resize(int width, int height) viewport.update(width, height) camera.position.set(GAMESCREEN WIDTH 2, GAMESCREEN HEIGHT 2, 0) Override public void pause() Override public void resume() Override public void hide() Override public void dispose() batch.dispose() background.dispose() jetski.dispose() wave.dispose() |
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 | Keeping everything within one Activity Overview My game is currently based on a single activity (rather than multiple activities) and I would like to keep it that way. At the moment, it goes straight into the game at level 1. I will shortly be adding an options menu and another 20 or so levels. (As well as a high score screen, help screen etc). The thing I'm not sure about is, how do I tell the app renderer what screen part of the game to render? It's an openGL ES 2.0 app so at the moment, the method I have in my mind is something like this Code Snippets int level 0 0 means menu, 1 means level 1 etc in onDrawFrame() have something like this Override public void onDrawFrame(GL10 gl) switch (level) case 0 renderMenu() break case 1 renderLevel1() break case 2............ And so on. I would also do the same with the logic updating. Is this the way to go? I'm just not sure it's very efficient but I can't really see what the alternatives are another way I was looking into was having a separate GLRenderer for each 'screen level' but this seems much more over kill. Would appreciate some guidance as to how to display the correct screen level at the right time. Edit This is the current structure of my code Activity class public class MainActivity extends Activity Various pieces of code here class MyGLSurfaceView extends GLSurfaceView Various pieces of code here Override public boolean onTouchEvent(MotionEvent event) Touch events handles here GL Renderer class onDrawFrame() render() update() |
7 | Moving texture OpenGL ES 2.0 I am trying to implement a sprite of 8 columns and 8 rows in OpenGL ES 2.0 I made appear the first imagen but I cant figure out how to translate the Texture matrix in OpenGL ES 2.0 , the equivalent of the code in OpenGL 1.0 that I am looking is gl.glMatrixMode(GL10.GL TEXTURE) gl.glLoadIdentity() gl.glPushMatrix() gl.glTranslatef(0.0f, 0.2f, 0f) gl.glPopMatrix() This are the matrix that I am using atm Store the model matrix. This matrix is used to move models from object space (where each model can be thought of being located at the center of the universe) to world space. private float mModelMatrix new float 16 Store the view matrix. This can be thought of as our camera. This matrix transforms world space to eye space it positions things relative to our eye. private float mViewMatrix new float 16 Store the projection matrix. This is used to project the scene onto a 2D viewport. private float mProjectionMatrix new float 16 Allocate storage for the final combined matrix. This will be passed into the shader program. private float mMVPMatrix new float 16 Stores a copy of the model matrix specifically for the light position. private float mLightModelMatrix new float 16 |
7 | Performance of 8 bit 16 bit games vs Android iOS games! CONTEXT I have always been intrigued by video games NES and SNES in particular. Now I am a 32 years old computer professional who has mostly done his coding in Java and C . I recently found great inclination for Android games and posting this question to much wiser community in the field for knowledge and awareness of everyone. INTRO NES brought an invasion of 8 bit games. Very sleek, very entertaining and surprisingly very compact in size few hundred Kb only. Games like Mario Contra Ninja Zelda and countless more. SNES followed the suite and brought an era of much graphically appealing games in 16 bit still the size of the games were very compact and games were very powerful. For Android, I have been doing some research for some good game engine and found that LibGDX is very powerful, open source and written for Java developers. A plus for any Android game developer. THE QUESTIONS What I am not able to understand is that how those classic game developers managed to put all those endless levels and game characters and features and goodies in just few hundred kbs! I am trying to replicate just 1 level of Mario and the size is already reaching to 300Kb, let alone adding the files code and characters sprite images! Can we implement similar principles of compact and powerful coding using Android and LibGDX? If yes, how If no, why not! Is it possible to create a game in 8bit 16bit code and then migrate it to the Android iOS platform? |
7 | How to move gameobject with touch on Android I'm trying to make a game where you control a character via touch on Android devices. The player will have two degrees of movement. When you touch the touch screen and move your finger, the game object should move to your finger's location and follow your finger as you move it. Here is an example of what I'm trying to do http www.youtube.com watch?v OoqRC8QptzM t 01m01s ( 1 02). I already know I need to use Input.touches. I've tried using Transform.translate and Vector3.Lerp, neither gave me the results I wanted. Here is some of the code I've tried using pragma strict var speed float 1 function Start () function Update () if (Input.touchCount gt 0 amp amp Input.GetTouch(0).phase TouchPhase.Moved) Get movement of the finger since last frame var touchDeltaPosition Vector2 Input.GetTouch(0).deltaPosition var touchPosition Vector3 touchPosition.Set(touchDeltaPosition.x, transform.position.y, touchDeltaPosition.y) Move object across XY plane transform.position Vector3.Lerp(transform.position, touchPosition, Time.deltaTime speed) |
7 | What organic traffic can I expect from publishing on Google Play, without other marketing? I've just published a new Android game on Google Play. It has been a bit over 48 hours. It's active in the store, and I can search for it by name to get to it. However, I've had 0 organic downloads thus far, only a couple from my friends. As far as I know, it has not been shown in the "new games" list yet, and the only store listing views in the stats are the ones from myself and friends. Is there some time by which I can expect some "organic" exposure, or will I ever? Is promoting my game by other channels the only option? I'm not asking for advice on promoting my game. I'm only asking about what organic exposure I can expect on Google Play. |
7 | What needs to be done to port a Windows Flash game to Android? My team has developed a game using Flash (with Lua embeded) that targets Windows. And we want to port that game to Android (also iOS in the future). It's acceptable to rewrite the Flash part of client. And some other team in our company recommended Unity3D to replace the Flash part. Since we have no experience in Android iOS development, we would need to learn some new tool language anyway. So we would like that learning still be useful after the porting and when we starting a new game. Any thoughts? Edits I think it is worth noticing the background of the game the project is started by a tester and developer, both without knowing much about flex and actionscript. They built the game while learning, so most of the code is hard to maintain. I and other two developers joined the project after a year or so when one has leave (and the other be our manager). The other two developers are just graduates with little experience and little knowledge of flex. I am good at the server part and the c language. Based on the fact that the code is hard to maintain (and we do need to change a lot of code to make the game easier to playe in a mobile device), and I am good at c (and learning). I still tend to do the porting with Unity, which could get better performance and possibly save time. |
7 | ETC1 Performance Problem Android I wanted to support etc1, because it shoul improve the performance and loading times, but somehow its worse than using normal png files. I'm using Mali compression tool with seperate RBG pkm texture and Alpha pkm texture. I'm using a GLSL shader to deal with the alpha problem ofc ETC1. With the shader the performance is really bad. but even without the shader, just working with the RGB pkm file (where transparency is black) the performance is equal to png. does anyone know what the problem might be? |
7 | how to use texture atlas I am trying to implement texture atlas. 1) I am using the texturepackerGUI and the result is taking 2 files , one png (whicj contains all the images and one .atlas (and not .pack). 2) Now , I want to use the above instead of every seperate image. Right now , I use for example private void loadTextures() bobTexture new Texture(Gdx.files.internal("data images bob 01.png")) blockTexture new Texture(Gdx.files.internal("data images block.png")) I want to use texture atlas , so instead of the above TextureAtlas atlas atlas new TextureAtlas(Gdx.files.internal("data images bobs")) bobs.atlas Sprite bobsprite atlas.createSprite("bob 01") Sprite blocksprite atlas.createSprite("block") Now,I must initialize TextureAtlas I think because it gives me error "Syntax error on token " ", , expected".I don't know how. 3) I put TexturePacker2 in the android project (MainActivity) ... AndroidApplicationConfiguration cfg new AndroidApplicationConfiguration() cfg.useGL20 true cfg.useAccelerometer false cfg.useCompass false cfg.useWakelock true TexturePacker2.process("my gdx game android assets images ", " my gdx game android assets data", "bobs.atlas") ... The folders inside TexturePacker are ok syntaxed? Or I must remove the "my gdx game android assets "? Thanks! |
7 | Max Row and Col for Animating Sprite in Andengine I want to animate a Sprite in Andengine , I have used the following this.mSnapdragonTextureRegion BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.mBitmapTextureAtlas, this,"arrow.png", 10, 10) As show above in code its array is 10x10 that means I have 100 images to be animated, here is the image (I had individual image and joined it online so I created image below) My issue is if I place this code and image it show black patch instead of animated image, i hv tried with 2x3, 4x2 animated sprite that is working fine . Is my issue because of 10x10 ? what is the max row and col I can place to animate a Sprite in Above Code Here is my output |
7 | Libgdx implement 2d drop shadow for transparent sprites I am a libgdx learner. For an learning application that I am developing using libgdx on android, I need to show drop shadow or glow effect when a sprite is touched. The sprites are created from a TextureAtlas and can have any irregular shape as per the transparent image in the texture. There are a ton of images so it is not possible to create a separate shadow image for each one. I have looked at some options but haven't been able to figure out how to do it. What I have tried include OpenGL ES drop shadows for 2D sprites I tried the approach of taking the texture and bluring it using the blurutils class provided by Matt Deslauriers at https github.com mattdesl lwjgl basics wiki OpenGL ES Blurs. The code I have used is below. But the performance was very slow on android devices for the BlurUitls.blur call. private Sprite getShadowSprite(String name,float width,float height) Load the texture Pixmap orig new Pixmap(Gdx.files.internal(name)) blur it Pixmap blurred BlurUtils.blur(orig, 16, 2, true) we then create a GL texture with the blurred pixmap Texture blurTex new Texture(blurred) Sprite shadow new Sprite(blurTex) shadow.setSize(width,height) shadow.flip(false,true) dispose our blurred data now that it resides on the GPU blurred.dispose() return shadow I do not have much of an understanding of shaders. Please advise as to what is the most performant way to be able to generate a drop shadow for a transparent image in libgdx. |
7 | What do you use to support multiplayer turn based network game for iOS and Android games? If I'm doing a turn based card game, what kind of technique do you use to support multiplayer gameplay over Internet? Is it socket? If it's socket, which SDK (CoronaSDK etc.) can provide solid socket library? Can Unity3D can be used solely to support what I need without using other socket servers like SmartFox or Electro? |
7 | Do Apple and Google ask for a share if custom payment is done in a free app? I have a multiplatform game (web iOS Android) in the making. In the free version the core game is still fully playable but people who choose to pay will get more social features (and no ads, of course). I was thinking that rather than having a free and a paid version for all the platforms I may release the apps just for free and if the users want more, they have to register and pay a one time fee (through a payment gateway or PayPal). The extra content would then be available in all the clients they have access to. Theoretically, this means a better value for the players and less maintenance and headache for me (obviously I have to handle all the payment troubles myself). Does it fit into the business model of Apple Google? Or will they still claim their share of the registration fee? |
7 | Double touch joysticks I am developing a mobile game where I need to control main character in any direction using touch analog joystick (https pineight.com mw images 6 6f Ipoc dpad.png). It's ok but I also want my character to fire in any direction. Thus I am looking for best solution of control. There are some variants, but no one is ok Target and fire by pointing finger to exact point of the screen (not comfortable, because player will need to hold device by one hand and use second hand to move over the whole device). Fire to direction where the character moves. This case will limit characters' freedom on move and target. Not good. Use second touch joystick (under opposite hand) to select fire direction this variant looks better than previous two, however I still not sure how comfortable it will be. I've tried by myself and it looks a bit complex for me to follow both controls at the same time. Did you saw any games achieving the same goal? What you can recommend? |
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 | What organic traffic can I expect from publishing on Google Play, without other marketing? I've just published a new Android game on Google Play. It has been a bit over 48 hours. It's active in the store, and I can search for it by name to get to it. However, I've had 0 organic downloads thus far, only a couple from my friends. As far as I know, it has not been shown in the "new games" list yet, and the only store listing views in the stats are the ones from myself and friends. Is there some time by which I can expect some "organic" exposure, or will I ever? Is promoting my game by other channels the only option? I'm not asking for advice on promoting my game. I'm only asking about what organic exposure I can expect on Google Play. |
7 | error after changing the app name I have made a game in Libgdx(eclipse).I changed the name of the app inside the string.xml file.Now I have an error in AndroidManifest.xml. in this line android label " string app name" (line 12). its written " No resource found that matches the given name (at 'label' with value ' string app name')." what is the solution? |
7 | Resize the Texture Region (parallax background) to fit my screen size in libgdx I am using libgdx to make a running game. I am using vertical parallax background. I have successfully implemented parallax background many times. But for this game, I want my Texture region to fit my screen size. I tried several things but the texture region is streched badly.Here is a screenshot. I used this code texture bg loadTexture("data road1.png") bg new TextureRegion(texture bg, 0,0, 600, 600) that is obvious. Now ..what should I do... so that while making it as a parallax background... it would fit my screen... I am worried only about the width.... as if the width will fit the screen width... it will look like a running road... no matter how long the height is. I found some solution here https stackoverflow.com questions 7551669 libgdx spritebatch render to texture but not able to understand.. it seems somewhat complex. Please make it clear if it is the solution or suggest on other possibilties. |
7 | Android 2D terrain scrolling I want to make infinite 2D terrain based on my algorithm.Then I want to move it along Y axis (to the left) This is how I did it public class Terrain Queue lt Integer gt bottom Paint paint Bitmap texture Point screen int numberOfColumns 100 int columnWidth 20 public Terrain(int screenWidth, int screenHeight, Bitmap texture) bottom new LinkedList lt Integer gt () screen new Point(screenWidth, screenHeight) numberOfColumns screenWidth 6 columnWidth screenWidth numberOfColumns for(int i 0 i lt numberOfColumns i ) Generate terrain point and put it into bottom queue paint new Paint() paint.setStyle(Paint.Style.FILL) paint.setShader(new BitmapShader(texture, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT)) public void update() bottom.remove() Algorithm calculates next point bottom.add(nextPoint) public void draw(Canvas canvas) Iterator lt Integer gt i bottom.iterator() int counter 0 Path path new Path() path.moveTo(0, screen.y) while (i.hasNext()) path.lineTo(counter, screen.y i.next()) counter columnWidth path.lineTo( screen.x, screen.y) path.lineTo(0, screen.y) canvas.drawPath(path2, paint) The problem is that the game is too 'fast', so I tried with pausing thread with Thread.sleep(50) in run() method of my game thread but then it looks too torn. Well, is there any way to slow down drawing of my terrain ? |
7 | How to decide to use OpenGL ES 1.0 or 2.0 for Android? I started learning some Android development and one of the first things I thought I could make is a simple game. However, I'm faced with one difficult question right off the bat. Should I use OpenGL ES 1.0 or 2.0? The game I have envisioned will be pretty simple graphically, utilizing 2D(tiled top down type graphics) and fixed camera isometric views. I've never used OpenGL in a desktop environment, so I'm oblivious on if shaders will be something I'll use, etc. According to this page I should use OpenGL ES 2.0 generally for new development. My own phone however just recently(past year) got an update to get it to the required Android 2.2. (I don't even know if it has OpenGL ES 2.0 support) So basically my question is, will I benefit from any of OpenGL ES 2.0's features over 1.0 and or is it worth it in terms of compatibility? |
7 | Has anyone tried using one of those BAAS providers to create mobile games? I'm hearing a lot about different companies offering back end as a service (BAAS) for mobile apps but it seems like none of them are very successful with mobile games. Is there any reason why not outsource the server to a provider. The premise here is that the game does need a back end to implement multiplier ans social functions. |
7 | Are frequent game updates a solution for preventing multiplayer cheating? I'm creating a game on Android where the enforcement of rules can only take place on client side (I can't shift it to server side...think aimbotting but in my case I wouldn't even be able to use heuristics to detect it!). As I've read many times, the client side is impossible to 100 protect from modification hacking. I am going to include protections such as ProGuard obfuscation. But also I'm going to use a formula in the code which encrypts data from the client. Hackers cheaters can decompile the code and locate this formula eventually. But how long will it take for them to uncover the encryption formula? A day, a week? Actually, how long in general does it take for a game to be modded for cheating? Can I release updates to my game so that by the time hackers release modded versions of my app to public, they become obsolete? If I did release updates, I wouldn't require updates for single player mode, but only when they tried to do multiplayer would a message display telling them they must update. I just really want to make multiplayer fair and not scare off players because they face opponents with uber awesome hax. |
7 | Reducing Memory Use on OpenGL ES I'm using an opengl es based framework to create my game.I have an out of memory problem on some devices.I have 15 textures with a size 1024x1024(totally 10 mb).On memory they covers a lot of space.Some devices are exiting from game on loading time I want to reduce memory use and how can i do that?Maybe a solution when i loading bitmaps into memory will be great.That's my texture class Texture.java |
7 | Scene2d Stage Actor setup issues I am creating a game using libgdx. In the same each level has a class. I have stage as a member variable of the class. To this stage, I add actors. Inside the levels class, I have attaced the input processor to the stage like below. stage new Stage() sviewPort new StretchViewport(OSR Constants.VIEWPORT WIDTH, OSR Constants.VIEWPORT HEIGHT) OrthographicCamera camera new OrthographicCamera(OSR Constants.VIEWPORT WIDTH, OSR Constants.VIEWPORT HEIGHT) camera.position.set(0, 0, 0) camera.update() sviewPort.setCamera(camera) stage.setViewport(sviewPort) Gdx.input.setInputProcessor(stage) The level object is instantiated in another class known as GameScreen. GameScreen implements the Screen interface. I am unable to detect touch events on my actors in the stage. Each actor has also been given bounds as per the world coordinates. I have added the following code on each actor to detect touch this.addListener(new InputListener() public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) System.out.println("touchdown at " x " " y) return true ) |
7 | Native crashes on UE4 android game only in distribution build As I build my game for development mode and install it directly from apk file to my device, it runs without errors and doesn't crash, there are in game ads and it is able to get variables from game saves. But once I build with Shipping and Distribution tags and upload it to Google Play I get errors on all devices that it is tested. (Installing directly through apk also crashes it.) Here are backtraces Build fingerprint 'motorola harpia harpia 6.0.1 MPI24.241 2.35 1 1 user release keys' Revision 'p1b0' ABI 'arm' pid 14791, tid 14855, name Thread 932 gt gt gt com.MadElectron.FarmPlanet lt lt lt signal 11 (SIGSEGV), code 1 (SEGV MAPERR), fault addr 0x0 r0 00000000 r1 00000000 r2 00000001 r3 00000000 r4 000084fa r5 95bd3280 r6 00000000 r7 00002888 r8 9dbb5fd4 r9 980edb20 sl 96d7f100 fp 9dbb5f88 ip a274d504 sp 9dbb5f60 lr 9fd0eed4 pc a162ad24 cpsr 20070010 backtrace 00 pc 0344dd24 data app com.MadElectron.FarmPlanet 1 lib arm libUE4.so ( ZN22FSessionServicesModule13StartupModuleEv 72) 01 pc 01b32058 data app com.MadElectron.FarmPlanet 1 lib arm libUE4.so ( ZN14FModuleManager27LoadModuleWithFailureReasonE5FNameR17EModuleLoadResultb 432) 02 pc 01b31e98 data app com.MadElectron.FarmPlanet 1 lib arm libUE4.so ( ZN14FModuleManager10LoadModuleE5FNameb 76) 03 pc 0196bee8 data app com.MadElectron.FarmPlanet 1 lib arm libUE4.so ( ZN11FEngineLoop4InitEv 1752) 04 pc 0196aa10 data app com.MadElectron.FarmPlanet 1 lib arm libUE4.so ( Z11AndroidMainP11android app 2568) 05 pc 0196e618 data app com.MadElectron.FarmPlanet 1 lib arm libUE4.so (android main 108) 06 pc 01981bc8 data app com.MadElectron.FarmPlanet 1 lib arm libUE4.so 07 pc 00041acb system lib libc.so ( ZL15 pthread startPv 30) 08 pc 00019355 system lib libc.so ( start thread 6) |
7 | Detecting Screen Resolution in Android AndEngine to display high or low quality images I am developing a game with 1024x600 resolution. I can't target smaller resolution devices at this resolution, so I intend to use two graphics for the game. How do I detect which graphics to use for which device? |
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 | Javascript board game looking for optimization I posted this question on stackoverflow before but received no answers so I decided to post it here and see if someone could suggest me something. I'm working on a html javascript game for android. It's a board game which does the following. It has tiles of different colors and user can place one tile (chosen programatically) on the board. If we get 4 or more tiles of the same color shape we score some points and these tiles will disappear. The tiles above the removed tiles will replace them and new tiles will be added to the empty places. The image below shows how it works (this is just an example, the real board can have different dimensions) The Tiles are lt img gt elements with their ids stored in an array which I use to check for matches and replacement. It all works pretty well but once the new tiles are added to board I need to examine the whole board to check if new matches are avalable. And I want some advice here, because examining the whole board can be really slow. Is there a way I can do this efficiently? Here's what I thought about doing Given the previous example, I thought about examining only the elements in the red area, i.e. only the elements that have been moved or added. It can be effective if the tiles move vertically, as I'll only have to check the moved added tiles and it'll give me the new matches. But in case where I remove tiles horizontally it can be problematic, because if these tiles are at the bottom i'll have to examine the whole board and i confront the same problem. Any advice or suggestion will be appreciated. Note I didn't add any code because it simply consists of checking the lines and columns for a given tile and look for matches. But if needed I can provide it. EDIT Adding horizontalMatchCheck function that for a given index checks for matches horizontally. It's the same thing for vertical check. function horizontalMatchCheck(itemId) hArray new Array() if (rightMatch(itemId)) var index itemId 1 hArray.push(itemId 1) while (rightMatch(index)) hArray.push(index 1) index if (leftMatch(itemId)) var index itemId 1 hArray.push(itemId 1) while (leftMatch(index)) hArray.push(index 1) index if gt 4 matches found I replace the indexes with 5 (because no other tile can have this id) which'll then be removed and shifted. if (hArray.length gt 3) hArray.push(itemId) for (var i 0 i lt hArray.length i ) board hArray i items.length else hArray new Array() function rightMatch(pos) return (!isRight(pos) amp amp board (pos 1) current) ? 1 0 function leftMatch(pos) return (!isLeft(pos) amp amp board (pos 1) current) ? 1 0 |
7 | In Unity, on an Android device, CaptureScreenshot writing to Phone, but persistentdatapath linking to the external card I'm using CaptureScreentshot() to get an image. But when I try to access it on an Android device it's giving me Could not find file " storage emulated 0 Android data appname screenshot.png" When I go the external storage, it's not there, but rather on the phone storage. So why is persistentdatapath accessing something different? My code is the following byte Bytes File System.IO.File.ReadAllBytes(currentScreenshotPathname) with thepathname obtained using currentScreenshotPathname System.IO.Path.Combine(Application.persistentDataPath, currentScreenshotName) Is there anyway to make the persistenDataPath go to the phone storage rather than emulated to read the file? I've tried changing the WriteAccess perimission to Externalas well as Internal in the player settings, but it's still the same. Edit Here's what's happening PersistentDataPath is storage emulated 0 Android data myapp files , but the screenshot is being saved to mnt sdcard Android data myapp files, despite the documentation saying that it should save to the PersistentDataPath. |
7 | Cannot draw around the screen after zooming out with LibGDX projection coordinate I've just started developing game in android using LibGDX. I've follow some samples and now my simple game can draw path when user move their finger around the screen. now problems appear when i add another feature to allow user to pinch zoom in and out. after zooming OUT the orthographic camera user can still draw the path BUT the path can no longer follow user finger to the edge of the screen, the user can only draw the path around the center of the screen. looks like the coordinate projection after zoom out not changed and still limited to the projection before zoom out! how can i make my game to keep drawing line around the entire screen even after the user have zooming out the camera? here's my code nbsp nbsp nbsp 1. in my Screen implemented class Override public void render(float arg0) Gdx.gl.glClearColor(0.1f, 0.1f, 0.1f, 1) Gdx.gl.glClear(GL20.GL COLOR BUFFER BIT) Gdx.gl.glEnable(GL20.GL BLEND) Gdx.gl.glBlendFunc(GL20.GL SRC ALPHA, GL20.GL ONE MINUS SRC ALPHA) renderer.render() Override public boolean touchDragged(int screenX, int screenY, int pointer) TODO Auto generated method stub isDrawing true Vector2 v new Vector2(screenX, Gdx.graphics.getHeight() screenY) add new point for drawing path inputPoints.insert(v) return true nbsp nbsp nbsp 2. in my Renderer class cam new OrthographicCamera() cam.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()) this.cam.update() public void setZoom(float zoom) this.cam.zoom zoom this.cam.update() the triangle strip renderer path new PathClass() public void render() cam.update() batch.setProjectionMatrix(cam.combined) generate the triangle strip from our path Array lt Vector2 gt xox screen.path() path.update(xox) the vertex color for tinting, i.e. for opacity path.color Color.WHITE render the triangles to the screen path.draw(cam) nbsp nbsp nbsp 3. on my PathClass public void draw(Camera cam) if (tristrip.size lt 0) return gl20.begin(cam.combined, GL20.GL TRIANGLE STRIP) for (int i 0 i lt tristrip.size i ) if (i batchSize) gl20.end() gl20.begin(cam.combined, GL20.GL TRIANGLE STRIP) Vector2 point tristrip.get(i) gl20.color(color.r, color.g, color.b, color.a) gl20.vertex(point.x, point.y, 0f) gl20.end() |
7 | Making body (box2d) a sprite (andengine) in Android I can't make body (box2d) a sprite (andengine) and at the same time apply MoveModifier to sprite which is body. If i can make just body, it works namely the sprites can collide. If I apply just MoveModifier to sprites, the sprites can move where i want. But I want to make body (they can collide) and apply MoveModifier (they can move where I want) at the same time. How can i do it? This my code just run MoveModifier not as body at the same time. circles i new Sprite(startX, startY, textRegCircle i ) body i PhysicsFactory.createCircleBody(physicsWorld, circles i , BodyType.DynamicBody, FIXTURE DEF) physicsWorld.registerPhysicsConnector(new PhysicsConnector(circles i , body i , true, true)) circles i .registerEntityModifier( (IEntityModifier) new SequenceEntityModifier ( new MoveModifier(10.0f, circles i .getX(), circles i .getX(), circles i .getY(),CAMERA HEIGHT 64.0f))) scene.getLastChild().attachChild(circles i ) scene.registerUpdateHandler(physicsWorld) |
7 | Best method for 2 layer tile based map scrolling What is the best general approach to implement scrolling for a 2D tile based game? I need to scroll the map with a constant speed, lets say 2 pixels every frame (like in a top down shooter). The tiles are 32x32 and the map is quite big, lets say 10 x 300. There are 2 layers first is the background layer second is the forgeground layer with obstacles and enemies The target plattform is android and I want to use OpenGl. What is best practice? a) Draw only the visible Screen all the time (every frame) b) Load complete map into memory and just move the camera Is there a difference in performance and determining collision etc.? Thanks for any help! |
7 | Faster way to draw dynamic meshes in OpenGL ES I'm writing a 3D game which is going to inlcude some dynamic meshes. For now, my code looks like this private float mVertices private FloatBuffer mVertexBuffer public void onDrawFrame(GL10 gl) first clear the screen of any previous drawing gl.glClear(GL10.GL COLOR BUFFER BIT GL10.GL DEPTH BUFFER BIT) initialize the matrix gl.glMatrixMode(GL10.GL MODELVIEW) gl.glLoadIdentity() update the vertex data for (int vtx 0 vtx lt mVtxCount vtx) fill in the x, y and z components of the vertex position mVertices vtx 3 x mVertices (vtx 3) 1 y mVertices (vtx 3) 2 z update the vertex buffer mVertexBuffer.clear() mVertexBuffer.put(mVertices) mVertexBuffer.position(0) render the vertex buffer gl.glEnableClientState(GL10.GL VERTEX ARRAY) gl.glVertexPointer(3, GL10.GL FLOAT, 0, mVertexBuffer) gl.glDrawElements(GL10.GL LINES, mIndices.length, GL10.GL UNSIGNED BYTE, mIndexBuffer) Here is an easy sample as the index buffer does not change so I only update the vertex position, normal and texture coordinates. Of course I understand dynamic mesh will always be slower to render than static mesh, but I wonder if the method I use is good or if there is a faster better way to do this . |
7 | Open GL ES 2.0 with Android I was wondering if someone could recommended a book that covers both android game developement and OpenGL ES 2.0. I have found some books with OpenGL 1.0, but I have heard that the syntax for OpenGL es 2.0 is totally different. |
7 | AndEngine How to add multiple fixtures into body? I want to create a custom body which have very random shape like a table. So how to add combine multiple fixtures into a body? |
7 | Is there a way to use the RGB channels of a texture as the alpha channel when applying multitexturing using OpenGL ES 1.1? I have been trying to get texture compression using ETC1 (specifically PKM files) working for some time now. I am trying to do this without having to upgrade to OpenGL ES 2 so I have been using multi texturing. I have the multi texturing working now (finally) but the problem is that it is not behaving as one would expect and I think that I have figured out why. When creating the PKMs you end up with PKM with the color components only and one with the alpha component only. Problem is that the alpha PKM seems to be storing the alpha value in the RGB channels. Black seems to represent full transparency and white seems to represent full opaqueness. My question is Is there a way to combine and convert these RGB values into an alpha value when using multi texturing? If not, then I don't see any options for using ETC1 and supporting alphas under OpenGL ES 1.1 (please correct me if I am wrong). |
7 | Human vs human android chess game design First of all I am total amateur in game development and sorry for my poor English. I want to make android human vs human chess game. So I am wondering how to design it? scenario 1 User connect to server, find opponent and send moves to server using socket, so match is running on a server side. I think this is not good idea because move should be validated on client side or do I have to validate moves on client side? I do not think this is good solution because game is seperated. scenario 2 Using hole punching technique so server is needed only for connection between players, so game is running on android devices. which approach do you suggest? Or is there any better solution? Which server is best to use? |
7 | Android sprite sizes? When creating an android game for example space invaders. How big would the sprites have to be? The Enemy ships and player ship and boss ships. So they fit on the android phone and is playable. I'm confused between resolution and this. Thanks. |
7 | Poor image quality on Android through Unity Remote I have started to work on the company's latest project using Unity3D and the workflow is just awesome. The problem is when running the game on a real Android device (using Unity Remote) the image quality is very poor in comparison to how it looks in the editor (Click for a full view. Look at those sprite edges.) Is this... caused by the phone's limited graphics capabilities or have I configured the project improperly or is it Unity Remote and actually building it for Android will fix the quality? (Based on Unity Answers site, Unity Remote is the cause http answers.unity3d.com questions 408896 android image quality is poor compared to the qual.html comment 408945) |
7 | Alternative to Google Play when publishing Android game app (.apk)? In order to register as a game developer and publisher of the Android app for Google Play Developer account, you must pay around 100. But what if there's a tight budget, especially for indie game developers from the start? I want to know where can I find alternatives to publish and promote Android game apps with no registration cost. It is something like a stepping stone. |
7 | How to implement a Trail using Cocos2dx I'd like to implement a trail (like the white circles in Angry Birds) that chase my sprite. I already used CCMotionStreak, but the trail texture is "stretched" instead. Anyone has an idea how to make this? |
7 | Setting density for Android game I am developing an Android game, in which a ball (bitmap) translates( is in motion). So I have provided motion equations for the ball. I have checked my app on Samsung galaxy S2 whose actual density is roundly 252 dpi, and It works fine on that. So my question is that Does these motions of bitmaps in surfaceView, depends on actual density of phone( i.e 252 dpi for S2) or generalized density(i.e 240 dpi). I am confused whether if I run this app on 235 dpi smartphone, So will it have the same performance of motion as it is on Galaxy S2( with 252 dpi) or it would be little slow ? Any help will be appreciated. Let me elaborate it with coding. For example a linear motion of a ball is defined as with this equation x x 4 Now If I run this app, on Samsung galaxy S2(252dpi, and hdpi), So It will give me a particular speed motion, let say P is the speed of the ball. Now If I run this application on Samsung Galaxy S3(300 dpi, xhdpi), So the ball speed gonna be slow on this density, meaning less than the speed P. So I will need the same speed on xhdpi density phone. So will use these conversion formulas dx (x 160) 240 px (dx 320) 160 Hence the speed will be either exact or little different from P.(This is my confusion). That Whether the speed will be as same as it was on S2. So my Question at this point is that my app worked on Samsung Galaxy S2 with the speed p, that I desired. As S2 is of 252 dpi, So Should I Include 240(Generalized density or 252 (Actual density) in my this line of coding ? dx (x 160) 240 Thanks ! |
7 | Multiplatform game, save game state and resume it on other platform This is for a personal and knowledge acquiring project. I want to create a little TIC TAC TOE multiplatform game, app amp web. The choosen technology for the app will be Android or Flutter and for the web Angular. My doubt is, during a game if the user wants to change from the mobile version to the web version, how to resume or change the game to the web application? What would be the best way to save the game state and load it into the other platform? Having in consideration that the user will play only in one platform at a time, which is the best way to implement this restriction too? Is this as simple and hard at the same time as implementing all controls in both platforms and storing all the data required in the database? |
7 | How to change the KEYSTORE securely? I'm wanting to release a free version of an app to which I've already made a paid version. I simply copied the project to another folder The project is initially the same as the paid application when finalized. I want to simply delete a few phases and put a link that takes the application paid in the Google Store (this I know how to do) Turns out there is something called a keystore. I would like to know if only thing I have to do is create a file.keystore in the directory with different name, rename the Filename (before Password) and click the generate button (below Country). OBS Obviously I will make a backup copy of the paid version file.keystore. |
7 | JBox2D simple example for Android? I'm starting to develop an Android game. I've already installed jBox2D but I can't find complete code to develop a simple application from scratch using this framework. Thanks in advance! |
7 | FBO rendering different result between Galaxy S2 and S3 I'm working on a pong game and have recently set up FBO rendering so that I can apply some post processing shaders. This proceeds as so Bind texture A to framebuffer Draw balls Bind texture B to framebuffer Draw texture A using fade shader on fullscreen quad Bind screen to framebuffer Draw texture B using normal textured quad shader Neither texture A or B are cleared at any point, this way the balls leave trails on screen, see below for the fade shader. Fade Shader private final String fragmentShaderCode "precision highp float " "uniform sampler2D u Texture " "varying vec2 v TexCoordinate " "vec4 color " "void main(void)" " " " color texture2D(u Texture, v TexCoordinate) " " color.a 0.8 " " gl FragColor color " " " This works fine with the Samsung Galaxy S3 Note2, but cause a strange effect doesnt work on Galaxy S2 or Note1. See pictures Galaxy S3 Note2 Galaxy S2 Note Can anyone explain the difference? edit Folowing VinceFR's comment, we've tried adding the following. When the renderbuffers are initialised they are briefly bound to the framebuffer and set the background to a uniform buffer with GLES20.glClearColor(backgroundColor 0 ,backgroundColor 1 ,backgroundColor 2 ,backgroundColor 3 ) GLES20.glClear( GLES20.GL DEPTH BUFFER BIT GLES20.GL COLOR BUFFER BIT) The result is unchanged on the S3, on the S2 it has improved a certain amount, but problems still exist note the 20 in the bottom right corner is supposed to be there. |
7 | Inconsistent sprite velocity? I'm moving my sprites using the following formula Code that I'm using (Only shows sprite's X position being calculated but Y position is also being done) spriteGridX 240 480 I start out with a virtual 'Grid' so I can scale position to all resolutions etc so 240 480 would place the sprite at the center of the screen (X) spriteScreenX spriteGridX width Scale to physical screen where width is the width of the current devices screen (viewport) spriteXTime 8f 8 being the amount of time in seconds that this sprite will take to traverse the entire width of the screen spriteXVel 1 spriteXTime Velocity that will be used to move the sprite along the virtual grid position So, when I need to move the sprite, I simply do the following spriteXGrid (spriteXVel Delta) for right for left. I'm using a fixed delta time spriteScreenX spriteGridX width And again, convert to usable screen position for current device drawsprite(spriteScreenX, SpriteScreenY) Draw the sprite (drawSprite is just a method I've written to draw openGL quads and it takes the screen X and Y as coordinates spriteScreenY not shown here but essentially same as X with height instead of width. Problem The above seems to work OK (if I specify, as above, 8seconds, then the sprite does indeed take 8seconds to pass the whole screen as far as I can tell). However, a problem becomes evident when I have 2 sprites (in my case, 2 horizontally moving platforms, both starting at the outer edges of the screen one on the left and one of the right) these move towards each other and when they 'meet', they go back in the opposite direction, and again when they reach their initial starting positions. After the second time, they start to move slightly out of sync and the problem accumulates. Each platform has the same time velocity settings and it seems that a sprite over the right side of the screen moves at a very slightly different speed than the one on the left. After the initial move, the difference between the grid positions of my 2 sprites are a follows Left sprite 0.002083334 Right sprite 0.0020834 I can't work out why there is a difference. They're using the same formula. Of course the problem could be that they are reversing at slightly different times and not the speed as I suspect, but for now I've ruled that out as they seem to be reversing correctly. Be grateful if anyone could assist. Thanks Test Device Google Nexus 10, Samsung Galaxy Ace v1 |
7 | How to make a horizontal scrolling menu in Game Maker Studio 1.4? I know how to place the items you see in the picture, my problem is how do I move them? How do I know if the player is swiping right or left? I made the items with a ds list in a script file and then have an object obj MenuCreation run that script, so if I move the obj MenuCreation, will it move the list with it? |
7 | How to handle pixel perfect collision detection with rotation? Does anyone have any ideas how to go about achieving rotational pixel perfect collision detection with Bitmaps in Android? Or in general for that matter? I have pixel arrays currently but I don't know how to manipulate them based on an arbitrary number of degrees. |
7 | Who makes the art assets for mobile games? I know how to develop apps for Android but never tried developing games, and I want to start soon. For developing games we need sounds and high quality images (say a background, characters, logos, etc.), so how to create these? For this should we have a separate team? Or a developer can create these using any tools? |
7 | How to implement custom texture formats in Android? What I know Android can load PNG, BMP, WEBP,... via BitmapFactory. What I want to achive Load my own 2D file format (e.g. 1 bit texture with a 1 bit alpha channel) and output a RGBA8888 texture. Question Is there any interface to achieve this?(or any other way) The resulting image is used as a texture for a 3D model. Why would you do that? Saving phone memory and download bandwidth while expanding the texture at runtime to RAM seems reasonable for very simple textures. |
7 | OpenGL 2.0 Android Scrolling Horizontally and Vertically I am new to OpenGL2.0 in Android. How can I scroll the GLSurfaceView both horizontally and vertically? |
7 | Gradually reduce speed Basically I am working on following application of android version Party Games Drinking Wheel For this I want to rotate wheel and want to stop wheel at specific point. But I want this with gradually decreasing speed. For example at start I have speed of 10 then at stop time it at 0. So wheel stop smoothly. At presently I have working code but it stop suddenly. registerEntityModifier(new RotationModifier(desireTime, 359f, desireRotation, new IEntityModifierListener() Override public void onModifierStarted(IModifier lt IEntity gt pModifier, IEntity pItem) Override public void onModifierFinished( IModifier lt IEntity gt pModifier, IEntity pItem) mPointer.stopRotation() showWindowAfterSomeTime(randomSegment) , EaseLinear.getInstance())) I want some help in this. Thanks for your time. |
7 | How to build multiplayer games for android? I'd like to know how to build android multiplayer games but I'm struggling to find a step by step or good resources on this topic. My main questions is which engine and api to use? I'd like to achieve this with the technologies I already know such as Firebase and Libgdx on android studio. All my researches point to things like Unity, Godot and unreal. Is this the only better way to go since I want to build simple games such as pool ? What I want to build is a multiplayer game on where the users should be able to invite friend from their social media to play against, provide rankings and sharing results on social media. ONLY for Android, using Java and free resources (APIs, db's, engines). A good example would be Trivia Crack how is this game (probably) made? which technologies? |
7 | How do I eliminate black bar artifacts in AndEngine TMX plugin? I used AndEngine gles1 along with the tmx plugin to generate my background maps. The image width is not fit to my virtual device, so I increased the tmx image size. Here is my code for the camera width and Camera Height CAMERA HEIGHT 320 final DisplayMetrics displayMetrics new DisplayMetrics() this.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics) float aspectRatio (float) displayMetrics.widthPixels (float) displayMetrics.heightPixels CAMERA WIDTH Math.round(aspectRatio CAMERA HEIGHT) But it shows me black bars as follows |
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 can the Unreal Development Kit be used with Android? I've read the UDK will support Android development, I checked the download page on the site and found nothing related to Android. also read that Dungeon Defenders Android game was built with Unreal engine. so is there a way to use the UDK with Android ? |
7 | Phone for Android game development I've been developing casual iPhone iPod Touch games touch for about two years. I'd like to port some games to the Android platform. Since I'm stuck w a two year iPhone contract I don't want to get an Android phone that requires a service plan. What is the best phone to get for development in this situation? |
7 | sharing preferences between two apps on android with libgdx I am making an android game with both a demo version and a paid version. I want users who decide to buy the paid version to continue from where they left off, with all their old data and settings. I've set a shared user id between both applications, and now I'm wondering if it's possible to use libgdx preferences across both versions. I am also open to other ideas on how to implement this. |
7 | Best method for 2 layer tile based map scrolling What is the best general approach to implement scrolling for a 2D tile based game? I need to scroll the map with a constant speed, lets say 2 pixels every frame (like in a top down shooter). The tiles are 32x32 and the map is quite big, lets say 10 x 300. There are 2 layers first is the background layer second is the forgeground layer with obstacles and enemies The target plattform is android and I want to use OpenGl. What is best practice? a) Draw only the visible Screen all the time (every frame) b) Load complete map into memory and just move the camera Is there a difference in performance and determining collision etc.? Thanks for any help! |
7 | Accessing libgdx classes within Android classes Currently what I'm able to do is to access android APIs within libgdx with an interface in core and defining all the methods and then implementing it in every project (desktop, android, etc). What I want to do is I want to create a way so that I can call a method from some android class (say AndroidLauncher) and it calls a method of a libgdx core project class (like modifying some stage element). How do go about that? Any help would be really appreciated. Note As a 'hack' right now, I'm just waiting for any update from android class in the render method using those same interface methods, but I don't think that's the best possible way. |
7 | How can i draw Arc in center of the screen on canvas in android RectF rectf new RectF(10, 100, 700, 800) c.drawArc(rectf, 0, 90, true, paint) the above code is draw the arc using drawArc() method of canvas but i try to draw arc in a center of the screen. |
7 | Game Loop Should resources be initialized in the game loop or in the respective classes? (both?) For example, lets say we have an enemy class in my Android game project. I am initializing the enemy bitmap to be used with certain sprites in my game loops init. I am then calling the respective classes init, which is passed this loaded bitmap. What is the process associated with initializing resources and classes in the game loop? If I am totally off course just point me in the right direction. Thanks! D |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.