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 / Really weird crash

Author
Message
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 22nd Mar 2012 16:40 Edited at: 22nd Mar 2012 16:46
I have just discoverd a weird crash in my game. I narrowed it down to this line
.

This is only done once when I load media ect.
However the game runs fine untill I pause the game, wich is a subroutine wich goes into a repeat-until loop. When I do that, windows says "islandDefenceV2 has stoped working, windows is searching for a soulution for the problem".

There is one more extremley weird thing though. After the line that crashes the game, I do this
.
If I remove that line, the game crashes imedietly once it get's to the loops wich contain this command.

Does anyone know what the problem is, how can I get rid of it?

Edit
This crash didn't occur untill I added this in the loop of the game


Edit 2:

I tested the game on my android and the game does crash, however, it crashes when I try to return to the main menu instead of when I pause the game...
Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 22nd Mar 2012 17:04
Sounds like you program is getting stuck in the repeat loop.

I take it there is more code than this in the loop;
Quote: "
Repeat
Sync()
Until Waypoint=1
"

.. and it is that code that you should be looking at.

Beyond that there's really not enough here to make more of a diagnosis.

Do you really use 50,000 sprites?
kamac
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 22nd Mar 2012 17:07 Edited at: 22nd Mar 2012 17:08
Quote: "Do you really use 50,000 sprites? "


Quite common. I guess that he has a common map and uses setviewoffset.

(Common map, because he has a little more than 200x200 sprites)

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 22nd Mar 2012 17:27
Unless you do something to update the value of 'Waypoint' that you aren't showing in your code:

there is no way for the loop to end and that sends the program into an unbreakable loop. This tends to upset Windows (and other OSs as well).

Also, is 'Speed' in 'Unit[i].Speed' a UDT (user defined type)?

Many of us have discovered problems with arrays of UDTs and setting or using values in them (usually very hard to reproduce in small code segments).

Also, do you do an initial Dim for UnitWaypoint in your main.agc file before you do whatever it is that gets you to this point?
Quote: "Dim UnitWaypoint[UnitS.Amount, UnitS.Waypoints]"


I'll bet you do, but it doesn't hurt to ask.

The pieces of code you supplied may not be telling the whole story. But I also understand that it is hard to figure out what to show when you have a big project.

Cheers,
Ancient Lady
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 22nd Mar 2012 18:13 Edited at: 22nd Mar 2012 18:23
Quote: "Also, do you do an initial Dim for UnitWaypoint in your main.agc file before you do whatever it is that gets you to this point?"


I did not, and that seems to have been the problem
Thanks for the help!

It's weird though since I have declared arrays outside the main.agc file before and it has worked before.


I do have another weird problem thoug. When I start the game, the player shuld chose wich vehicle to use, So I load the 2 images and sprites and just place them in the center of the screen using this function


When doing this it takes about 1 second per sprite on windows and 2 seconds on android And only these two sprites.

When i load the same images and allmost do the same thing in the game, the images are loaded without any delay at all

This is how I do it ingame





Edit

About the 50000 sprites. I don't use 50k sprites but since agk starts creating ID's at 10k I figured 50k would be a fitting sum
And since it dosn't seem to create any lag or anything it hasn't botherd me...
Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 22nd Mar 2012 19:11 Edited at: 22nd Mar 2012 19:12
It's the image loading which is causing the lag, check the size of the image file.

You don't do this in the second block of code.

You like the word wierd don't you

None of this is "wierd", it's just part of programming.
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 22nd Mar 2012 20:09 Edited at: 22nd Mar 2012 20:09
Quote: "You like the word wierd don't you

None of this is "wierd", it's just part of programming"


I do like weird

However when my game crashes at the same point evry time, and I remove a line of code that has nothing to do with the code that causes the crash, and the same crash still occurs but at another point in the game, I consider that weird.

Quote: "It's the image loading which is causing the lag, check the size of the image file."


It is, I just forgot to include it here.

This is what I do just before the previous code
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 23rd Mar 2012 17:00
In one of your earlier code fragments you show the definition of Function GUICreateStaticButtonBox followed by some procedural code.

I've seen elsewhere on this forum that is a very bad idea to include function definitions within code that executes procedurally.

All functions should appear in either included files or after the main loop. And there should probably be an 'End' statement between the 'loop' of the end loop and the start of function declarations.

Personally, I put all functions in include files to try to keep the main.agc file clean. If only we could put UDTs in include files at the start of the main.agc and have them apply to all files in the project. That would be very nice.

Cheers,
Ancient Lady
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 24th Mar 2012 09:43
That function is included in a separate AGC file, I just put it there to show it for debugging

Login to post a reply

Server time is: 2024-11-23 05:12:43
Your offset time is: 2024-11-23 05:12:43