• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - IDE Game runs fine regularly, but crashes when ran with the Debugger. (GMS2)

Hi,

So I have been using GameMaker Studio 2 for a while now and I have yet to have any serious issues. However, I'm kind of stumped on this one...

My game runs perfectly fine when ran by pressing F5, however when I attempt to run the Debugger, this is what happens at the start of the game.

debugger error.JPG

I took this as any normal bug. I checked out the source of the error but the variable 'start_cutscene' was already set in the create event of oCutscene. I figued this must be just a one time thing and so I changed the initialization of the variable to the Game Start event and it worked fine, until I got a similar bug referencing another object's variable not being previously defined. I was confused, and then came to the conclusion that for some reason the Debugger was registering the Step event before the Create event. I'm not sure if this is intentional, or if this is a bug. I would go through and set all of my create event variables to Game Start but that would only apply for any objects created in the first room and wouldn't solve the issue at all. What do you guys suggest I do?
 

flyinian

Member
Hi,

So I have been using GameMaker Studio 2 for a while now and I have yet to have any serious issues. However, I'm kind of stumped on this one...

My game runs perfectly fine when ran by pressing F5, however when I attempt to run the Debugger, this is what happens at the start of the game.

View attachment 32731

I took this as any normal bug. I checked out the source of the error but the variable 'start_cutscene' was already set in the create event of oCutscene. I figued this must be just a one time thing and so I changed the initialization of the variable to the Game Start event and it worked fine, until I got a similar bug referencing another object's variable not being previously defined. I was confused, and then came to the conclusion that for some reason the Debugger was registering the Step event before the Create event. I'm not sure if this is intentional, or if this is a bug. I would go through and set all of my create event variables to Game Start but that would only apply for any objects created in the first room and wouldn't solve the issue at all. What do you guys suggest I do?


Are the objects you are trying to use initialized at game start/ created in game before being used?
 

samspade

Member
Hi,

So I have been using GameMaker Studio 2 for a while now and I have yet to have any serious issues. However, I'm kind of stumped on this one...

My game runs perfectly fine when ran by pressing F5, however when I attempt to run the Debugger, this is what happens at the start of the game.

View attachment 32731

I took this as any normal bug. I checked out the source of the error but the variable 'start_cutscene' was already set in the create event of oCutscene. I figued this must be just a one time thing and so I changed the initialization of the variable to the Game Start event and it worked fine, until I got a similar bug referencing another object's variable not being previously defined. I was confused, and then came to the conclusion that for some reason the Debugger was registering the Step event before the Create event. I'm not sure if this is intentional, or if this is a bug. I would go through and set all of my create event variables to Game Start but that would only apply for any objects created in the first room and wouldn't solve the issue at all. What do you guys suggest I do?
I am a little confused because that's not what error messages look like if you run the debugger. Error messages in the debugger look like this (at least for me on a windows computer). It will also stop you on the line and allow you to check the variable.
1594659821301.png

Additionally, I'd be curious to see your create event. I don't think there's anyway for the step event to run before the create event. But you could test this theory by putting a show debug message or break point in both and removing the offending line (so it doesn't crash) and then seeing which one runs first.
 
I am a little confused because that's not what error messages look like if you run the debugger. Error messages in the debugger look like this (at least for me on a windows computer). It will also stop you on the line and allow you to check the variable.
View attachment 32732

Additionally, I'd be curious to see your create event. I don't think there's anyway for the step event to run before the create event. But you could test this theory by putting a show debug message or break point in both and removing the offending line (so it doesn't crash) and then seeing which one runs first.
Okay so now I'm a little more confused...

So first off, here's a screenshot of my create event, and here is a screenshot of the variable it is trying to reference.

debugger error (create event).JPGdebugger error (step event).JPG

I wanted to test your theory using the debug message and you're right, it looks like the create event does register before the step event, as shown with "create" and "step" here.

debugger error (show message).JPG

Also, I do not get that error box like the screenshot you showcased. I'm not sure why mine looks different.
 

chamaeleon

Member
then came to the conclusion that for some reason the Debugger was registering the Step event before the Create event.
I find this highly unlikely. I would only accept such a conclusion if you can show that show_debug_message() in both create and step events for the same object does not appear as create message first, followed by step messages, or a break point at a line that must execute in the create event does not trigger.
 

curato

Member
I had this happening in my project where instance were referring to global variables before that were initialized. I solved it by have a manager object that declares and initializes all global variables and I make sure it is created first on the title page where it doesn't even user them and it is persistent so then everything is there when the first level starts.
 
I had this happening in my project where instance were referring to global variables before that were initialized. I solved it by have a manager object that declares and initializes all global variables and I make sure it is created first on the title page where it doesn't even user them and it is persistent so then everything is there when the first level starts.
I would say this is my issue but I haven't used many global variables in my project. The thing is, all of the objects that need to be in the first room are there, along with all of them being persistent. That's why I am confused.
 

samspade

Member
I'm not sure about the difference in error messages. Does the debugger stop on the line at least? Are you using inheritance at all? If a child inherits but overwrites the create event, you might get the error for that child.

A simple fix might be to just rename the variable. You could also do a search through your entire project with control + shift + f to see if that variable name is used anywhere. You could also try the clean button (control + F7).
 
The debugger does not stop on a specific line. In fact, nothing even shows up on the debugger after the game crashes.

Here is what my output window has to say. (the 'create' and 'step' are just messages that I left in there to show that the create event is registering before the step event.


C:\WINDOWS\system32\cmd.exe DONE (0)
DoSteam
Igor complete.
[Run] Run game
Options: Z:/Chiaroscur_EFD4FCCE_58DE0814\MainOptions.json
[Debugger]target=127.0.0.1,yydebug="Y:/Chiaroscuro_2BA0F0A_VM\Chiaroscuro.yydebug"
X://windows/Runner.exe -game "Y:/Chiaroscuro_2BA0F0A_VM\Chiaroscuro.win"
Attempting to set gamepadcount to 12
DirectX11: Using hardware device
Start debug server
Creating Debugger server port:6509
[DbgServer]6509
Collision Event time(microsecs)=63
[live][2:22:40 PM] Initializing...
[live][2:22:40 PM] Indexing assets...
create
[live][2:22:40 PM] Initializing...
[live][2:22:40 PM] Indexing assets...
create
Total memory used = 785393298(0x2ed02692) bytes
**********************************.
Entering main loop.
**********************************.
Resizing swap chain...step
step
ERROR!!! :: ############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object oCutscene:


Variable oCutscene.begin_cutscene(100153, -2147483648) not set before reading it.
at gml_Object_oCutscene_Step_0 (line 3) - if(begin_cutscene)
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_oCutscene_Step_0 (line 3)



X://windows/Runner.exe exited with non-zero status (-1073741819)
elapsed time 00:00:39.0823421s for command "C:\ProgramData/GameMakerStudio2/Cache/runtimes\runtime-2.2.5.378/bin/Igor.exe" -j=8 -options="C:\Users\Joseph\AppData\Local\GameMakerStudio2\GMS2TEMP\build.bff" -v -- Windows Run started at 07/15/2020 14:22:13
"cmd" /c subst Z: /d

elapsed time 00:00:00.0708112s for command "cmd" /c subst Z: /d started at 07/15/2020 14:22:52
"cmd" /c subst Y: /d

elapsed time 00:00:00.0458761s for command "cmd" /c subst Y: /d started at 07/15/2020 14:22:52
"cmd" /c subst X: /d

elapsed time 00:00:00.0528417s for command "cmd" /c subst X: /d started at 07/15/2020 14:22:52
FAILED: Run Program Complete
For the details of why this build failed, please review the whole log above and also see your Compile Errors window.


I changed the variables name throughout the whole project like you said but that didn't do anything. I also checked the Compile Errors window like it says above and there weren't any compile errors to be shown for some reason. Also, there is no inheritance with the oCutscene object, and like I said it does this with every variable initialized in the create event of any object.

Here is what I mean. I changed the initiation of the oCutscene's begin_cutscene variable to Game Start and that error disappeared. After that, however, this one popped up for my oCamera object.

1594841648225.png

It says the xTo variable was not set but it was.

1594841674671.png

xTo was set to the x position of the oCamera object, and it only sets it's x position to that of follow.x when the follow instance exists. Therefore it can't be that either.

I thought it might just be this version of GMS2 but I tried the debugger on a different project and it worked perfectly fine. I'm just stumped at this point as I can not figure out why it's acting this way.
 

Roldy

Member
Personally I think there are a few things that we would have to have an explanation for. Here is your log after the debugger starts:

Code:
[DbgServer]6509
Collision Event time(microsecs)=63
[live][2:22:40 PM] Initializing...
[live][2:22:40 PM] Indexing assets...
create
[live][2:22:40 PM] Initializing...
[live][2:22:40 PM] Indexing assets...
create
Total memory used = 785393298(0x2ed02692) bytes
**********************************.
Entering main loop.
**********************************.
What are these "[live][2:22:40 PM] Initializing..." messages?

How are they and your 'create' event text being called before the game has started "Entering main loop?"

For instance if I put show_debug_message in any object or room create event or game start event they all occur after the main loop begins.

Where are these oCutscene being created before a room has loaded?

Where in the log does it say the debugger has connected to the client (...Waiting for debugger to connect..)

Here is what my log looks like when running the debugger:

Code:
[DbgServer]6509
Collision Event time(microsecs)=3
Total memory used = 6353007(0x0060f06f) bytes
**********************************.
Entering main loop.
**********************************.
...Waiting for debugger to connect...
Client(-1) Connected: 127.0.0.1
Debugger connected
82 code buffers added (38092)
Debug_SendGameStructure: packet size 123748
Are you running 2.2.5 or 2.3?

Can you reproduce this with a small test case? Not something loading up 785MB of assets...

Similar to what samspade said. It is wierd you are not recieving the error through the debugger. Like the debugger isn't even running or connected.
 
Last edited:
Alright, after mentioning the "[live][2:22:40 PM] Initializing..." messages I ended up figuring out what it was

I've been using a GMS2 extension called GMLive that pretty much allows for live code changes to an active game, which makes development much quicker when your game takes almost a minute to build. This may have just been an old version of the extension, but I removed GMLive and it worked fine from then on. That would also explain the error message not being specific to the debugger.

Thanks for you guys' help! Next time something acts up I'll just double check to make sure any extensions aren't causing it.
 

clee2005

Member
Alright, after mentioning the "[live][2:22:40 PM] Initializing..." messages I ended up figuring out what it was

I've been using a GMS2 extension called GMLive that pretty much allows for live code changes to an active game, which makes development much quicker when your game takes almost a minute to build. This may have just been an old version of the extension, but I removed GMLive and it worked fine from then on. That would also explain the error message not being specific to the debugger.

Thanks for you guys' help! Next time something acts up I'll just double check to make sure any extensions aren't causing it.
Thank you for this! I came here to discover the same thing in my project! GMLive is fantastic, but it does cause weird stuff like this from time to time and I lose a ton of time trying to determine what is going on. Maybe the same amount of time I save using it... LOL
 
Last edited:
Top