• 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!

GameMaker Game Running Slowly

T

TheTrophieStars

Guest
I have been having an issue with the game I have been creating. On my new laptop, the game randomly has poor performance. Nothing in my game is stored in memory, so I don't think it's a memory leak. I am using cameras, I heard they cause memory leaks, but all I do is create the camera with the player create event, which runs once per level. The game runs perfectly fine on any other device.

Another Idea I had was that it was v-sync that was affecting it. I do have a 2.7k monitor. The camera size is 1920 x 1080 but the view size is 1024 x 768. I just can't pinpoint what is causing the game to stutter so much.

Code:
wport = 1024;
hport = 768;
camSpeed = 12;
camWidth = 1920;
camHeight = 1080;

if !view_enabled
   {
   view_set_visible(0, true);
   view_enabled = true;
   }
view_set_wport(0, 1024);
view_set_hport(0, 768);

global.currentCam = camera_create_view(x ,y, camWidth, camHeight, 0, obj_player, -1, -1, camWidth / 2, camHeight / 2);



display_set_gui_size(1920, 1080);


view_set_camera(0, global.currentCam);
camera_apply(global.currentCam);

This all of the code that has to do with cameras and views.
 
T

TheTrophieStars

Guest
I realize I misspoke. I just restarted gamemaker, and now the game runs perfectly. I don't understand what is happening to cause this.
 
E

EvieEm

Guest
Are you using hardware acceleration? My laptop defaults to software rendering instead of using the Nvidia card. When I rightclick on a GM executable and select "run with graphics card -> nvidia" (guessing here, my windows is in a different language) everything speeds up enormously.
 
T

TheTrophieStars

Guest
I'm not sure. I only have integrated graphics (I use a Surface to develop my games). I've never heard of such an option.
 

Flashpants

Member
I've also got this problem on my Surface Book laptop - my game has around 1/10th of the FPS on the laptop compared to my desktop PC. I haven't figured out exactly what is causing this yet, unfortunately.
 
E

Ephemeral

Guest
I am using cameras, I heard they cause memory leaks, but all I do is create the camera with the player create event, which runs once per level.
Are you destroying the created camera when you leave the room? If you're not, then I assume unassigned cameras will just kind of accumulate in memory every time you change rooms until the memory is overwhelmed. This is what "memory leak" means.
 

sp202

Member
@TheTrophieStars: Saying your game doesn't use memory is a silly statement, of course it does. Any sprites that are being drawn on screen are being stored in memory, variables are stored in memory. Perhaps what you mean is you aren't using data structures.

@Flashpants: Chances are that's simply because your desktop graphics card is 10x faster, unless it's a memory thing.
 
T

TheTrophieStars

Guest
I'll try destroying the camera, and I did mean I use no data structures. I just can't figure this thing out.
 
T

TheTrophieStars

Guest
I figured something out. My target fps is 60, but it runs at 40. If I increase the target, it gets closer to 60. Is there some sort of calculation I could do to keep the room fps locked at 60?
 
Top