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 / Game dies - no error

Author
Message
Ron2019
4
Years of Service
User Offline
Joined: 27th Jul 2019
Location:
Posted: 4th Jun 2020 01:04
A game I've been working on for months now is suddenly dying for no apparent reason. There is no error message. It isn't hitting the End statement. It isn't falling out of the Main DO loop. The screen just closes.

I've been trying to figure out where it's dying ALL day now and breakpoints haven't proven helpful at all. Is there some way to determine the very last line executed before it crashed?
Bored of the Rings
User Banned
Posted: 4th Jun 2020 05:52 Edited at: 4th Jun 2020 05:53
One way is to comment out calls to functions within the main do..loop. it's a game of deduction.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
blink0k
Moderator
11
Years of Service
Recently Online
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 4th Jun 2020 07:49
Someone just reported that a divide by zero will crash the runtime. In their case it was mod(value, 0)
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 4th Jun 2020 09:22 Edited at: 4th Jun 2020 09:24
Divide by zero doesnt cause a crash. Divide by zero will give you a warning "Integer divide by zero at line ##" or in the case of a float it will allow you code to continue with a float value of INF. Neither cause a crash to desktop. They are caught.

Specifically the use of Mod(a,0) does cause a crash. Theres no warning, error or anything else, so it is something to look for. Ive also got a couple of examples of bad data being passed to a memblock can also cause a crash with no warning.

Try using log("...") and debug mode to see where your code got to so you can find what section is causing the crash.
blink0k
Moderator
11
Years of Service
Recently Online
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 4th Jun 2020 10:09
I beg to differ.
I Have has non mod() divide by zero errors that have terminated the runtime system without warning
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 4th Jun 2020 10:38 Edited at: 4th Jun 2020 10:45
Do you have a code example of a divide by zero that causes a crash??

The result you get with a float is inf and the integer version gives you an on screen error if you have the error mode set. If you try to use inf in another function it could potentially crash but its caught with integers as an error with line number.

If you do have an example then report it so its fixed... it should be caught by agk (not just in some specific cases)

Paul claimed to have fixed the mod(a,0) bug in the last version of classic but hasnt done. Its only been 5 months...lol
Ron2019
4
Years of Service
User Offline
Joined: 27th Jul 2019
Location:
Posted: 5th Jun 2020 16:50 Edited at: 5th Jun 2020 17:58
Manually tracing the code revealed that I created an endless recursive loop with two functions calling each other. This probably produced an out of memory condition which AppGameKit is apparently unable to handle gracefully.

Login to post a reply

Server time is: 2024-04-19 05:10:02
Your offset time is: 2024-04-19 05:10:02