Trouble-Shooting GameEngine


 

This page may be able to help you if your GameEngine isn't working. Topics:

The window won't open (Replit)
The window won't open (BlueJ)
The window opens blank
Some of my widgets are not there
The widgets are all there, but clicking does nothing
It won't take keyboard input
Sprite widgets are not moving
Sprites run over other widgets or off the edge
Text does not display properly
(More TBA)
We have no links for most of those topics at this early date, but if you are doing this in a classroom environment, you can summon a Mentor to come help:
-- or use the "Ask" feature in Zoom.

Game Window Won't Open (BlueJ)

If your game program compiles, but when you right-click its yellow rectangle in the BlueJ dashboard and choose "main()" from the popup menu, there is no game window, you should verify that the GameMaker window still opens. If not, then the GameEngine code has somehow become damaged, and you should discard it -- you might save off any files with the name(s) of your game(s) to save retyping everything. UnZip a fresh download of the GameEngine and see if that opens. If not, get help, because we don't upload it until it works.

After you have verified that the GameMaker window opens, if this is a fresh unZip, try putting in your saved-off files one at a time (quit, put the file in, then restart GameMaker) and verify that it still works. If it fails on one of these files, that is your problem. Discard the failing file and verify that GameMaker works again.

After you have verified that the GameMaker window opens with all your files back in the folder (or at least as many as it still works with), try typing the name of the failed game into the game name panel and see if it loads your game data. If not, you probably need to enter that data again. If/when your data is loaded, quit GameMaker and restart it, to verify that it still reloads. Then click Build to make a new Java program. You may have lost your hand-written Java additions, but if you saved your files, you can copy your new code from the saved file and paste it into the (new) Java window. Then compile and try again.

If the game window still won't open, there's probably an error message in the (console) log, but you will need help decoding it. Clear the log (from the menu) and try one more time to get a clean log of the problem, then save it and email it to me or an instructor.

Another way forward is to delete your widgets one at a time and reBuild to see if that widget is the cause. Or (better) start with a blank slate (which should open a blank game window -- if not, the problem may be in your added code: delete your game's ".java" file and try again

then add your widgets one at a time to see which one caused it to fail.
 

(Unfinished Topics)

The window opens blank
Some of my widgets are not there
The widgets are all there, but clicking does nothing
It won't take keyboard input
Sprite widgets are not moving
Sprites run over other widgets or off the edge
Text does not display properly
 

(More TBA)

(Ideas in process...)

we can hunt around for the difficulty. If the calculator program is running, quit (close its window). Then in your program window, the one with "class CalcGE" (or whatever you called it) on a line near the top. Scroll down to the "public void StartUp()" method and click in the left margin of the next line, the first line after the "public void StartUp()" method header. If the program is compiled, it will put a little red stop sign on that line. Some versions of BlueJ will make the whole line red. This is a breakpoint. You've already seen them in prior programs.

Then run your program (right-click its yellow rectangle and choose "main()" from the popup menu). It should immediately open up the debugger window and the red line has turned green with a green arrow pointing to it on top of the stop sign. If not, then there is a problem you can't fix. Get help. That's what the instructors are for.

If you got the breakpoint, scroll down to the "public boolean ClickEvt" method, and put another breakpoint there. If it won't take a breakpoint, it's because there is no executable code, you did not remove the "//" comment markers from the front of the lines you were to have replaced. Fix that and recompile and try again.

If ClickEvt takes a breakpoint, then click Continue in the debugger window, then bring up your calculator window and click on one of your (unresponsive) buttons there. Did you hit the breakpoint? If so, you can step through that method and see what went wrong. One possibility is that when you GetInfo from the widget that took the click, the number you got back isn't what your code is looking for.

If clicking on the buttons never trips the breakpoint, you probably neglected to make your buttons Clickable. Terminate the debugger (if it is open) or quit the program by closing its window, or click the curly "Reset" arrow at the bottom right corner of the dashboard window to kill the running program, then re-open GameMaker and select each button rectangle. If the Clik checkbox is not set, that's why you don't get clicks on that rectangle.

If the Clik checkbox is set, and you still don't get your breakpoint in the ClickEvt method, something is badly wrong, get help. If this happened to me, I'd discard everything, and rebuild BlueJ from a fresh download, and install the GameEngine from a fresh download, then rebuild my calculator from scratch. I know this worked for me, or I would not have uploaded it. If you got this far, it was working, but Bad Things Happen.
 
 

Run your program, and click any button. Immediately it opens up the debugger window, and that red line in your listing turned green, with a green arrow poing to it. You hit the breakpoint. Click continue in the debugger window, then click the decimal point button. Did you get the same breakpoint? Did you make the decimal point button Clickable (the Clik checkbox in GameMaker)? You can close the Calculator window and reopen GameMaker to be sure. If not, click the checkbox, then Build again.

Revised: 2022 November 5