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 Studio Chat / iOs/Android/Win/Mac Random Crash

Author
Message
Mendo
7
Years of Service
User Offline
Joined: 13th Nov 2016
Location:
Posted: 28th Sep 2019 17:48 Edited at: 29th Sep 2019 12:26
Hello everybody,
I have a problem with mobile devices that I can't solve (after months of debugging): at random, when the main loop of the game is restarted (I repeat, not always), the App ends without any error (both iOs and Android) .
The problem occurs both with the agkplayer and with ipa and apk.
Occasionally even while trying the game in windows or mac, when the main loop is restarted, the program ends without errors.
Thanks
I attach the log file iOs.

Attachments

Login to view attachments
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 28th Sep 2019 23:49
@Mendo
Can you refrain from posting excessively large lists of unmeaningful data
this could all have been attached as a textfile with a brief description. This is exactly
the type of thread that causes forum crashes
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Mendo
7
Years of Service
User Offline
Joined: 13th Nov 2016
Location:
Posted: 29th Sep 2019 16:32
@fubarpk
ok, i re-post:

Hello everybody,
I have a problem with mobile devices that I can't solve (after months of debugging): at random, when the main loop of the game is restarted (I repeat, not always), the App ends without any error (both iOs and Android) .
The problem occurs both with the agkplayer and with ipa and apk.
Occasionally even while trying the game in windows or mac, when the main loop is restarted, the program ends without errors.
Thanks
I attach the log file iOs.

Attachments

Login to view attachments
Mendo
7
Years of Service
User Offline
Joined: 13th Nov 2016
Location:
Posted: 2nd Oct 2019 16:36
Update:

random bug on



AGC is too instable, switch on Amazon Lumberyard
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 2nd Oct 2019 16:49
Unless they've changed that recently I haven't noticed a bug with those
but I have noticed that if you delete an image while a sprite exists then
there is issues. Its documented
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Mendo
7
Years of Service
User Offline
Joined: 13th Nov 2016
Location:
Posted: 2nd Oct 2019 18:11
Thanks for the reply, but in sequence I delete:
DeleteAllSprites()
DeleteAllImages()
DeleteAllText()
I'm using the auto numbering of objects and it seems that at a certain point it goes into confusion (I create and delete many resources, about a thousand, during the main loop) and even if I try a manual deletion (recovering all the ids of the main objects and "ifexist"), at random, it crashes, sometimes on the deleteimage other deletesprite ... (ios report "the resource does not exist in that position", so agk is trying to delete an object incorrectly assigned type an id image instead of a sprite id ...)
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 2nd Oct 2019 18:30 Edited at: 2nd Oct 2019 18:38
just a thought do you have any 3D objects ?

as that will cause a problem if your deleting images

DeleteAllObjects () before deleting images will fix that

the other thing if any buttons are using images that will also error

and if you attempt to use any ID that doesn't exist anymore that will cause errors

deleting all sprites etc should only be called at the end of each level preferably

fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 2nd Oct 2019 18:50
if you could share some code someone may be able to help

im quite sure there is some form of logic error that if you shared some code or
an example of code that has the same issue its fixable.
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 2nd Oct 2019 19:04
The following demonstrates it working for me
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Mendo
7
Years of Service
User Offline
Joined: 13th Nov 2016
Location:
Posted: 9th Oct 2019 09:53
thanks for the answer and for the example.
we identified the problem as a sum of weaknesses from the mobile operating system (both) and the management of agk images.
It is difficult to reproduce the error (random), our main loop is about 15000 lines.
We are optimizing the image management, which apparently creates most of the problems with the operating system and agk (stack with a wrong memory block), using almost exclusively subimages, but this causes another problem ... ( but will they ever end?): the 2d shader does not work properly with a "normal mapping" image, but only with an image loaded with the classic loadimage method; in the help it was explained that the subimages are treated as images, but it is not so, at least for the 2d shader.
We want to load as few images as possible with atlas textures, but if the shader doesn't accept subimages, I don't see other solutions than implementing loadimage again (which brings us back to the stack problem) ...
vennis73
7
Years of Service
User Offline
Joined: 12th Sep 2016
Location:
Posted: 19th Dec 2019 22:52 Edited at: 19th Dec 2019 22:57
I also have this problem of the ClearAlImages crash.

My application worked fine until tonight.

I added sounds and music today and suddenly IOS crashes. Windows has no problems.
I added logs and it seems DeleteAllImages() causes a hard crash on IOS.

I tried to debug but also without loading sounds/music it crashes.

I'm thinking it might has to do with the latest release (17th dec) since i didn't had this issue before.
So either it has to do with sound/music or it's just a new thing (from my point of view).


Edit: I thought i had a workaround, same issue.

workaround same issue
i ended up to store the last imageID and just manually clear it. It's not pretty but for now it works.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 19th Dec 2019 23:03
@vennis73

is it possible you are deleting an image that is being used at the time
for example if you have a sprite on the screen and then delete all images
you will get problems. The same if you delete an image that a 3d object
is already using.

deleteallsprites
deleteallobjects
deleteallimages

in the above will work if done in that order
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
vennis73
7
Years of Service
User Offline
Joined: 12th Sep 2016
Location:
Posted: 19th Dec 2019 23:35 Edited at: 19th Dec 2019 23:37
@fubarpk

I'm 2D only, so just sprites, images and particles atm.
The ClearAllObjects isn't really required.

At this moment i manually created a list of sprites and images that should be deleted using wrappers


result after two runs (seems really random)
Sometimes i can do it successfully but the 2nd cleanup alway fails

LogeleteImage 100045
LogeleteImage 100046
LogeleteImage 100047
etc...
LogeleteImage 100480
LogeleteImage 100481
*CRASH*

after another run
LogeleteImage 100143
LogeleteImage 100144
etc..
LogeleteImage 100186
LogeleteImage 100187
*CRASH*
vennis73
7
Years of Service
User Offline
Joined: 12th Sep 2016
Location:
Posted: 19th Dec 2019 23:49
@fubarpk

Something weird happens

My cleanup function



My log, the weird thing is around sprite 100611 it switches to image.

fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 20th Dec 2019 01:42 Edited at: 20th Dec 2019 02:35
what happens if you swap ClearAllSprites() for deleteallsprites()

both of your functions can be replaced with
DeleteallSprites()
DeleteAllImages()

but if you insist on doing it that way

the above logic should work but perhaps it should be length-1
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Qugurun
Valued Member
9
Years of Service
User Offline
Joined: 8th Dec 2014
Playing: AppGameKit
Posted: 20th Dec 2019 03:10 Edited at: 20th Dec 2019 03:25
You delete the sprite and image but not the cell in the table, information is still stored there. You need to add "remove"

Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 20th Dec 2019 11:17
Quote: "You delete the sprite and image but not the cell in the table, information is still stored there. You need to add "remove""


He doesn't need to do that as he is deleting the the whole array after....all the entries are removed at once after deletion

Line 31: gfxCleanupImages.length = -1
Line 42: gfxCleanupSprites.length = -1

vennis73
7
Years of Service
User Offline
Joined: 12th Sep 2016
Location:
Posted: 20th Dec 2019 12:02 Edited at: 20th Dec 2019 12:03
@fubarpk

i created ClearAll functions because DeleteAllImages crashed. It was a test if it would be a workaround. But it crashes too on DeleteImage on some random (seems to be) point.
I used DeleteAll till yesterday

I wanted to show you that deleting images at some point just crashes, i check the existense of the image before deleting so it should be a valid deletecall.

Quote: "is it possible you are deleting an image that is being used at the time"


If an image is in use, like in a sprite, and deleting should not be possible (IMHO), then Delete should throw an exception, i don't know if it works like that but i don't think it should just crash out without error.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 20th Dec 2019 16:46
Quote: "If an image is in use, like in a sprite, and deleting should not be possible"

true it is still a problem which was reported and I believe fixed some time ago but may have cropped up again

but if there is a button or sprite etc that's still using the image that might be why your having the problem and
would atleast allow you to fix the logic of your code and make it work

On windows it shows both the button and the sprite as white
as the image is gone which I still suspect is the problem with your code
but there has been xcode changes so that might explain why but if the below
code crashes on your machine that gives paul an example and also shows
what yours is perhaps doing

try this
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
vennis73
7
Years of Service
User Offline
Joined: 12th Sep 2016
Location:
Posted: 20th Dec 2019 20:03
@fubarpk i tested you code, this does not crash, it shows the white sprite.

I'll try analyze my own code and try to reproduce it in a small piece of code.
vennis73
7
Years of Service
User Offline
Joined: 12th Sep 2016
Location:
Posted: 20th Dec 2019 21:09
At some point i got my windows app also crashing. I found some info back in the EventLog
The attached file contains an information event, the error event and the related error file.
I doubt it's any use but maybe you can read it better then i can.

I tried to create a small program to reproduce the issue but i couldn't reproduce it yet. I'll try later again.
It does just seem to be clearimages that causes the crash. maybe it is something like a relation or the amount of images that causes trouble

My program uses images and sprites quite intensive.
I create images, i create basic character sprites with them with animations
and then clone those again into instances. But i do clearsprites first and then clearimages.

For now, i created a workaround by caching images and reusing them instead of reloading them.
Using this i don't get any crashes anymore so far.

Attachments

Login to view attachments
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 21st Dec 2019 00:50 Edited at: 21st Dec 2019 00:51
Glad you got it sorted

Perhaps you were deleting an image that was deleted previously and a combination of some memory leak or perhaps some other issue
atleast you have it working now. It helps sometimes if you can recreate the problem in a small example code atleast we know the delete
image isn't a problem and Paul can enjoy his much deserved time off over Christmas break

if you still have problems share the code with someone else who can test it, that always helps particularly if you can recreate the problem
in a condensed version of your code
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
vennis73
7
Years of Service
User Offline
Joined: 12th Sep 2016
Location:
Posted: 21st Dec 2019 08:50 Edited at: 21st Dec 2019 08:51
@fubarpk,

i really don't expect anyone to interrupt his holiday for me or my problems! really don't, enjoy your holiday!

Quote: " atleast we know the delete image isn't a problem"

I don't agree with this but it's not my call. I personally think the ClearImages and DeleteImage should never cause any blunt crash in a programmer-friendly tool like AGK. i can't catch exceptions so AppGameKit should do that for me. it really should throw a controlled exception in the log and exit.

But i do understand, without a good example you guys can't do much. So i'll try to give you an example you can work with. Even if it turns out to be my own fault by doing something stupid, it might help us all to see if we can prevent the crashing.

But if i'm the only case then don't break your heads over it. The imagecaching works for now and it's for me to give you guys a good example.

Thanks for the help so far!
vennis73
7
Years of Service
User Offline
Joined: 12th Sep 2016
Location:
Posted: 21st Dec 2019 10:47
@fubarpk

see attached zip

I think i been able to recreate the problem. It only happens if you have a lot of sprites and images.
I rougly recreated the structure i use to create/manage sprites. The memory of the process doesn't seem to be extreme.

The amount of sprites seems to have a tip-over point. maybe that differs on OS/systems

Some background on my choise of structures:

On game initiation i create 'characters'
- load and xml file with character data (animation images and properties like animationspeed etc)
- i create a 'character-struct' for each character type
so i got a 'enemy01' with it's walking sprite, stand sprite etc.
and an 'enemy02' with it's own walking sprite and

- when starting a game, i create enemy's. these enemies are structs that are based on the character-structs
basically i clone the character-struct into the enemy-struct-instance. So i create like 10 enemies all of type 'enemy01'

Maybe i'm asking too much or should use another concept but this is as it is atm.


Attachments

Login to view attachments
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 21st Dec 2019 11:53
the problem isn't where you expected the problem is with these 2 lines
aBigTest.sprs1 = aTest
aBigTest.sprs2 = aTest

you need to insert these values the above is logic madness

il have a go a bit later at rewriting it but if you comment out those lines I show above it works perfectly
indefinately
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
vennis73
7
Years of Service
User Offline
Joined: 12th Sep 2016
Location:
Posted: 21st Dec 2019 12:01 Edited at: 21st Dec 2019 12:48
@fubarpk i know this doesn't make sense in this test, i just had to simulate roughly how things work.



Isn't this just putting a copy of aTest into sprs1/sprs2 ?
Should i walk through the array and copy each element loose ?

Copying a array of data to another array of same type is not madness ?

Edit:

I don't the that part is the issue, if i do it like this it still crashes.


Edit2:

Also the crashing is in cleaning up images. These are just integer/string arrays/structs. They contain no images or sprites. Just a bunch of integers.
I doubt these datastructures are the problem. It's in either the number or complexity of the images/sprites that are created.

fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 21st Dec 2019 12:17 Edited at: 21st Dec 2019 12:18


but how you had it you cant copy it accross to all of the elements it has to be done a part at a time from my understanding or using insert
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 21st Dec 2019 19:52 Edited at: 21st Dec 2019 20:08
the main changes


my complete solution


the problem being aBigTest was type ArrayOfSpr while aTest was SprStruct[] mismatching types with the equals operation
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
vennis73
7
Years of Service
User Offline
Joined: 12th Sep 2016
Location:
Posted: 22nd Dec 2019 21:32
@fubarpk thanks for the effor lookin into this.

In your sample

This doesn't do anything. Its like "for num = 60 to 0"
the spr vars are empty after this, and then the crash isn't triggered (seems really a relation to the number of arrays or something).

I think just

is the result we wanted right ? just to create more mass. And then we get a crash again.

I still don't understand whi it crashes when we add some more arrays of structs that do not contain images or sprites themselves. They just contain integers.
Why would DeleteImages crash if we add some structs that are not directly related to images or sprites ?

fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd Dec 2019 21:53
The problem is aTest is of type sprStruct and aBigtest is of Arrayofspr type which consists of sprStruct arrays
they are all size varying arrays

you could always simplify it by removing
sprs1 as SprStruct[]
sprs2 as SprStruct[]
out of the arrayofsprite

but otherwise it kinda needs to be how I had it

fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
vennis73
7
Years of Service
User Offline
Joined: 12th Sep 2016
Location:
Posted: 22nd Dec 2019 22:03
i didn't do
aBigtest = aTest

i did
aBigtest.spr1 = aTest

And spr1 and aTest are the same types.
I don't see how it is a problem that spr1 and spr2 are part of a structure themself. IThis seems a total valid construnction to me, and it is, because that copy itself works fine.
That DeleteImages crashes seems related to the amount of structures or something. Or maybe some bug in memory handling in copying structures or references (deep inside AGK).

But beside this structure thing, i don't see how this is relevant at all to DeleteImage crashing since they don't contain images.

Login to post a reply

Server time is: 2024-04-25 02:11:20
Your offset time is: 2024-04-25 02:11:20