GameMaker: Studio

GameMaker: Studio

View Stats:
TheEngiGuy Apr 16, 2014 @ 6:05am
Urgent: "game has stopped working" after a few mins from testing
Hi, I made a very simple game which I have to click on moving objects to increase score, while 2 other objects appear on the screen after a while.
It was all good, no problems, but after I finished the game and decompiled it, it just keeps crashing after very few minutes of gameplay, with the usuale "has stopped working" message. Why?

This is really frustrating to me especially since it was working fine.
Any help would be really appreciated!
Last edited by TheEngiGuy; Apr 16, 2014 @ 6:48am
< >
Showing 1-11 of 11 comments
Phil Strahl Apr 16, 2014 @ 6:30am 
Sounds like a memory leak of some kind. Have you tried running the game in debugging mode? And what do you mean exactly when you write "after I finished the game and decompiled it"?
TheEngiGuy Apr 16, 2014 @ 6:47am 
Yep, same problem in debugging mode.

Also sorry, I meant that I've completely developed the game and compiled it as an .exe application.
Last edited by TheEngiGuy; Apr 16, 2014 @ 6:47am
Phil Strahl Apr 16, 2014 @ 7:27am 
Ah ok, thanks for clearing it up. Well it could be a number of reasons and really hard to pin down, even when you know the game by heart. My suggestion would be to keep a close watch on the fps-count, because (usually) before a crash the performance gets real ugly. If that's not the case then there might be just an asset file corrupt, so try cleaning your build (F7) before compiling if you haven't done so. Also Dropbox could be the culprit if you're compiling in a synced folder.

If everything else fails you have to hunt for the problem systematically. Make a backup of your latest build project and disable some of your objects and other gameplay features, whatever this may mean in your particular case. If the game compiles well and runs smoothly then you know the problem was somewhere among the stuff you turned off so you can sift through the code and dependencies there. If You still don't succeed, then try to delete everything but the core mechanics and see how it performs. Not the fastest method but still doable.

If you make a daily back-up of your project you could also try to compile those one after the other and find out in what build the bug was introduced, which should also narrow down the problem.

I hope this helps and good luck!
Keys Apr 16, 2014 @ 7:39am 
When a Gamemaker game stops working like that, without any error, it's most probably caused by an infinite loop, not a memory leak.
A memory leak would gradually slow the game down before it would crash, and that's not the case here as far as I can tell.

The most common cause for this is while-loops or the do-until-loop.
TheEngiGuy Apr 16, 2014 @ 7:58am 
Many thanks for your post Phil, I'll try and do something.
However, 1 second before the crash, the game just suddenly stops except the sounds and music.
I forgot to mention, my game is exactly like the one from the second tutorial for beginners, with some objects appearing after X seconds without limits (so that they can fill the entire screen after a while). And the crash doesn't happen in a very specific moment, but randomly.
For now I tried removing all the sounds and even some objects, same problem occurs. I suspect this is because of the "create application" gone wrong, because before that everything was fine.

Originally posted by Keys:
When a Gamemaker game stops working like that, without any error, it's most probably caused by an infinite loop, not a memory leak.
A memory leak would gradually slow the game down before it would crash, and that's not the case here as far as I can tell.

The most common cause for this is while-loops or the do-until-loop.

Sorry for my ignorance, what are the while-loops and do-until-loops?
Last edited by TheEngiGuy; Apr 16, 2014 @ 8:00am
Keys Apr 16, 2014 @ 8:04am 
You're probably not using them if you're using the drag and drop blocks, I thought you were using actual code.

You could upload the .gmk file so we can take a look to see if there's any errors in your code or if it crashes for us aswell
TheEngiGuy Apr 16, 2014 @ 8:37am 
Originally posted by Keys:
You're probably not using them if you're using the drag and drop blocks, I thought you were using actual code.

You could upload the .gmk file so we can take a look to see if there's any errors in your code or if it crashes for us aswell

I got the .gmx though.
EDIT: deleting the test project.
Last edited by TheEngiGuy; Apr 21, 2014 @ 10:29am
Phil Strahl Apr 16, 2014 @ 11:10am 
Okay, I got your problem in the final .exe too. It's not the music object and it's not the background with the collision boxes. I've noticed that "object3" and "object5" are essentially the same, so you could easily delete one and just place two instances of the object (that's part of the idea of object-oriented programming). And I have a hunch that the culprit is the purple guy that pops up occasionally (object9)...

I deleted the object and removed it from the alarm in object1 and the application ran for 10 minutes straight, so you might just create this object from scratch again. Could have something to do also with the sprite itself, but I am just guessing.

By the way: For your next project I strongly suggest naming your sprites, sounds and objects ;)
Last edited by Phil Strahl; Apr 16, 2014 @ 11:17am
TheEngiGuy Apr 16, 2014 @ 11:40am 
Originally posted by PhilStrahl:
Okay, I got your problem in the final .exe too. It's not the music object and it's not the background with the collision boxes. I've noticed that "object3" and "object5" are essentially the same, so you could easily delete one and just place two instances of the object (that's part of the idea of object-oriented programming). And I have a hunch that the culprit is the purple guy that pops up occasionally (object9)...

I deleted the object and removed it from the alarm in object1 and the application ran for 10 minutes straight, so you might just create this object from scratch again. Could have something to do also with the sprite itself, but I am just guessing.

By the way: For your next project I strongly suggest naming your sprites, sounds and objects ;)

I removed them too and it still crashed my game. Then I removed the dolan ducks and everything ran fine.
I'm afraid it crashes because of too much images/objects. If that's the case, how am I going to make bigger games?

Thanks for taking your time to help by the way, and yes, I will name everything when I will work on my own stuff. Since I'm just following the tutorials for now, I can save some time.
Phil Strahl Apr 16, 2014 @ 2:23pm 
Interesting, because when I removed object9 the game ran fine even still it was covered in duckfaces ;)

Since I am not using the drag-n-drop options and different events much (the one I use almost all the time is ExecuteScript), I can’t really tell why exactly your game crashes, maybe it has something to do with finding a free spot for an object to place when another moving/jumping object gets positioned at the same coordinates...

But with that said, GameMaker Studio is very robust and can handle hundreds of object-instances easily. For example, the game I am currently working on (► LUFTWIDERSTAND) sometimes has around 800 instances, all with collision checking and other commands every step. And the framerate rarely drops below 100 fps.

So Gamemaker can handle a lot of stuff, but it’s never too soon to think about optimization and where you can save your processor some work, e.g. instead of importing big sprites and scaling them down in Gamemaker, scale the sprites in Photoshop and import them at the right size, etc. Of course, optimization only really comes into play when you write custom code. But I am sure you will get there :)
TheEngiGuy Apr 21, 2014 @ 10:35am 
Bump, because I've definitely fixed the problem and I'm explaining how.
I had to type the code "if place_meeting true - move_random" for every instance, so that the instances move into a random position if they collide with other instances.
I've also put all the sprites' origin in Center (very important for walls, since they were bugged before and the objects were going past them sometimes before).

Now the problem seems to be gone, never had a crash since then!
< >
Showing 1-11 of 11 comments
Per page: 15 30 50

Date Posted: Apr 16, 2014 @ 6:05am
Posts: 11