Mac OSX Game View Rewinding to Previous Frame Before Transitioning Rooms

tylorlilley

Member
Hey there,

I originally posted this in the tech support forms here but am reposting it based on advice I was given in that thread here in the programming section.

I have used GameMaker in the past but recently upgraded to GM Studio 2 to try it out. I have imported a project I had from 1.4 and overall it seems to work just fine, but something really weird is happening when I transition rooms. Whenever I move to a new room it first displays the PREVIOUS frame for a split second. This makes it look like the character jumps back for a minute before popping into the next room. At first I thought it was a position glitch or something but after trying out some more things like having moving enemies on screen it looks like they all pop back to where they were at the start of the frame as well. I have searched online and not found anyone talking about something like this... does anyone have any idea where I can even start with troubleshooting or fixing this?

example.gif



You can see in the above example the way it pops the character back down to where they were in the previous frame after touching the stairs but before transitioning to the next room. At first I thought it was just an issue with the stairs but it turns out this happens no matter what triggers the room transition, and not just the stairs. In fact, I went ahead and recreated this issue in a brand new project using only the bare minimum of two objects and two rooms and you can see the same thing happening. This is me only holding the right arrow key to move steadily right and on the frame where it would overlap the transition object it instead appears to skip to the left before transitioning as if it had overlapped, just like in my real project above.

example2.gif



I tried compiling with HTML 5 instead of macOS and the version of this test project in the browser does not seem to have this issue. I also tried exporting a macOS exe and that one DID still have this issue. Unfortunately I can't get YYC working on either of these projects so I can only test with VM. Can someone help me understand what could be causing this even in a brand new project? The new project only has the following code in it:


GML:
// obj_player create event
image_blend = c_red;
game_set_speed(10, gamespeed_fps);
depth = -1;

// obj_player step event
if (keyboard_check(vk_right)) { x += 4; }
var transition = instance_place(x, y, obj_transition)
if (transition and transition.x == x and transition.y == y) { room_goto_next(); }
Thanks in advance!
 

obscene

Member
I don't have a Mac at the moment, but a long time ago I made a mac build and experience a similar-ish issue. I was using frameskipping (turning the draw event off and on) in order to boost performance. On PC, this results in the same frame remaining on screen during the skipped frame. On Mac, it drew the previous frame instead which caused everything to appear to jerk back and forth.

Did I find a solution? No. lol. Sorry for not being helpful, but there was nothing to be done. I cursed Steve Jobs and disabled the frameskipping option on Mac. I'm sure the 2 people who bought my game on Mac got over it. But I'm curious, with you running at such a terribly low framerate of 10, if that's not related to the issue. Perhaps you need to run at a minimum framerate on a Mac. I would try 30 and 60 and see if the problem went away, and then you'll have to slow your game down with another method to simulate the 10fps you want.
 

angelwire

Member
I just wanted to pop in and say that I ran a test on a windows build and I couldn't replicate the issue. So it seems to be specific to the macOS export. For a workaround, you could replace room_goto_next(); with alarm[0]=1; and then have the alarm[0] event call room_goto_next();
 

tylorlilley

Member
...I cursed Steve Jobs and disabled the frameskipping option on Mac.
Can you explain how you did this? I would happily try disabling that to see if it fixes my issue, but I am not seeing a frameskipping option anywhere. This is the first I have heard of it.

I just wanted to pop in and say that I ran a test on a windows build and I couldn't replicate the issue. So it seems to be specific to the macOS export. For a workaround, you could replace room_goto_next(); with alarm[0]=1; and then have the alarm[0] event call room_goto_next();
I tried your suggested work around, and it did not help - still experiencing the same thing as in the gif posted above.
 

obscene

Member
Can you explain how you did this? I would happily try disabling that to see if it fixes my issue, but I am not seeing a frameskipping option anywhere. This is the first I have heard of it.



I tried your suggested work around, and it did not help - still experiencing the same thing as in the gif posted above.
No, you misunderstood. The frameskeeping option was something that I made. My point is that your issue is probably related to the way Mac OS draws and not your code. The first thing I would try would be setting your frame rate to 30 or 60 and test.
 

tylorlilley

Member
That's strange. Maybe setting the alarm to 2 will help?
I tried that as well but that just allows another frame to go by - the skipping issue is still there because it still happens whenever a room transitions.To elaborate, with alarm = 2, the red square moves a few pixels past the white square before transitioning, but it still jumps back to right on top of the white square right when the transition happens. That jitter is still there. Increasing the alarm by one just makes the transition happen one frame later.

No, you misunderstood. The frameskeeping option was something that I made. My point is that your issue is probably related to the way Mac OS draws and not your code. The first thing I would try would be setting your frame rate to 30 or 60 and test.
Ah, I see. Yeah, it sure seems related to the way Mac OS draws is what I feel. Especially since the HTML5 version seemed to work. It seems like a bug? Maybe I should submit a bug report... I don't really know what else to do at this point. I'd love to try it with YYC output instead of VM output just to see if that makes any difference but I can't get YYC output to work for any of my projects right now. :(

Oh, and it still happens at 60fps. It's less noticeable simply because the frame goes by quicker but if you are looking for it you can definitely see it. It's also possible to see if you slow the gif down and go frame by frame (see the below gif from a 60 fps version).

example4.gif
 
Last edited:

tylorlilley

Member
If you'd try changing the game speed like I recommended we could learn something...
It's not the game speed. Still happens on 30 and 60 fps. Sorry, you must have posted while I was in the middle of testing that and updating my previous post.
 

obscene

Member
Oooh, that is interesting. Really thought that would do it. Wish I had a mac to test on to help you figure it out.

Also, though I'm 99% sure it's unrelated, put a semicolon at the end of that var declaration as that can cause some buggy things to happen sometimes.
 

obscene

Member
To workaround, you might try something like drawing a black rectangle over the screen before changing rooms, or disabling the draw event. I'm certain it could be worked around somehow while you wait for your bug report to be resolved, which honestly may never, ever happen.
 

tylorlilley

Member
To conclude this - I submitted a bug report on this and they said "I have now confirmed the issue and reported it in our bug database". So I guess all that's left to do is wait and hope it gets fixed in a future update. I'm surprised this is a bug and that I'd be the first person to notice this given that it seems like it would affect ANY macOS export that transitions rooms at all... which I would guess is a sizable amount of macOS projects. Maybe that will give it some weight to how they prioritize fixing it, I don't know.

Thanks for all your replies/suggestions though - I appreciate you trying to help me out with this! I'm not sure that drawing a blank screen or anything will work because I would have to somehow draw it on the frame BEFORE the transition happens in order for it to get drawn at all... I'll experiment with work arounds and see if I can't come up with anything. :(
 
Top