Legacy GM [SOLVED] Variable becomes null at seemingly random moments

T

Tribow

Guest
Here's how the bug basically goes. I play my game for about 10 to 30 minutes and I get an error that reads as;

"<unknown object>.pcolor(100060,-2819230827) not set before reading it."

Yet, every time this error has been thrown, this has never been the case. It doesn't matter which variable throws the error, every time I go and check the Create Event of the object that has the variable the variable is always set beforehand. It's never the same variable that throws the error. It seems to be a different variable from a different object almost every time I see this error message.
Sometimes the error message doesn't same "<unknown object>" and tells me exactly which object it is, but the issue stays the same.
Some variables throw this error more than others, but the problem doesn't seem to stem from how my code is structured. Something as simple as checking if a variable is true or false in the step event can throw this error.

From what I understand, the variable is becoming null for some reason. I just can't figure out why it is happening. Even the debugger hasn't been able to show me, even when I miraculously caught the bug red-handed the debugger only told me that the variable did indeed no longer exist.

I've tried many solutions:

-In the step event of every single object, I wrapped the code into an if statements that checks if the object itself exists before running its own step event. This was because some objects could be destroyed the moment they were created. This did not work.

-I reduced the number of instances on screen since there tends to be a lot. Maybe I had too much information going on in my game. This did not work.

-I took out the particle effects as there tends to be a lot of particles in my game. This did not work.

-I deleted every single object and replaced it with new objects with very similar code. Perhaps there was something wrong with the object itself. This did not work.

-I didn't use every object that threw the error, but this only led to a game that doesn't even function, so it didn't matter whether or not that worked.

I want to avoid resetting the entire project and coding it from scratch. I don't know if there's some corruption going on in the files, but considering I deleted every object and replaced it with new objects, that corruption would be gone if there was any (I think).
I really need help though, I simply cannot figure this out.
 

jo-thijs

Member
Here's how the bug basically goes. I play my game for about 10 to 30 minutes and I get an error that reads as;

"<unknown object>.pcolor(100060,-2819230827) not set before reading it."

Yet, every time this error has been thrown, this has never been the case. It doesn't matter which variable throws the error, every time I go and check the Create Event of the object that has the variable the variable is always set beforehand. It's never the same variable that throws the error. It seems to be a different variable from a different object almost every time I see this error message.
Sometimes the error message doesn't same "<unknown object>" and tells me exactly which object it is, but the issue stays the same.
Some variables throw this error more than others, but the problem doesn't seem to stem from how my code is structured. Something as simple as checking if a variable is true or false in the step event can throw this error.

From what I understand, the variable is becoming null for some reason. I just can't figure out why it is happening. Even the debugger hasn't been able to show me, even when I miraculously caught the bug red-handed the debugger only told me that the variable did indeed no longer exist.

I've tried many solutions:

-In the step event of every single object, I wrapped the code into an if statements that checks if the object itself exists before running its own step event. This was because some objects could be destroyed the moment they were created. This did not work.

-I reduced the number of instances on screen since there tends to be a lot. Maybe I had too much information going on in my game. This did not work.

-I took out the particle effects as there tends to be a lot of particles in my game. This did not work.

-I deleted every single object and replaced it with new objects with very similar code. Perhaps there was something wrong with the object itself. This did not work.

-I didn't use every object that threw the error, but this only led to a game that doesn't even function, so it didn't matter whether or not that worked.

I want to avoid resetting the entire project and coding it from scratch. I don't know if there's some corruption going on in the files, but considering I deleted every object and replaced it with new objects, that corruption would be gone if there was any (I think).
I really need help though, I simply cannot figure this out.
Are you using instance_change or object_event_perform or something of the sort?
Are you always initializing variables in the create event?

If you don't mind sending the GMZ file of the project, I can have a look at it.
Though, I'm pretty busy and the bug seems to not be very reproducible, so I can't make any guarantees.
 
T

Tribow

Guest
Are you using instance_change or object_event_perform or something of the sort?
Are you always initializing variables in the create event?

If you don't mind sending the GMZ file of the project, I can have a look at it.
Though, I'm pretty busy and the bug seems to not be very reproducible, so I can't make any guarantees.
Not using instance_change or object_event_perform.
All of the variables are initialized in the create event.

Not sure if sending a GMZ would be efficient as yes, it isn't very reproducible. It requires at least 10 minutes of playing the game and sometimes the bug just doesn't even happen for a full hour.

Give us some examples of lines of code that are causing the error.
Here's an example of some code that threw the error

>Create Event
fade = true;

>Step Event
if (fade == true)
{
image_alpha -= .03;
}

^This has caused the error.
 

jo-thijs

Member
Not using instance_change or object_event_perform.
All of the variables are initialized in the create event.

Not sure if sending a GMZ would be efficient as yes, it isn't very reproducible. It requires at least 10 minutes of playing the game and sometimes the bug just doesn't even happen for a full hour.
It's actually the most efficient way I can think of, but it does require you to send your project to someone else, which is in some situations undesireable.

Otherwise, if you're sure there's nothing wrong with your code, you can also try clearing the cache.
 
And what is the exact error message you get with this particular example?

Code:
>Create Event
fade = true;

>Step Event
if (fade == true)
{
image_alpha -= .03;
}
You haven't accidentally changed the little radio button at the top of the script editor from self, to other or object, have you?
 
T

Tribow

Guest
It's actually the most efficient way I can think of, but it does require you to send your project to someone else, which is in some situations undesireable.

Otherwise, if you're sure there's nothing wrong with your code, you can also try clearing the cache.
Alright, I'll make a GMZ of it in a bit. It's pretty large and I haven't commented too much in the code. Also, it's a bullet hell game so it's a little difficult. (there's also quite a bit of useless code that I've been weeding out slowly, apologies if that's distracting)

And what is the exact error message you get with this particular example?

You haven't accidentally changed the little radio button at the top of the script editor from self, to other or object, have you?
The script editor is set to self

33.jpg
This isn't the exact error that the code I posted made. I can't find the image for that one, so I grabbed an image of some different code that made the same error. Just replace "pcolor" with "fade" and have a different gml_Object and you have your error.
 
The only way I've been able to get an <unknown_object> message is by trying to access variables from a variable containing a negative number. For example, if a contains the constant "noone" (-4), then a.b will cause an unknown_object message. There are functions that return noone under certain circumstances, many collision functions for example.

If you've got an older version of studio 1, you could also be getting this message when trying to use the "other" keyword under certain circumstances.
 
T

Tribow

Guest
I have version 1.4.1804.
I haven't seen this error come out of a collision event. I've only seen this come out of the step event. I haven't seen this come out of using "other" as well.

It usually comes from a variable that I set to either true or false. (pcolor is an exception to this since it was set to a color like "c_red")
 
I think it would be a good idea to get an example of code, as well as the exact error message that corresponds to that specific piece of code. By the way, is the code within a "with" statement?

I've done this experiment on gms.1.4.1804 with the windows target platform, which produced some interesting, and somewhat mysterious results. Perhaps related to your problem, perhaps not.

Code:
a = n;
show_message(a.b);
n being a negative integer,

when n=-3, result is show_message will show the value of b for whatever is the oldest instance in the room, or a crash indicating the variable is not set.

when n=-4 or n=-5 or n=-8 or n=-11 or n=-14, result is crash with message: "<unknown_object>.<unknown_variable>".

when n=-7 or n=-12, result is a crash with message: "Runner... has stopped working", unless b is defined for self, in which case the result is crash with message: "<unknown_object>.arguments not set".

when n=-9 or n=-10, result is show_message shows "undefined".

when n=-13, result is a crash with message: "Runner... has stopped working".

when (n <= -15), result is crash with message: "Unable to find any instance for object index n.name <undefined>".
 
Last edited:

icuurd12b42

TMC Founder
GMC Elder
>You haven't accidentally changed the little radio button at the top of the script editor from self, to other or object, have you?

-The script editor is set to self

Have you looked at the create code?

also, make sure the create code ran, like add a
show_debug_message("CREATE RAN " + string(fade))
 
T

Tribow

Guest
33.jpg
This is the error in another example.

>Create Event
Code:
turn = false;
turn2 = false;
>Step Event
Code:
if (turn == true && controller.spread2 == true) //"controller" is just a seperate object. "spread2" has never been the one to throw the error. Always "turn"
    {
    turn2 = true;
    turn = false;
    }

Have you looked at the create code?

also, make sure the create code ran, like add a
show_debug_message("CREATE RAN " + string(fade))
The create code is also set to self. Usually, in every instance of the object, the create code does run. The bug doesn't happen every time an instance of the object is created. I could create 1000 instances of the object and the bug could just not happen.
The bug could be happening because the create code didn't run, but what would I do if it didn't? Why wouldn't it run?
 
T

Tribow

Guest
Not sure if this is related or not, but when I cleared the cache I had this weird moment where one of the bullet patterns in my game seemed to make twice as many bullets as usual, then briefly afterwards the game crashed without giving an error message.

Windows didn't say the program stopped working either.

It just closed the window.

Funny thing is, the way that specific bullet pattern works is that an object is created. This object does the bullet pattern by itself and uses the step event to make its bullets. It makes bullets every frame, so the only way it could make more bullets is that a second instance of it was spawned at the next frame/a short amount of frames afterward.

Again I don't know if this is related, but it did happen.
 
T

Tribow

Guest
Actually speaking of which, there have been moments where instead of throwing an error, the game would just close itself without giving an error. It has happened without me clearing cache, although something like spawning an object twice hasn't happened before.

I do think the fact that it closes without an error is related to the <unkown object> error in general, but I certainly don't know why it is happening.
 

Joe Ellis

Member
The unknown object error message does happen when an instance id is passed into a script, which then causes the error upon reading it with no variable in it that exists, the error \ debugger seems to have no tracking of exactly which instance was passed into the script, which makes sense cus the error message system never really knows the exact instance that was used that caused the error, just the code it ran before hand.,
hope this helps in some way!
 
T

Tribow

Guest
The unknown object error message does happen when an instance id is passed into a script, which then causes the error upon reading it with no variable in it that exists, the error \ debugger seems to have no tracking of exactly which instance was passed into the script, which makes sense cus the error message system never really knows the exact instance that was used that caused the error, just the code it ran before hand.,
hope this helps in some way!
I'm not sure what to do with this information though.
 

jo-thijs

Member
Not sure if this is related or not, but when I cleared the cache I had this weird moment where one of the bullet patterns in my game seemed to make twice as many bullets as usual, then briefly afterwards the game crashed without giving an error message.

Windows didn't say the program stopped working either.

It just closed the window.

Funny thing is, the way that specific bullet pattern works is that an object is created. This object does the bullet pattern by itself and uses the step event to make its bullets. It makes bullets every frame, so the only way it could make more bullets is that a second instance of it was spawned at the next frame/a short amount of frames afterward.

Again I don't know if this is related, but it did happen.
Actually speaking of which, there have been moments where instead of throwing an error, the game would just close itself without giving an error. It has happened without me clearing cache, although something like spawning an object twice hasn't happened before.

I do think the fact that it closes without an error is related to the <unkown object> error in general, but I certainly don't know why it is happening.
I thought that'd happen, send me the GMZ
I'd be willing to give it a look-over. Might not get back to you till tomorrow though. Another user posted earlier that thyey'd take a look also.
I've already had a look at the project.
I've been testing the game for multiple hours, but I haven't been able to reproduce the bug.
instance_change is used in the project, but it is always passed true as second parameter, so that can't be it.
All the GML actions I've checked so far have "applies to" set to self.
Every variable I've checked so far does initialize its variable in the create event.
event_perform and the like are not used in the project.
There are some with-expressions in the project (one of them is even applied to "all"), but none of those seem erroneous.

I'm currently thinking it may actually not be an issue of the project, but of something specific to Tribow's device (or GameMaker installation).
We could test this as follows:
Record the arrow keys, shift key, spacebar, z key and left mouse button clicks (along with the mouse coordinates at that point) per frame in a file, until the bug appears.
Then later replay those inputs using keyboard_key_press and rewriting the mouse events in the shop objects to read mouse clicks from a global variable rather than the actual mouse.
If replaying the session either doesn't reproduce the bug twice forTribow or doesn't reproduce the bug for others, we have reason to believe (because the project doesn't use randomize or time sensitive functions like delta_time) it's something specific to Tribow's device (or GameMaker installation).
(every step would take up 5 bytes: 2 for each coordinate of the mouse, and a bit for very key and the mouse button; this would result in a file of 648 kb for an hour session)
 
T

Tribow

Guest
I've already had a look at the project.
I've been testing the game for multiple hours, but I haven't been able to reproduce the bug.
instance_change is used in the project, but it is always passed true as second parameter, so that can't be it.
All the GML actions I've checked so far have "applies to" set to self.
Every variable I've checked so far does initialize its variable in the create event.
event_perform and the like are not used in the project.
There are some with-expressions in the project (one of them is even applied to "all"), but none of those seem erroneous.

I'm currently thinking it may actually not be an issue of the project, but of something specific to Tribow's device (or GameMaker installation).
We could test this as follows:
Record the arrow keys, shift key, spacebar, z key and left mouse button clicks (along with the mouse coordinates at that point) per frame in a file, until the bug appears.
Then later replay those inputs using keyboard_key_press and rewriting the mouse events in the shop objects to read mouse clicks from a global variable rather than the actual mouse.
If replaying the session either doesn't reproduce the bug twice forTribow or doesn't reproduce the bug for others, we have reason to believe (because the project doesn't use randomize or time sensitive functions like delta_time) it's something specific to Tribow's device (or GameMaker installation).
(every step would take up 5 bytes: 2 for each coordinate of the mouse, and a bit for very key and the mouse button; this would result in a file of 648 kb for an hour session)
Honestly, I think the fact that no one else has been able to reproduce the bug is proof enough that there is something wrong with my GameMaker installation. I guess what is left to do is to reinstall it. I haven't done that before, but I'm assuming https://help.yoyogames.com/hc/en-us/articles/216753708-How-to-perform-a-fresh-install this is a trustful guide on how to do it.
 
T

Tribow

Guest
Okay after three playtests after reinstallation I seem to still have the issue where the game just closes without giving an error. I'm not sure what could possibly be wrong with my computer, but I want to avoid reinstalling my entire OS in order to fix this.

There is one thing that seems to usually happen before the game closes itself on me and that is an instance of an object operating a bit faster than usual. Before, I thought that an object was created twice, but now I can see that the object just seemed to be on an entirely different fps all on its own. I haven't once seen the old error message pop up though.

Maybe I missed a step when doing a fresh install of game maker. I'll probably try to do a second reinstall since there might have been some leftover files in the "Program Files" folder that I didn't get rid of that I was supposed to get rid of. I only checked for AppData.
 

jo-thijs

Member
Okay after three playtests after reinstallation I seem to still have the issue where the game just closes without giving an error. I'm not sure what could possibly be wrong with my computer, but I want to avoid reinstalling my entire OS in order to fix this.

There is one thing that seems to usually happen before the game closes itself on me and that is an instance of an object operating a bit faster than usual. Before, I thought that an object was created twice, but now I can see that the object just seemed to be on an entirely different fps all on its own. I haven't once seen the old error message pop up though.

Maybe I missed a step when doing a fresh install of game maker. I'll probably try to do a second reinstall since there might have been some leftover files in the "Program Files" folder that I didn't get rid of that I was supposed to get rid of. I only checked for AppData.
Could you try the recording approach I proposed in my previous reply to make sure it's not a project related bug?
 

DukeSoft

Member
Try running MemTest86 on your machine :)

Also, when you run with the debugger, you should be able to look through the instance causing the error and you should be able to view all variables that are defined. Maybe there are some leads there?

Because it might very well be that this instance has been altered from outside. Since there are no visibility settings on instance variables everything can be edited from other scopes.
 
C

CreatorAtNight

Guest
Does the object causing the error already exist in the room or is it created at the moment it gives the error? I've had some weird error once where it seemed like the code in the create event didn't run the first step but the second after the object was created.

What also could cause this error is if object A is being created in the same step where object B tries to access the 'fade' variable from object A, while in the room's 'Instance Order' Object B comes before object A. Object A isn't actually created yet when object B tries to access it. Not sure if this is 100% true in every case, but I think I've had problems with this before.
 
T

Tribow

Guest
Could you try the recording approach I proposed in my previous reply to make sure it's not a project related bug?
Oh, I forgot to ask, how would I go about doing that? I've never done that before.
 

jo-thijs

Member
Oh, I forgot to ask, how would I go about doing that? I've never done that before.
To save a recording:

Have a persistent invisible object (obj_record) that is present from the first room in your game and never gets deactivated.
Have as its:
create event:
Code:
mybuff = buffer_create(1, buffer_grow, 1);
begin step event:
Code:
var flags =
    keyboard_check(vk_left) +
    keyboard_check(vk_right) * 2 +
    keyboard_check(vk_up) * 4 +
    keyboard_check(vk_down) * 8 +
    keyboard_check(vk_shift) * 16 +
    keyboard_check(vk_space) * 32 +
    keyboard_check(ord('Z')) * 64 +
    mouse_check_button(mb_left) * 128;

buffer_write(mybuff, buffer_u8, flags);

buffer_write(mybuff, buffer_u16, mouse_x);
buffer_write(mybuff, buffer_u16, mouse_y);

buffer_save(mybuff, "recording");

global.mx = mouse_x;
global.my = mouse_y;
global.click = flags & 128;
Then play your game.
The recording should be stored in the file "%localappdata%\A_N_T\recording".

To load a recording:
Have a persistent invisible object (obj_replay) that is present from the first room in your game and never gets deactivated.
Have as its:
create event:
Code:
mybuff = buffer_load("recording");

global.mx = 0;
global.my = 0;
global.click = false;
global.pclick = false;
begin step event:
Code:
var flags = buffer_read(mybuff, buffer_u8);

if flags & 1
    keyboard_key_press(vk_left);
else
    keyboard_key_release(vk_left);

if flags & 2
    keyboard_key_press(vk_right);
else
    keyboard_key_release(vk_right);

if flags & 4
    keyboard_key_press(vk_up);
else
    keyboard_key_release(vk_up);

if flags & 8
    keyboard_key_press(vk_down);
else
    keyboard_key_release(vk_down);

if flags & 16
    keyboard_key_press(vk_shift);
else
    keyboard_key_release(vk_shift);

if flags & 32
    keyboard_key_press(vk_space);
else
    keyboard_key_release(vk_space);

if flags & 64
    keyboard_key_press(ord('Z'));
else
    keyboard_key_release(ord('Z'));

global.pclick = global.click;
global.click = flags & 128 != 0;

global.mx = buffer_read(mybuff, buffer_u16);
global.my = buffer_read(mybuff, buffer_u16);

window_mouse_set(global.mx, global.my);
end step event:
Code:
if global.click && !global.pclick {
    with bombup {
        event_perform(ev_mouse, ev_left_press);
    }
}
And run the game.
The recording will take over your mouse, but don't be scared!
Pressing escape will pause everything, including the recording, after which you can easily close the program.

Do make sure to not use both obj_recording and obj_replay at the same time.

Also do note that not everything is being recorder (pressing escape isn't for example) and I may have overlooked some details about your project, but it may be sufficient.
Currently, it only records pressing arrow keys, shift, spacebar, Z, mouse coordinates and mouse clicks on shop items.
 
T

Tribow

Guest
To save a recording:

Have a persistent invisible object (obj_record) that is present from the first room in your game and never gets deactivated.
Have as its:
create event:
Code:
mybuff = buffer_create(1, buffer_grow, 1);
begin step event:
Code:
var flags =
    keyboard_check(vk_left) +
    keyboard_check(vk_right) * 2 +
    keyboard_check(vk_up) * 4 +
    keyboard_check(vk_down) * 8 +
    keyboard_check(vk_shift) * 16 +
    keyboard_check(vk_space) * 32 +
    keyboard_check(ord('Z')) * 64 +
    mouse_check_button(mb_left) * 128;

buffer_write(mybuff, buffer_u8, flags);

buffer_write(mybuff, buffer_u16, mouse_x);
buffer_write(mybuff, buffer_u16, mouse_y);

buffer_save(mybuff, "recording");

global.mx = mouse_x;
global.my = mouse_y;
global.click = flags & 128;
Then play your game.
The recording should be stored in the file "%localappdata%\A_N_T\recording".

To load a recording:
Have a persistent invisible object (obj_replay) that is present from the first room in your game and never gets deactivated.
Have as its:
create event:
Code:
mybuff = buffer_load("recording");

global.mx = 0;
global.my = 0;
global.click = false;
global.pclick = false;
begin step event:
Code:
var flags = buffer_read(mybuff, buffer_u8);

if flags & 1
    keyboard_key_press(vk_left);
else
    keyboard_key_release(vk_left);

if flags & 2
    keyboard_key_press(vk_right);
else
    keyboard_key_release(vk_right);

if flags & 4
    keyboard_key_press(vk_up);
else
    keyboard_key_release(vk_up);

if flags & 8
    keyboard_key_press(vk_down);
else
    keyboard_key_release(vk_down);

if flags & 16
    keyboard_key_press(vk_shift);
else
    keyboard_key_release(vk_shift);

if flags & 32
    keyboard_key_press(vk_space);
else
    keyboard_key_release(vk_space);

if flags & 64
    keyboard_key_press(ord('Z'));
else
    keyboard_key_release(ord('Z'));

global.pclick = global.click;
global.click = flags & 128 != 0;

global.mx = buffer_read(mybuff, buffer_u16);
global.my = buffer_read(mybuff, buffer_u16);

window_mouse_set(global.mx, global.my);
end step event:
Code:
if global.click && !global.pclick {
    with bombup {
        event_perform(ev_mouse, ev_left_press);
    }
}
And run the game.
The recording will take over your mouse, but don't be scared!
Pressing escape will pause everything, including the recording, after which you can easily close the program.

Do make sure to not use both obj_recording and obj_replay at the same time.

Also do note that not everything is being recorder (pressing escape isn't for example) and I may have overlooked some details about your project, but it may be sufficient.
Currently, it only records pressing arrow keys, shift, spacebar, Z, mouse coordinates and mouse clicks on shop items.
I did make a recording, but after doing so I realized something. There is a heavy use of random() in my game. I don't think it's possible to have a perfect run through the game without it being off. Unless I got the seed somehow. (I assume random() uses a seed game maker makes at the beginning of the game that all random() functions throughout the game will use until it closes. If each random() function uses its own seed...that's a problem.)

I will do the replay anyway, just to see what happens, but I'll put some more lives on it so the replay doesn't get a game over.
 
T

Tribow

Guest
Thought I should also mention. While I was making the recording the game dropped in fps. Which was fine, it makes sense since I was recording all of my movements. However, while I was recording my movements, about 50 minutes in (which would normally be about 35 minutes in, but I was on a slower framerate), my fps suddenly went back to normal, as if I was no longer recording. The game played normally for about 4 more minutes until it needed to change rooms a 3rd time. At that point, it closed. No error as usual.

Also, I just did a replay knowing that it wouldn't quite be the same. Watched it until I stopped moving. There was no crash of course.
 
T

Tribow

Guest
Does the object causing the error already exist in the room or is it created at the moment it gives the error? I've had some weird error once where it seemed like the code in the create event didn't run the first step but the second after the object was created.

What also could cause this error is if object A is being created in the same step where object B tries to access the 'fade' variable from object A, while in the room's 'Instance Order' Object B comes before object A. Object A isn't actually created yet when object B tries to access it. Not sure if this is 100% true in every case, but I think I've had problems with this before.
It happens the moment an object is created. However, many instances of this object could have been created beforehand. That specific instance would throw the error/close the game. It can also happen when an instance is being destroyed.
 

jo-thijs

Member
I did make a recording, but after doing so I realized something. There is a heavy use of random() in my game. I don't think it's possible to have a perfect run through the game without it being off. Unless I got the seed somehow. (I assume random() uses a seed game maker makes at the beginning of the game that all random() functions throughout the game will use until it closes. If each random() function uses its own seed...that's a problem.)

I will do the replay anyway, just to see what happens, but I'll put some more lives on it so the replay doesn't get a game over.
Your assumption is correct, except that GameMaker:Studio uses the same seed at the beginning of the game every time.
You're supposed to use randomize to make things truely random.
randomize will set a new seed based on the current time.

Thought I should also mention. While I was making the recording the game dropped in fps. Which was fine, it makes sense since I was recording all of my movements. However, while I was recording my movements, about 50 minutes in (which would normally be about 35 minutes in, but I was on a slower framerate), my fps suddenly went back to normal, as if I was no longer recording. The game played normally for about 4 more minutes until it needed to change rooms a 3rd time. At that point, it closed. No error as usual.
That is interesting.
I'm not immediately sure what would cause this.

Also, I just did a replay knowing that it wouldn't quite be the same. Watched it until I stopped moving. There was no crash of course.
Was it not the same?

It's looking very unlikely this is a bug in the project.
You reinstalled GameMaker already (which you said did change the kind of issues you got).
You also cleared the cache and reopened your project from the GMZ file already.
As far as I know, 3 other people have taken a look at the project without being able to reproduce the issues.
I'm not sure what more to try.
Is your game running out of memory when it crashes (100% memory in task manager)?
 

DukeSoft

Member
Wait, you're doing this in your step?
Code:
var flags =
   keyboard_check(vk_left) +
   keyboard_check(vk_right) * 2 +
   keyboard_check(vk_up) * 4 +
   keyboard_check(vk_down) * 8 +
   keyboard_check(vk_shift) * 16 +
   keyboard_check(vk_space) * 32 +
   keyboard_check(ord('Z')) * 64 +
   mouse_check_button(mb_left) * 128;

buffer_write(mybuff, buffer_u8, flags);

buffer_write(mybuff, buffer_u16, mouse_x);
buffer_write(mybuff, buffer_u16, mouse_y);

buffer_save(mybuff, "recording");
I can see where your drive wouldn't like to continiously write an entire file, from start, every frame....
 

jo-thijs

Member
Wait, you're doing this in your step?
Code:
var flags =
   keyboard_check(vk_left) +
   keyboard_check(vk_right) * 2 +
   keyboard_check(vk_up) * 4 +
   keyboard_check(vk_down) * 8 +
   keyboard_check(vk_shift) * 16 +
   keyboard_check(vk_space) * 32 +
   keyboard_check(ord('Z')) * 64 +
   mouse_check_button(mb_left) * 128;

buffer_write(mybuff, buffer_u8, flags);

buffer_write(mybuff, buffer_u16, mouse_x);
buffer_write(mybuff, buffer_u16, mouse_y);

buffer_save(mybuff, "recording");
I can see where your drive wouldn't like to continiously write an entire file, from start, every frame....
Sure, but keep in mind that:

1) this is unrelated to the issue, as it was only added after the facts to make a recording, as per my suggestion.

2) because of the nature of the issue, it can't be predicted when the file has to be saved and every frame is important, so the file has to be saved every frame.

3) the lag caused by this recording stopped after a while.
 

ph101

Member
I had an issue with variable becoming "unset" in YYC gm2 2.2.0. It apparently was caused by having either many uses of show_debug_message or using debug_get_callstack which was bugged in this issue of gm2 in YYC. I'm not sure if its in 1.4 Commenting out all of these actually solved this issue. It probably isn't this beacuse this issue was only a problem in YYC not VM, but thought it still worth mentioning, if you h ave heavy use of either as the longet of long shots you could comment them out and see if anything changes.
 

jo-thijs

Member
I had an issue with variable becoming "unset" in YYC gm2 2.2.0. It apparently was caused by having either many uses of show_debug_message or using debug_get_callstack which was bugged in this issue of gm2 in YYC. I'm not sure if its in 1.4 Commenting out all of these actually solved this issue. It probably isn't this beacuse this issue was only a problem in YYC not VM, but thought it still worth mentioning, if you h ave heavy use of either as the longet of long shots you could comment them out and see if anything changes.
The project doesn't use those functions.
So, it's not that unfortunately.
 
T

Tribow

Guest
Was it not the same?

It's looking very unlikely this is a bug in the project.
You reinstalled GameMaker already (which you said did change the kind of issues you got).
You also cleared the cache and reopened your project from the GMZ file already.
As far as I know, 3 other people have taken a look at the project without being able to reproduce the issues.
I'm not sure what more to try.
Is your game running out of memory when it crashes (100% memory in task manager)?
Hm. I have been using random() since the beginning of me making this game, and I remember it saying in the manual to use randomize for true random, but I never did since...well I didn't really care. Especially if the bullet patterns were intricate enough it should still FEEL random. Ever since the beginning though, the random() seemed to be true random anyway. I thought it might have to do something the time in which something happened making the random be slightly different.

That aside, it's clear to me now that something was wrong with my game maker ever since the beginning, but the repercussions to that problem are only showing up now because the length of my game is long enough.

I use game maker through steam, so it might be possible that the what I have installed on steam is keeping the bug intact on some level.

Also no, my game is not running out of memory. The task manager never showed anything weird.
When you played the game the second time everything happened exactly the same way as the first playthrough right? (that would confirm that the project file is fine)
 

jo-thijs

Member
When you played the game the second time everything happened exactly the same way as the first playthrough right? (that would confirm that the project file is fine)
I'm not sure what you're asking.

Not everything was the same when I tested the game for the second time, because I gave different inputs then.
Besides that, I guess everything was the same?
 
T

Tribow

Guest
I'm not sure what you're asking.

Not everything was the same when I tested the game for the second time, because I gave different inputs then.
Besides that, I guess everything was the same?
Well, I meant that everything spawned at the same time it did the first playthrough. The enemies are spawned using random() (usually), so it should mean that the way enemies were spawned on the first playthrough should be the exact same as the last playthrough.
 

jo-thijs

Member
Well, I meant that everything spawned at the same time it did the first playthrough. The enemies are spawned using random() (usually), so it should mean that the way enemies were spawned on the first playthrough should be the exact same as the last playthrough.
If I provide the exact same inputs, yes.
Otherwise, no.
You use random every step in the step event of object ant,
so the way things spawn will be depend on how long the player waits before starting a level (as more random functions will have been performed before it).
 
Top