<b>Question:</b> “I have no idea whats wrong..
It says ‘Failed to run game.’”
<b>Answer:</b> That error is usually caused by some kind of serious error made by the user. The error is none of the usual ones though, and often it is hard even for the user to determine what it is. Game Maker have no clue, thus it says “Failed to run game” instead of what exactly went wrong. Neither does it offer you a possibility to run the game anyway since the error will then continue to interrupt – maybe each step, depending in what event it is placed.
This question brings me onto debugging. I got some simple techniques that I would like to share with you. First of all, I test my games very often – immediately after I have completed any major code or anything which is meant to have a visual effect. By doing this I always know when the error first appears and what code I have just input, and I just have to put two and two together. It helps me to determine where the problem is fast. What first do is that I either comment (//) the line that I suspect, or I delete it (not entirely, I save it in a separate text file, of course). Then I run the game again and hopefully it will work. Then I try to rephrase what I have deleted and then input again, and test.
If it still doesn’t work when I have deleted a piece of code, then I delete even more. I never input code which I have been earlier deleted before the game works again, so even if I start to suspect line five I do not delete it and input another line which I have already deleted (since I do not suspect it anymore – the error wasn’t solved when I deleted it, right?). It is very important to remember that an error is often a combination between lots of things. Maybe you assign a variable the wrong kind of value in one object, and then you get a error in another object because can’t read the variable etc.
If I have deleted many lines of code and want to put them back again (the error has disappeared) I start to add the one I first deleted, then the one I deleted after that, and so on. If the error would occur again, then I can be 100% sure of which line it is this time. I know this not always possible, like with everything else; you need to adapt everything I have said until now to your specific problem.
.
Users logged in:
Comments
Loading comments...