Hot answers tagged

4

The Android memory profilers that comes with the Android Developer Tools will allow you to figure out what is consuming your memory. It comes in three parts; Memory Monitor (this is used to find performance problems, so we can ignore this one for this particular problem). Tool Heap Viewer Allocation Tracker Using the Heap Viewer you can take snap-shots ...


3

An abstract method is a method without a body. So you can't just call an abstract method of an abstract class (you cannot instantiate an abstract class directly). If you want to have your abstract game class with the abstract methods you need to have a class that extends this game class and specifically implements these methods without the abstract keyword. ...


3

I would take a look at glDraw*Instances (Instancing) Also, reducing vertex count for a large amount of small particles is extremely important. I don't know if your using a model or a single 2D texture or what, but some general tips: Use as few verticies as possible. If using transparency in your textures, use glAlphaFunc to reduce blending needed. If ...


2

It looks like the edges get a fractional alpha based on the edge coverage. Problem arises when two edges fill 100% together but are blended as translucency, not coverage, only applying ~75% color. It's like the difference between covering your eyes with both hands vs covering your eyes with two pair of sunglasses. I only know how this works in opengl, but ...


2

Your code isn't wrong at all. You are dealing with matrices and vertices the right way (your 3D simulation actually works), and even texture mapping is fine. Matter is, your texture mapping algorithm uses just a linear interpolation to map a point in the 3D space to a point in the 2D plan of a given texture. Texture mapping When mapping texture to mesh ...


2

Expanding on Greffin28's Answer Tile Based Collision Detection in Games In tile based games it's really easy and fast to detect whether an object is colliding with a tile. Some psuedo- code to accomplish this: /** * Moves our entity along the x, then y. If we do both at the same time the entity * will not move if any of the collision detections fail ...


2

For accessing the array i suggest you make a function like the following: String getState(int x, int y) { if (x < 0 || x >= WIDTH || y < 0 || y >= HEIGHT) return "g"; // Let's say all blocks outside the map is solid. return blocks[y][x].state; } This simple function can save you from array out of bounds error. Basically, the function ...


2

I suppose the Tile class is the class of which all the "balls" are an object of? (i dont have much time to read the code). If i understand correctly, what you are asking is how to change the balls color? if yes, i would suggest that when you want to change a balls color just get the tiles from your Tiles array and just: board[x][y].background = //the new ...


1

Solved After thinking this through almost a complete day (I encountered the problem yesterday), I realized I had the function to determine the height of any given point using the distance to the ocean. Why would I need to take averages and complicated calculations if I could just check the distance to the nearest coast, and then use the formula?


1

An Alternative Approach As very astutely stated by Dan in the comments to your question, trigonometric functions are very expensive to calculate and for something as simple as a bouncy ball you can keep to simple and fast vector math. It appears that you're only doing AABB collision so this method will work perfectly for you. What to change Your Ball ...


1

It would appear your rendering logic is completely flawed. Take a look at this question and it's answers, you appear to be doing some of the same errors I previously did. Canvas - good rendering practices? About Projectiles Drawing one rectangle will literally never have any noticeable impact on your frames so there is obviously a flaw elsewhere, ...


1

From my experience, it's not expensive to bind textures. I have a program that binds about 30 textures per frame and it runs pretty smooth. Since you're using only 9 textures and VBOs on top of that, I imagine your game actually runs very well.


1

A first aproach could be giving a varying weight to each type of block, modifying such weight each level, decressing the probability of spawning an easy blocks and increasing the probability to spawn a harder ones. I'm also going to suppose you have some kind of a parent Block class and different child classes for each type of block. public Block ...


1

you can do like this: In your hud class public jumpButtonPressed = false; buttonJump.addListener(new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { jumpButtonPressed = true; return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { ...


1

Dont know how your particle system is written but it is very possible that your bottle neck is the communication time between CPU and GPU. Not going to go into too much detail but just know that this operation can be very slow because it causes stalling. Perhaps the idle time you see in profiling is due to that. What a good particle system do is to move all ...


1

Unfortunately - No. Unity only supports: UnityScript (JavaScript for Unity) and C#. Boo support dropped in Unity 5. But C# is very similar to Java, and I for myself started only with Java knowledge and it was no problem for me to learn C#.


1

I'm not going to go into details, but what you should be looking into is something like WinAMP's MilkDrop plugin presets and porting them to a shader. A good selection of example shaders (and how to write them) can be found at https://www.shadertoy.com/. These examples run on WebGL and use the GLSL language to render procedural content that is usually fast ...


1

I've stumbled on an answer for creating a decent and easy GUI system from playing around with my game. Currently it draws the images of items onto the GUI screen, but more can be done in the future. This is essentially how I have it setup: Over-World State: EntityPlayer {picks up} --> Item (i.e. ItemPotion) --> {goes to} Player Inventory The Player walks ...


1

This is most likely because to make more than one instance of this you will need an array of these objects. Usually there would only be one player and multiple enemies so the player would be a single object and the enemies an array. Here's do simple code to explain this: Enemy[] enemies = new Enemies[10]; for (int i = 0; i < enemies.length; i++) { ...


1

If you want to use sqlite with libGdx you can use opensource project gdx-sqlite . gdx-sqlite is a cross-platform Libgdx extension for SQLite database handling. The extension abstracts database handling to provide a unified method to handle database transacitons across multiple platforms while also adding SQLite support for desktop version of Libgdx ...



Only top voted, non community-wiki answers of a minimum length are eligible