AndEngine hangs - android

I'm developing a game using andengine. On my scene i have only 3 sprites moving in the same direction. So the problem is that it sometimes hangs after less than a second and sometimes not. Interface does not respond. Logcat shows no problems at all. It looks like it hangs somewhere inside andengine, but I can't figure it out. I just managed to track it down using step over in OnManagedUpdate method of Entity class on line
entities.get(i).onUpdate(pSecondsElapsed);
When i step over it just hangs and I can't step into it.
Did anybody face such problems? What it could be?

I found the bug - the sprites animation rate was generated randomly and sometimes it got negative value. I'm realy sorry for such a vague question, it's just the project is large enough to take a lot of time to isolate the problem code part.

Related

Unity Game suddenly has poor performance on Samsung S8, but still perfect in editor

The last few days I have been building a simple platformer to be deployed on Android Phones. However, after the last deploy to my phone, the framerate was bearly at 25fps on my quite fast Samsung S8. The game in the editor is somewhere at 100 fps and works fine. The game also worked fine on my S8 just a day before. I have not really changed anything, so what could be going on here? This is absolutely unacceptable. If you need further info, tell me!
Thank you!
This is from the profiler:
I cannot tell you, why this happend but this was all I needed to do:
In any script that starts (like playermovement or what ever) add this line:
Application.targetFrameRate = 60;
E voila.
I didnt have this line before and it worked but it stopped working. Adding this line fixed it entierely. Thank you all.
First of all, try deducing number of Tries and Vertices in your Meshes, Use baked lighting to improve performance, Also try object pooling wherever possible, and generate Occlusion map to optimize your game for mobile devices. You can set quality settings from Unity for mobile devices. You will need to maintain LOD levels if you want more complex meshes to be rendered on your phone, and optimize game as much as possible to render it on mobile devices without any glitches. I will also recommend you to use this toolset, which will help you in optimization.
UPDATE
If you have recently changed anything, which made your app performance Bad, then check you haven't added any Co-routine or IEnumetaror relative code that may iterate over time in separate thread in your recent changes, try using Collab to maintain versioning, as you can restore your previous code with help of collab anytime, in case you loose something, it is totally free and very useful.

Android 2D Game Development: How to handle the background/rendering in general?

I'm currently trying to create a 2D Android based game for my Android App Dev. class, and after making the layouts and finishing up everything else, I realized that I don't have a clue as to how to render the images and how to have a scrolling background for my game.
The Idea:
It will be a very simple 2D game
kirby will be the main character (kinda already understand how to animate images)
2 enemies (wanted them to walk. but since project is due in 4 days, they can stand)
kirby can only move left/right and jump (which i will figure out later haha)
-
The Research
-
I have looked for around 5~6hrs for the last couple of days and cant figure it out
The main problem I am having is that I understand that Canvas/OpenGL is used to make the background and render Images but I cant find any videos or easier tutorials on making the level scroll as I want it too or the code.(if you dont know what kirby is, the level scrolls similar to mario style, kirby xpos + = level xpos + is what I think the code would be like...)
Yes I know that this is sort of waiting to the last minute, but any help would be much appreciated !
Thanks Again,
Gabe

Screen goes black then program crashes

I have a problem i have been hunting down for the last day and i cant seem to find what is wrong. I have been working on this app for about a month without too many problems. I started working on the main interface page and one button into it this problem rears its ugly head. The problem is the screen shows up and then disappears about 30 seconds later. After watching the error it has a particular method of things happening. First my bitmaps go, then the texts after about a second, then the screen is black for about 5 seconds, then i get my phone background then about 10 seconds later the my apps show up. I never get a force close message. Id rather understand what is causing the problem then having someone tell me to change something so i can prevent it from happening again. So i don't want to post my code just yet.
other tidbits:
all my graphics are using the canvas method
since i got a 30 second window i continued working on the framework of my project the problem still has the same timing after finishing a good portion of it
the graphics i used from the working portion of my code are the same in my nonworking
the screen has no functionality to it right now its just graphics
I get the feeling i cant avoid posting my code but please try to answer it without asking for it.
Thanks to Steve for letting me know about the logcat. After updating Eclipse it became much easier to read. The problem was, not enough garbage collecting. Ironically the code that seem to be giving me problems was not the problem it was just the straw that broke the camels hump.
I have chopped up my code enough to where it is workable but i still have a lot ahead of me to fix the issue 100%.

slow box2d with libgdx on android

I have made a falling ball in libgdx with box2d.
On my PC the ball falls as it should with clean animation
But when I try this application on my Samsung Galaxy S then all of a sudden it seems to run very slowly... (looks like the fps is 1) however the fps that is printed to the logcat is around 60 (using FPSLogger.log()).
so it seems it's not the drawing speed holding it back? But what is it? is this a bug with libgdx box2d?
Timestep is 1/60 and there is no special threads going on or something (this is mainly a test and all the code is basically in the render() function)
Ok.. So I figured it out...
My problem was the lack of understanding of how game loops and delta times should be used.
Resulting in my game speed depending on the frame rate (on PC it was around 2000)
If anyone has problems with this or something similar I recommend Gameloops and Fix Your Time Step
(P.S I recommend them anyway)
Thanks to kalle_h for helping me find these :)

OpenGL ES2 for Android - Weird random juts

I'm just starting to learn OpenGL ES2 for Android, and have come across a weird problem where sometimes a weird jut will be rendered from my objects (see pic). This doesn't always happen, which is strange, so I'm wondering if anyone has any experience with this sort of thing and how to fix it.
http://img717.imageshack.us/i/device2h.png/
The problem here was that I was calling GLES20.glDrawArrays(type, first, count) with an incorrect count. Setting the variable correctly fixed it.

Categories

Resources