Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Tier 2 android project black screen, minimizes to home.

Author
Message
wargasmic
17
Years of Service
User Offline
Joined: 15th Oct 2006
Location: UK
Posted: 17th Sep 2013 00:15 Edited at: 17th Sep 2013 00:17
The android game I'm working on shows a black screen when I load it, then after a couple of seconds the home screen pops back up. The app still shows up in the background applications but when maximizing it again it just flashes the black screen again for a second then minimizes back to the home screen.

Logcat shows some media files aren't being found. Would this cause the application to crash?

I have my media files in the assets folder in sub directories such as assets/media/models|images|sounds|shaders.

Am I supposed to prefix my media paths with assets for android projects?

Here's a paste of the logcat. I would appreciate someone taking a look as its mostly gibberish to me.

http://pastebin.com/zKdBpKHR

I'm using beta 19 by the way.
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 17th Sep 2013 01:31
I'm not an expert on this, but suggest removing "/media/" from the path.

-- Jim - When is there going to be a release?
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 17th Sep 2013 02:20
Quote: "I'm not an expert on this, but suggest removing "/media/" from the path."

I actually find that it makes it more definite about where to look. And I use it all the time.

In your load object command are you using exactly "/media/models/monkey.obj"? Ditto for all other files. Android is case sensitive.

And does the actual file have the same name, including case? (And is the 'models' directory named exactly 'models', same case?)

Do you use the SetFolder command anywhere? That sometimes confuses things.

Are you sure that all the directories and files are in the <andproj>/assets/media directory?

What version of AppGameKit are you working with?

As for the black screen. Android will always do that unless you put an AGKSplash.png file in the <andproj>/assets directory and/or until you actually put something on the display and get a couple of Sync() calls in. The agk::Sync() call sort of works in the app::Begin() method. But it is usually the first call in app::Loop() that gets something started to the display.

They were going to do away with AGKSplash.png, but may have changed their mind. I finally got it to work properly in a landscape only orientation in my Tier 2 WIP and I like having something appear after a couple of seconds rather than waiting upwards of 5 or 6 (depending on device speed).

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
wargasmic
17
Years of Service
User Offline
Joined: 15th Oct 2006
Location: UK
Posted: 19th Sep 2013 18:55 Edited at: 19th Sep 2013 19:59
I had some misnamed files that were causing the asset loading problem. I no longer have the loading errors.

I added an splash image to my project and now instead of the black screen I see the splash screen image, but the app still minimizes to the home screen seconds after. Again, I can pull the app back up from the background processes but it still just shows the splash screen for a split second then minimizes again.

Here's a paste to the new logcat and the sections I see in red below

Edit: As mentioned in the OP, I'm using beta 19.

http://pastebin.com/f40uZ2ck

Quote: "09-19 16:48:44.431: E/Trace(29375): error opening trace file: No such file or directory (2)
"


Quote: "09-19 16:48:44.611: E/native-activity(29375): A70GP
09-19 16:48:44.611: E/native-activity(29375): ARCHOS GAMEPAD
"


Quote: "09-19 16:48:45.331: E/Trace(29408): error opening trace file: No such file or directory (2)
"


Quote: "09-19 16:48:48.211: E/native-activity(29375): Displayed Splash Screen
"


Quote: "09-19 16:48:49.891: A/libc(29375): Fatal signal 11 (SIGSEGV) at 0x00000014 (code=1), thread 29388 (pany.mytemplate)
"
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 19th Sep 2013 21:26
The lines you displayed in your post don't help much. The issue has absolutely nothing to do with the splash screen.

These lines in your LogCat might give a clue about where to look for your problem:


Something in your PinkEnemy::Step method is causing the crash. I don't know if the '+184' refers to lines (probably not). I suspect it is bytes of offset into the memory where the compiled method is. But it is being called from within the World::Simulate method, which is called from the Engine::Run method, which appears to be called from the app::Loop method.

It looks like the issue is in your actual code and, without looking at it, there isn't much help at the moment. And I am not volunteering to go through all of your code.

Maybe posting the code for the PinkEnemy::Step method might help.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
wargasmic
17
Years of Service
User Offline
Joined: 15th Oct 2006
Location: UK
Posted: 19th Sep 2013 21:29 Edited at: 19th Sep 2013 21:30
I think I've isolated the problem down to one of my enemy objects. It seems something in the update code was causing the problem, but I still have other strange problems that have persisted the whole time I've been using AppGameKit with tier 2 which make no sense at all.

First of all the background color is always drawn as blue, even though I have set the clear color to black.

None of my models display their textures and some of my models are not visible at all.

For example my environment models for the arena show just fine, but with no textures so they appear a solid white and my player and enemy models don't even show at all. This is funny because both my environment and enemy models use a meshcomponent, so really my enemy models are the exact same object type as my environment models, yet they don't show at all.

My player is being spawned correctly, as I can move around, I just can't see the player model so I'm assuming my enemies are being spawned properly but are suffering from the same problem as my player object.

Also everything displays fine in windows.

Edit: AL, just saw your last post after making this one. The crash was indeed caused by the code in my step function.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 19th Sep 2013 22:00
1. Have you made sure that the name you use in Load<x> statements is exactly the same case as the actual file? Android is case sensitive on file names.
2. Are there any spaces in any file names or directories that you are using? Android does NOT like spaces in file or directory names (even though they are supported, it does cause problems in some processes).
3. Are your files all loaded in the assets/media directory? Or are they directly in the assets directory? In Tier 2, you can put them directly in the assets directory if you have a forward slash right before the file, eg. LoadImage("/someimage.png"). If you don't have the forward slash, I think the AppGameKit engine assumes that you mean to load from a directory named media.
4. Are you loading your object textures? If so, what file format are they in?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
wargasmic
17
Years of Service
User Offline
Joined: 15th Oct 2006
Location: UK
Posted: 19th Sep 2013 22:14 Edited at: 19th Sep 2013 22:16
Arena.cpp


Arena extends my base World class which handles resources, simulaton, game modes etc. Arena is a basic world loading a few resources, and spawning and setting up some static meshes for the environment.

StaticMesh.cpp



StaticMesh extends my base game Object, which all objects are derived from. StaticMesh is basically the base game object with a MeshComponent attached to it.

MeshComponent.cpp


MeshComponent is basically a bunch of wrappers around AppGameKit commands for setting up meshes and indexing them within the MeshComponent.

The only difference between my enemies and static meshes, is that my enemies extend my MovableObject class, which is basically the base game Object with a MovementComponent and a MovableMeshComponent(which is a MeshComponent with some code to sync up the mesh position with the object position)attached. Display wise, both enemies and environment use the mesh component for their models

MovableMeshComponent.cpp


EnemyBase.cpp


EnemyBase is the base class of all enemies.

PinkEnemy.cpp


As you can see the pink enemy mesh is set up in the same way as meshes for the environment (static meshes) above, yet they aren't visible.

So to summarize the three things I need to fix are the clear color always being blue, textures not appearing on objects and some objects not appearing regardless of them using the same object system as others. None of these problems occur in windows.
wargasmic
17
Years of Service
User Offline
Joined: 15th Oct 2006
Location: UK
Posted: 19th Sep 2013 22:23 Edited at: 19th Sep 2013 22:25
Cases match and there are no spaces in the file or directory names, there does not seem to be any problems actually loading in the media files now as I can see the environment objects but without textures, but my enemy/player objects are not visible at all.

My files are in the structure of <assets>/media/models, <assets>/media/images etc and paths in the code are defined like "/media/models/monkey.obj".

Yes I'm loading the textures, they are .png format and sizes are power of 2.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 19th Sep 2013 22:35
While I really did not want to look at your code, especially since I'd have to see all the headers for the classes to see how things are defined (and I do NOT want you to post or send your entire project, I am not in the habit of debugging for everyone else, I just don't have the time), I notice that you have something called 'meshes' and you are using a string for an index.

That has the appearance of something like a hash.

I do know that, given the Android setup I have that actually works, hashes are not supported. Any C++11 stuff is not supported in the Android SDK set that works with AGK. I was able to find one that let me do hashes, but it caused lots of problems with the AppGameKit builds.

Where do you set the clear color? Do you do it app::Begin (either directly or as a part of a function called from there)?

Did you verify that the names used in your code are the exact same ones (both path and file) as the actual ones on the disk?

Did you check to see if the files in your <andproj>/assets/media/<etc.> have not been corrupted? (Open them in any image browser).

Were all your textures created with the same tool and in the same format?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 19th Sep 2013 22:40
You typed faster than me. So the images are all good.

Again, it looks like I'd have to go through the whole code (including headers) to understand how it all fits together. And I am NOT going to do that.

And it is things like 'the only difference is' that are what are usually catching you out.

Does the program work correctly in Windows?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
wargasmic
17
Years of Service
User Offline
Joined: 15th Oct 2006
Location: UK
Posted: 19th Sep 2013 23:09
I'm indexing my resources, meshes, objects and components with map<std:string, int>, map<std::string, mesh*>, map<int, Object*>, map<std::string, Component*>.

I know you have said in the past that you can't use map but after some earlier tests before rewriting my engine I discovered that using maps in this way seemed to work, and for the most part still do. For example, my player object for movement relies on a MovementComponent, which is indexed along with other components in a map<std::string, Component*>.

I take input from the virtual stick an set a velocity on the movement component. All components indexed for an object are looped through every step and have their Step method called.

In the case of the movement component, the Step method applies the appropriate movement to its owner object.

I am able to move around with the virtual joystick which, so the way I am indexing using string/pointer and int/pointer pairs seems to be working.

The clear color is being set directly in App::Begin



Yes I verified the names used in my code are the same as the file names and that the paths are correct.

The files are not corrupted, I am able to open them all. I even copied them back over into my visual studio project to verify, and everything still looks fine in windows.

All textures were created with the same tool and also in the same format.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 19th Sep 2013 23:30
Does the program work correctly in Windows? Does "everything still looks fine in windows." mean that you compiled and ran your program in Windows or that you were able to view the image files.

Quote: "I'm indexing my resources, meshes, objects and components with map<std:string, int>, map<std::string, mesh*>, map<int, Object*>, map<std::string, Component*>."

That should work then. Maybe. I ran into issues when I was trying to use a structure for the index (std::string is a simple index object) and had to set up custom comparison functions. They worked fine in Windows, but did not in Android.

Did you check the log.txt file generated when you built the Android app (either in cygwin or using the batch file)? Just to make sure it isn't complaining about anything?

I tried a very simple test last week playing with an object created in Blender and went a little nuts before I got the right combination of object scale, object and camera location and camera pointing before I could see the object. Is it possible that positioning or pointing or scale is an issue?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
wargasmic
17
Years of Service
User Offline
Joined: 15th Oct 2006
Location: UK
Posted: 15th Oct 2013 20:29 Edited at: 15th Oct 2013 22:46
Sorry for taking so long to reply to this. I've been very busy lately with work stuff and haven't had a chance to follow up.

Quote: "Does the program work correctly in Windows? Does "everything still looks fine in windows." mean that you compiled and ran your program in Windows or that you were able to view the image files."


Yes the program appears to work correctly in windows. I can see all images and models when running the game on windows as well as all media files working normally when being viewed.

Quote: "Did you check the log.txt file generated when you built the Android app (either in cygwin or using the batch file)? Just to make sure it isn't complaining about anything?"


Yes, the log file is completely blank.

Quote: "Is it possible that positioning or pointing or scale is an issue?"


Not since everything is visible when running the game in windows.

Edit: I just figured out that my models are visible if I don't apply a texture/image at all. Any idea what would cause this on android but not windows?
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 15th Oct 2013 22:59
Quote: "I just figured out that my models are visible if I don't apply a texture/image at all. Any idea what would cause this on android but not windows?"

The only thing I can think of is that your Android device doesn't support it.

There is a free app (OpenGL Extensions Viewer) for Androids that will tell you what version of OpenGL your Android has and what it supports.

Or that the files are too big? There is a 1024x1024 size limit on image files for Android. I don't know if that applies to textures as well.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
wargasmic
17
Years of Service
User Offline
Joined: 15th Oct 2006
Location: UK
Posted: 16th Oct 2013 00:12
Hmm, well the device I'm testing on is an Archos gamepad with ICS and a Mali 400 gpu. The images are 128x128.Ive also tested on my other 2 devices, a cheap chinese tablet and a HTC desire HD. All 3 give the same result. The chinese tablet has JB on it and the desire HD has cyanogen mod 7 (android 2.6 I believe).
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 16th Oct 2013 00:50
I have not really worked with 3D, so I am kinda at the end of what I can think of as to what the issue is.

Try the OpenGL Extensions Viewer on your devices and see what version of OpenGL is supported. It will also tell you waht is being used as the Renderer, that might help. It might also indicate whether textures are supported or not.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
wargasmic
17
Years of Service
User Offline
Joined: 15th Oct 2006
Location: UK
Posted: 16th Oct 2013 04:34
The device is running ogl es 2.0, shader language 1.0. Max texture size 4096
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 16th Oct 2013 05:49
Then I am all out of ideas. Maybe someone else can help.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
wargasmic
17
Years of Service
User Offline
Joined: 15th Oct 2006
Location: UK
Posted: 16th Oct 2013 14:14 Edited at: 16th Oct 2013 16:38
AL, what version of the NDK do you use? I'm using r8e. The default path in the .bat file of the android template is r6b but I changed this to use r8e. Do you think this could cause problems? I recall having errors when building with r6b which is why I tried r8e.

Just to make sure everything is clean, I have just done a reinstall of AppGameKit beta 19 and set up a fresh android template but the problem of textures not displaying persists
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 16th Oct 2013 17:05
I am using r8e as well.

Are you sure that the AppGameKit files (libraries and java files and such) in your Android path are the same version as your Windows setup? (Critical in Tier 1, but can't hurt to check in Tier 2.)

And, just to be thorough, you are using a separate Android directory something like the instructions in the AppGameKit Guide for setting up Android and not actually building in the Windows AppGameKit directories?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
wargasmic
17
Years of Service
User Offline
Joined: 15th Oct 2006
Location: UK
Posted: 16th Oct 2013 17:48
Yeah that's why I did the clean install (including copying over the IDE directory into my android directory/this is where I build the android project too) to make sure I have all the latest files.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 16th Oct 2013 18:07
Okay. I just needed to check.

As long as all your Android setup was done using the Windows File Manager, the permissions should have been correct and have allowed you to overwrite old stuff. I had had problems because I had been using Cygwin for some bits and it caused permission issues. Now I just use batch files and stay away from Cygwin altogether.

This thread has gotten a bit long. And we haven't solved all the problems.

Maybe it is time to start a fresh thread with a relevant title and list the current issues that you are still having. Make a link to this one so that some of the history of what has been done is readily available. Then, maybe someone else will be able to help.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master

Login to post a reply

Server time is: 2024-05-08 00:22:11
Your offset time is: 2024-05-08 00:22:11