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 / Android APK fails to load on first run beta 19

Author
Message
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 29th Oct 2013 00:30
We're doing a bit of alpha testing and we've noticed that about 50% of the time that after the app is installed it will not load. You have to exit the app to the home screen and then return to the app.

I've tried this under a number of scenarios:
With and without modification to main.c to remove keep wake
Downloading the alpha from Google Play
Installing it from Eclipse
Installing it as a built APK via sdcard transfer

I added a couple of sync() calls to the beginning, but that really hasn't helped.

Does anyone have some suggestions? We plan to go to production in a few short weeks and I'll be pretty sad if people can't run my game on the first try.

The only things that are done at start up are tiling a background (probably 100 sprites), loading a data file (so far none too big < 1mb) and then you go to a log in screen. All I get when this happens is a black screen until I go to the home screen and return.

This is happening on Nexus 7 (android OS 4.3.3), HTC Droid Incredible 2 (2.3.3) and Motorola Droid X (2.3.?)

All suggestions are welcome.
Thanks!!

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 29th Oct 2013 01:46 Edited at: 29th Oct 2013 01:50
i use sync() also to say "hello i am alive" to the os between long delays.
big images aka 1024x1024 png take a while until its loaded.
in one game i use a rotating sprite as feedback.
maybe do your loading etc. beginning from a button click, you can see what happens.
i using the online apk creation tool without problems.
i believe the problem with data files was that it was loaded from apk direct or something that was slow. just make a progress bar for it.
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 29th Oct 2013 03:47
I really don't think it is a load time issue.
I've added some indicators to tell me though and will find out a little more tomorrow.
The reason I don't think it is a load-time issue is because it only happens right after you install it.
If I go and kill the process and open the app fresh it loads up fairly fast (maybe half a second delay). Also I can see the app is starting fresh because it goes through the login procedure.

On these first runs it does not appear to do anything...

Just for reference, how many lines of code are you using?

I'm starting to think this is a project size, my bytecode file is a whopping 20MB
I have no idea what is making it so huge!
It seems like every line of code makes the bytecode file size increase by a KB.

I've go about 20k lines of code... The total game media files are only 2.37MB

Maybe I'll try rolling back to an older beta to see what the size is. Oy...

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 29th Oct 2013 08:41
don't now the lines of code yet.
my bytecode is ~ 1-2 MegaByte with beta 19.
3d point in space
14
Years of Service
User Offline
Joined: 30th Jun 2009
Location: Idaho
Posted: 29th Oct 2013 12:03 Edited at: 29th Oct 2013 12:15
How much data are you loading at first, my weather application did a similar thing where I loaded all the zip codes at first, but that crashed the application. So I changed it by switching loading the data by state. This is because I was loading over a 100,000 zip codes at the first of the game.

And if you are loading a tiled background I am loading the levels with the agk load command to tell the user the x and y cords as well as the frame the sprite is currently at. Of course I have a engine my game engine I made that helps me with this. i use tiled too but I actually only use the data and make a agk save file then load it into the game. I also only load the levels when I need them then erase them after there done this keeps the arrays small.

I currently load the zip codes the falling way. I get the user input and if the zip code falls in that range it loads the states zip codes.

Developer of Space Chips, pianobasic, zipzapzoom, and vet pinball apps. Developed the tiled map engine seen on the showcase. Veteran for the military.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 29th Oct 2013 12:32
just a idea, did you use a anti virus software at all your 3 devices,
maybe this prevent the app from starting.
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 29th Oct 2013 14:27
No anti-virus
Data file at load during these black-outs is zilch as the user data file has not even been created yet.
Images at load:
3kb background tile - loaded once and cloned as a sprite approximately 100 times
31kb font image
7kb icon
3kb separator image
3kb button image
The rest of the sprites are null images and at load there is only one of those.

The images above are encrypted, so the entire image is loaded to a memblock, saved to a file, loaded as the image, then the file is deleted.

Looking at the Android logs I see the process start, then 12 seconds later there is a force finish of the app NativeActivity, then WIN DEATH. I then reload the app and it works fine for a while and then randomly gets force stopped.

Does someone have a fairly large project (bytecode > 15mb) that they can test out on android with beta 19 to see if they have similar results?
I see a lot of force finishing of the NativeActivity...


I'm now looking at the logcat in Eclipse and I see that it stops with a red message saying:
Video Set Dimensions X:0 Y:0 Width:800 Height:1205

As soon as I switch out of the app and back in it says Gained Focus.
And things run fine for a time.

I'm attaching the logcat log and the jellybean log report. Maybe you guys can see something. I certainly can't!

I'm letting the app run for a bit with debugging on to see when it will crash.

Attachments

Login to view attachments
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 29th Oct 2013 15:31
i believe the NativeActivity means the commands used from interpreter core. try to find the part that did cause the crash.
you can easy remark blocks with
if 1=0
...
endif
then concentrate at this part and examine in detail.
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 29th Oct 2013 15:41
Unfortunately that might be the only thing I can try.
I don't think it will help though, because the game loads just fine on the second run or if I simply leave to the home screen and return.

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 29th Oct 2013 16:33
i am sure you find the reason if you exclude part for part.
alternative you can read the source very accurately and simulate the app in mind.
maybe your file will be extract after first access in apk
and then you have no error after the second start.
what happens if the file not in apk and only in user docu path?
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 29th Oct 2013 16:40
I have found that sometimes opening something from the display showing that it has been installed doesn't work well. I am not sure if I have seen this with anything other than AGK. It doesn't happen when I install and run from Eclipse, only when I install from an APK file.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 30th Oct 2013 16:36
So I added in come check points and have found that when I get this black screen issue the app is not even getting past the includes or constants or types...
So this has got to be a bug. I really don't want to release a game that might not load after install.

I also tried NOT running it directly from the installation dialog and it still behaves the same way.
It seems to happen more often on the Android 2.3 devices.

I also think this is related to getting a black screen when your device resumes from sleep or the screen being off.

Next up I'm going to try monkeying with setting a sync rate and then un-setting it to see if it helps.

Like AL, I think I have only experienced this with AppGameKit apps.
I'll try to pay attention today to see if it does it when I install from Eclipse, unfortunately I can only do that for one of my 2.3 devices.

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 30th Oct 2013 19:24 Edited at: 30th Oct 2013 19:25
and the windows agk player have no problem with the same bytecode?

Quote: "and have found that when I get this black screen issue the app is not even getting past the includes or constants or types..."


that seems the compiler do strange things.
but if the bytecode is damage the app can't start at the second start.

from first start until you will see anything you have no longer delay
than a second without at least one sync() ? means minimum one sync each second.

AGK 108 B19 : Windows 8 Pro 64 Bit : AMD Radeon HD 6670
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 30th Oct 2013 19:34
Compile and run in windows works just fine 100%

Quote: "that seems the compiler do strange things."

But this is a built APK, it should just be the interpreter which I'd imagine doesn't do much of anything with includes because they're already in the bytecode. I dunno.

I'm not sure I understand you last question.
If the app actually loads on the first run then I only have maybe 100 milliseconds before I see some of the sprites. Same thing on future loads. The app is pretty light on data load so it typically loads very fast (at least to the point of where I can tell it is loaded and starts checking the my server for data).

I might try the prebuilt interpreter tonight to see if that has any effect.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 30th Oct 2013 19:48
I mistakenly posted this in the wrong thread:

I have just tested installing an apk from the downloads directory on four different Android devices. Two of the apks were built using the export option in Eclipse, the other two were just compiled and 'run' in Eclipse and the new apk file copied to the target device.

In all cases, I told it to open immediately upon installation completion and there was no problem.

However, in each case, it was installing over an existing version of the app.

So I uninstalled the apps and made sure the data directory was gone (for the Android 2.3.3 device) and installed fresh from the download directory.

On my Philips GoGear Connect 3.2 Android 2.3.3, it crashed with a messge saying something about the app not responding when started directly after installation using the 'Open' button. Then ran fine when started again. But I didn't get a black screen, it actually made it to the login screen (for new user) which is after the loading screen (image with status bar). So the issue isn't the same.

The Android 4.+ devices behaved properly when I used the 'Open' button on a clean install.

My Nexus is Android 4.2.2, the Samsung Galaxy S III is Android 4.1.1 and the Toshiba 7" Thrive is Android 4.0.4.

Of course, I am working in Tier 2. So that might be a major difference.


I don't have an Android 4.3 device to test this on.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 30th Oct 2013 19:52 Edited at: 30th Oct 2013 19:53
did you try to compile the interpreter core (agk player) by yourself?
(i had done this once but now i am happy with the online apk tool.)
did you verify in eclipse u use the last interpreter version ?
and what happens if you create a apk with this online tool?
https://developer.thegamecreators.com/android/create_apk.php

i believe it is in relation with your project (or settings) in ecplise.

build and broadcast is also no problem?

AGK 108 B19 : Windows 8 Pro 64 Bit : AMD Radeon HD 6670
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 30th Oct 2013 19:52
Yeah I imagine T2 will show much different results.
I think it has to do with the bytecode size.
Once I am ready for production I'll be able to reduce the bytecode size quite a bit as I can remove all of my debug lines.
Though if that is not the issue...

I do know that it still exhibited this hang issue when the data directory existed on 2.3.

I wish someone had a T1 project that was around 20mb that could tell me what they see.

Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 30th Oct 2013 19:55
@Markus
I'm compiling my own interpreter.
I am definitely using the correct version.

I tried the online one a while back for this project and the APK wouldn't load at all. I've had fine success with smaller projects I've uploaded. I see there's been some changes, so maybe I'll give it a shot again too.

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 30th Oct 2013 20:01 Edited at: 30th Oct 2013 20:02
with compile i mean somethink like this. , you mean the same?

cd f:\compile
cd apps
cd interpreter_android

/cygdrive/f/android-ndk-r6b/ndk-build NDK_PROJECT_PATH=/cygdrive/f/Compile/apps/interpreter_android clean
/cygdrive/f/android-ndk-r6b/ndk-build NDK_PROJECT_PATH=/cygdrive/f/Compile/apps/interpreter_android 2> log.txt

/cygdrive/f/android-ndk-r8d/ndk-build NDK_PROJECT_PATH=/cygdrive/f/Compile/apps/interpreter_android clean
/cygdrive/f/android-ndk-r8d/ndk-build NDK_PROJECT_PATH=/cygdrive/f/Compile/apps/interpreter_android 2> log.txt

AGK 108 B19 : Windows 8 Pro 64 Bit : AMD Radeon HD 6670
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 30th Oct 2013 20:06 Edited at: 30th Oct 2013 20:08
Nope, I didn't know what you meant
I get no problems when I compile with cygwin
Or at least everything looks fine in the log and I watch everything in a command prompt window to make sure it's ok.

EDIT (adding the cygwin compile log)
just some warnings, but they seem to always be present:


Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 30th Oct 2013 20:58 Edited at: 30th Oct 2013 21:00
i remember i heard the long bytecode comes from old api version,
because if you use 2.3 it will run on new devices also.
if you use a newer android api version only,
your bytecode should be much smaller
but then you can test only your 4.x device but maybe you have
no problem after install and run.
i saw the api you can change/set in exclipse project.
i wrote because you think the problem belongs to the size of the bytecode file.

AGK 108 B19 : Windows 8 Pro 64 Bit : AMD Radeon HD 6670
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 30th Oct 2013 21:08
How does changing the API change the size of the bytecode when the bytecode is generated by the AppGameKit compiler? I'm confused.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 30th Oct 2013 21:11
Quote: "How does changing the API change the size of the bytecode when the bytecode is generated by the AppGameKit compiler?"

I don't think it does.

But the API version does affect the size of the apk file that gets created.

I also rediscovered why I don't like to run directly from installation using the 'open' button. While the app runs just fine, when you exit it (it does have an exit button), it immediately starts back up again. This doesn't happen when it is started from the app icon.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 30th Oct 2013 21:13
The APK is only 7mb... not too worried about that.

I've also noticed the app will restart when exited as you describe. Not sure if I've ever seen that with other apps, but I don't really sideload apps...soo...

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 30th Oct 2013 22:43
ohh, i mistaken with apk, sorry.

AGK 108 B19 : Windows 8 Pro 64 Bit : AMD Radeon HD 6670
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 30th Oct 2013 22:50
No worries
The APK is running around 7mb which is almost 4mb smaller than my last game, but my last game had a lot more assets.

Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 2nd Nov 2013 01:33
Just tried the online builder for this project. Like before, the build will not install. The process from the page appears to be fine and everything is present (bytecode renamed, correct PW for my keystore, etc, etc). I've had no problem making an apk with the online tool for smaller bytecode projects. I've used it all successfully with Eclipse. The media directory is 23.4MB uncompressed and 2MB compressed (lots of nulls in that bytecode file!).

I'm going to give the prebuilt interpreter a chance and see how it goes.

Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 2nd Nov 2013 02:02
OK! I've got some interesting news this time. I used the prebuilt interpreter and watched the logcat at load for the 2.3.4 device. The logcat is VERY different for the 2.3.4 device than it is for the Nexus 7 (4.3.3)
In logcat I get a whole bunch of File 0 does not exist errors and then it finally gets to "Failed to load image media/cfbgtile.png" and then "Failed to load image media/Missing.png"
Now I know for a fact the cfbgtile.png is there.
So, what I'm guessing is that the app is initiating and looking for those files faster than they are being transferred out of the apk and into the directory.
I wonder if this is related to AppGameKit moving the media folder assets to that lovely AppGameKit directory on the SD card...

Next step I'm going to try to add a short delay to the app before it tries to load any files on the very first run. We'll see how that goes.
This, in my opinion is definitely an AppGameKit bug and should be addressed.
AL - should I report it? I don't have much support on this one as it seems to be OK for other folks, but no one has a large project to test with.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 2nd Nov 2013 02:19
It does sound like an AppGameKit issue. It may be Android version and device dependent, based on how fast they unzip the APK.

Can you share your startup code, up to the point where it is trying to load the indicated image?

The AppGameKit Missing.png (and other files) are generated dynamically upon startup and then removed upon exit in the Documents\AGK\<appname>\media directory for a Windows app. I don't know if the same is done for Android and iOS. Or whether they are created once in the app sandbox area when the app is installed and run for the first time and then left there.

The trick with reporting a bug is for someone else (a CT and then someone at TGC) being able to produce the same error.

Can you do the Eclipse run again and store the logcat output to a file and upload it?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 2nd Nov 2013 02:38
I can't share the code, unfortunately that is right where my decryption starts.
I think on Android, at least 2.3.4, AppGameKit leaves all of it's default stuff in the folder. Also when you uninstall AppGameKit is kind enough to leave behind all of the files the app has written to the sdcard/AGK/ directory.

I'll get you the full logcat log tomorrow.

Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 2nd Nov 2013 05:11
So we just had another fairly rough night of testing... The app seems to crash a lot around the time internet connections are being closed / deleted. I just looked through the Android bug report and there are frequent "fatal signal 11" and "fatal signal 8" issues which seem to be much deeper than I can figure out. I completely re-wrote the connection handling in the game last week to slow it down a bit and attempt to make it more stable, but it's really not changed much other than now it is slower as intended.

Is there some way yo get these logs over to someone at TGC to take a look at them? The app shouldn't have random crashes like this that aren't caught by the interpreter.

Next step for me is to try to roll back to an earlier AppGameKit beta.
We really need some help. I'm starting to get very depressed.

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 2nd Nov 2013 10:01 Edited at: 2nd Nov 2013 16:15
about "does not exist" at start this two commands can help you theoretical.
GetFileExists
GetFileSize

AGK 108 B19 : Windows 8 Pro 64 Bit : AMD Radeon HD 6670
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 2nd Nov 2013 15:57
Naphier, you can post the logs here and request someone at TGC look at them.

Or, open any thread that has a post by Paul (like this one) and use his EMAIL link to send him the log with relevant information.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 2nd Nov 2013 16:30
@Markus - good suggestion, that was my thinking too. I added code last night to simply check to see if my saved data file exists on the device. If not (which indicates a first run) then I wait a little bit before trying to load anything. The only issue with that is that if they reinstall on a 2.3 device AppGameKit leaves the data file on the device, so reinstalls might still see an issue, but I can live with that over first time users. I also have version checking in place to insure the data file and app is of the correct version, so I think I'm well covered there.

The crash is an immediate "Wordspionage has stopped responding" dialogue and then I'm kicked out to the home screen. A lot of times the app will immediately restart or if I go back in it will be in the exact state before the crash.
I've bumped up the connection reset timer (where I wait for current request - if any - to finish then close/delete and create a new connection) to 10 minutes instead of 3. Game runs great on Windows...
When I look at the logcat around the times of those crashes I'm seeing those fatal signal 8 and fatal signal 11 errors which (from my light research) indicate that there is a problem with how the C++ code was interpreted(?) by the NDK. And this is happening with the prebuilt interpreter as well as the one I've compiled with Cygwin.

I ran a long test of just my connection handler through the AppGameKit Player last night and it was quite stable. We also had a really odd issue on my wife's Nexus 7 where it crashed and then started running an older version of the app. All I can do is suspect that it was not uninstalled fully, but with the same package name you would think that Android wouldn't have had that issue. It was very strange and ended up causing some data corruption for the current game session we were playing.

I've been running the app on my Nexus 7 and HTC dinc2 for a few minutes through the AppGameKit player. It's running fine on the Nexus, but only a couple of minutes on the player and it crashed - no message, just POOF out to the main screen. The game had finished getting the turn info from the server and was in a state where nothing but server checks were happening. An async request had just been sent out and was being checked 200 - 500 milliseconds later. Returning to the AppGameKit player after crash shows a black screen unfortunately no logCat info since the debug flag must be off for the player. One thing I wonder here is: on 2.3 devices AppGameKit is writing to the SDcard. I think what might have happened here is that the device was connected to my computer via USB as a disk drive. I've noticed the HTC dinc2 doesn't handle the sdcard well when it is connected to a PC as a disk drive (it often says it can't find installed apps - ones that have been moved to the sdcard).

Anyway I'll try to get some logcat info today so I can share it.
Thanks for the support, you two

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 2nd Nov 2013 17:25
Quote: "stopped responding"

seems there is a endless loop.
are you sure at connection loss your data poll exist?

Quote: "but only a couple of minutes on the player and it crashed - no message, just POOF out to the main screen"

maybe the memory runs full,
or do you free something and did not clear a variable too (old/wrong/ invalid handle/id).
there a some useful commands at "Benchmarking"
http://www.appgamekit.com/documentation/Reference/Benchmarking.htm

AGK 108 B19 : Windows 8 Pro 64 Bit : AMD Radeon HD 6670
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 2nd Nov 2013 17:42
If it's an endless loop then it sure does stop fast, could be it is something in a thread that is behind the scenes with the interpreter.

Quote: "are you sure at connection loss your data poll exist?"

I'm not sure what you're asking -- the issue's not necessarily happening at connection loss it actually looks like it is happening when a new connection is created.

Check out this snippet from the bug report I just got off of my Nexus 7 while running the game via the AppGameKit player:


I'm not sure what (AGK::cHTTPConnection::SendRequestInternal()+560) is, but that's the last thing that happened. I imagine it is an HTTP async request.
Full report attached (is this the same thing as a logcat report becuase it sure does look like it?).

Attachments

Login to view attachments
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 3rd Nov 2013 09:04
hmmm, did you use only Multiplayer commands or HTTP commands too?
can you describe your network logic in your game?
if you write also a log you can compare/find the belonging entrys by time
in this bug report you showed.

AGK 108 B19 : Windows 8 Pro 64 Bit : AMD Radeon HD 6670
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 3rd Nov 2013 10:26
That looks like an attempt either to access a memory location on a non-aligned address, or an attempt to dereference a null pointer, or an pout-of-memory error.

What could the 560 be in that call. Are you using a string literal in the network call, or a variable?

-- Jim - When is there going to be a release?
ThrOtherJoJo
12
Years of Service
User Offline
Joined: 24th Mar 2012
Location: California
Posted: 3rd Nov 2013 11:25 Edited at: 3rd Nov 2013 11:29
I'm also experiencing this black screen when loading images.

I'm working in Tier 2 and I'm also using v108 beta 19;, and what I'm doing is loading graphics for the menu and then when it's time start the game, I'm deleting the menu graphics and loading the in-game graphics and menus.

Next, when I leave the game, I delete the in-game graphics and reload the main menu graphics. It's at this point I get a black screen with my debug information. So what I try to do is advance through the menus in hopes that the graphics will load but to no avail.

I then, exit the app and restart and everything works fine. This black screen doesn't pop up all the time so it's makes it very hard to track down what the problem may be.

In compiling the apk, I go to Cygwin, then in eclipse, I do a refresh and the Run the application on the device. Eclipse installs the apk on the Galaxy S3 and runs the game.

I wasn't really worried about the black screen in this stage of development, I figured I will get around to it later, but when I saw this post mentioning the black screen, I decided to say something.

Here is the function I call each time I'm loading graphics.


When I call this function, sometimes the graphics don't load but the game is still functional.

Joeisms
KG2Entertainment.com
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 3rd Nov 2013 17:23
@Markus - It's all HTTP commands and SendHTTPRequestAsync. No multiplayer commands. The logic is basically a single connection.
If connection not open Create the connection
SetHost and SendRequest <branches through 3 different pages>
Check for response every second
If the connection has been open for more that 5 minutes then wait for a response and close when ready, then delete connection
Repeat <check next page>
If I change game state (going from the home screen to an actual game board) then I abandon the current request by waiting until it responds, resetting its variables and then closing it. I also call this abandon code whenever I want to send a specific single request such as the player making a move.
When I run my standalone test driver for this it ran just fine. So it seems to me that it's not the connection commands on their own. It could be that the memory accessed by the http commands is getting crossed with something I'm using in game, though since in T1 I really have no control over this. I'm working on removing some reliance that I have on a few arrays that are not completely necessary. When I compare my log it is at this point that the app dies. Here's the code for that:

I'm not sure hot to make that any safer. Also, the crashes are not always happening at this point. It will just be some times around calling any of the http commands. I'll put in some more logging to see if I can pinpoint it.

@Jim - I've no idea what the 560 could be. String constants are used for the page names, host name, host user and password, https is off, secure is on... the only variables in the connection commands are the connection ID and the post data.

@TheOtherJoJo - I've not had any issues after the very first initial run of the game yet. Try adding some sort of timed pause to that code and see if it helps. Also, try to purposely load a non-existent image file name to see if you can force AppGameKit to load its missing.png file. Maybe there is something wrong with that file and when AppGameKit simply goes to look for it a problem occurs. In my case nothing is functional. It stalls utterly until I go to the home screen and back in.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 3rd Nov 2013 18:56
This bit of code could get you stuck in a loop if there is any issue with the connection:


You really should have the code checking for a timeout situation so that it doesn't stay in this loop forever if there is an issue with actually getting a response.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 3rd Nov 2013 18:58 Edited at: 3rd Nov 2013 19:02
i whould use GetHTTPResponse only if GetHTTPResponseReady return =1
not at -1 because it's failed.
at this you can add a line to prevent future use.
if con.ID > 0
CloseHTTPConnection(con.ID)
con.ID=0
endif

@AL
i think GetHTTPResponseReady should return -1 at any problem
but i can't promise.

AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 3rd Nov 2013 19:14
@AL - good call on the timeout. Thanks! I've got a timeout in my "WaitForHTTPResponse", but not in this function.. could have caused an issue someday there (although GetHTTPResponseReady has it's own timeout handling -- we have seen that not work well before).
@Markus - good call too . That's the way I'm handling it in the main connection handler, but no in AbandonConnection... Maybe calling that GetHTTPResponse on a response ready of -1 was what happened and some weird junk was put into the string that caused a memory issue. I've added that code in so if it stops happening then we'll never know!

Thanks , guys.

ThrOtherJoJo
12
Years of Service
User Offline
Joined: 24th Mar 2012
Location: California
Posted: 4th Nov 2013 19:18
Quote: "@TheOtherJoJo - I've not had any issues after the very first initial run of the game yet. Try adding some sort of timed pause to that code and see if it helps. Also, try to purposely load a non-existent image file name to see if you can force AppGameKit to load its missing.png file. Maybe there is something wrong with that file and when AppGameKit simply goes to look for it a problem occurs. In my case nothing is functional. It stalls utterly until I go to the home screen and back in."


Ok. The problem seems to be my images because when I loaded a non-existent image the AppGameKit missing file image still showed up even when I got the black screen where my image is suppose to load which is 960x640 png image.

I need to check the file properties of my images once I get home.

This issue doesn't show up on the PC.

Joeisms
KG2Entertainment.com
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 4th Nov 2013 19:20
@ThrOtherJoJo - I've had issues with jpg on Android a couple of times. Just opening them in photoshop and resaving them worked. I'm not sure what the deal was. Good luck

Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 5th Nov 2013 14:42
So we ran the game last night for about an hour with not a single random crash. All I can think is that it was the call to GetHTTPResponse when the response ready was -1. I'll try to remember to set up a test for that later so I can report it if it is a bug/unsafe practice. I'm so very happy about this. Thank you Makrus and Ancient Lady for sticking with me and helping out!


We still do have some issues on first load. Sometimes the app will start in around 30 seconds, sometimes it just doesn't start and stalls at a blank screen. I added code that causes a short delay if it is the first run, but that didn't help much. I'll try some more things tonight.

Here's the code I've inserted right after my includes/constants/types declarations.. there's also a goSub up there... maybe I'll try removing that to just be the code as I now have folding in Sublime Text.


I'll report back later once I try removing the goSub

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 5th Nov 2013 15:12
I am almost always happy to help (some days I just hate computers or the world and am not fit for helping) and am glad you got it worked out.

You only need to do the SetPrintSize call once. Unless you are using that as a sort of time chewing function.

Happy Programming!

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 5th Nov 2013 15:14
It is only used once. This isn't a loop itself, but the TimedPauseSync() and TimedPause() functions are the loops.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 5th Nov 2013 15:33
Right, I misread (don't have my computer head on just yet this morning).

Might it not be more time efficient to do a 'while' loop that keeps going until the file is there? That way it ends as soon as possible or waits as long as necessary.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 5th Nov 2013 15:36
No because the file isn't generated until after you enter login credentials. I could write it with a single byte or something, but I don't see how that would help as the creation of this file is not causing the hangup.

Login to post a reply

Server time is: 2024-05-20 10:39:38
Your offset time is: 2024-05-20 10:39:38