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

Performance issues with multiple objects [SOLVED]

Still57

Member
Hey everyone!

I made a Minesweeper game for Android and iOS (I'll leave links down below) and noticed that my iPhone 6 was burning up after I played with it for around 10 minutes. I am using GameMaker Studio 1.4.x (the release prior to the latest one).

This is how I programmed the game: I create a grid for which individual cells will sit on and you can adjust the size of the grid. So I create a cell object for each spot on the grid (which is a 2d array). Eg. if the board size is 9 x 9 I create 81 cells (thus 81 objects), 1 for each spot on the array. Now this is fine for GameMaker but, the problem occurs for larger board sizes. I programmed the ability to customize the board size in the game and the largest you could go was 30 x 24. I initially set the room speed to be 60 fps. I saw a lot of lag after this so I dropped the room speed to be 30 fps and I still saw a lot of lag! So I tried different board sizes and the max it could kind of handle was 30 x 16 = 480 cells (so 480 objects). Even with this setting the devices I try the game on heat up really fast. Also note that their isn't any heavy processing going on in these objects and the number of objects in the room apart from the cells is 20 at max.

I had this issue with one of my other games before where I had 200 button objects at one time. I solved this by creating 1 object that would draw all 200 buttons and process all of their button press functions. But the problem with this is that it is not convenient. I mean I should be able to have 200 button objects in a room at the same time.

So my point is: Why can't GameMaker handle this many objects at the same time? I feel like 500 objects in 1 room is the most it could take for my Minesweeper game. Any thoughts or suggestions on this?

Google Play Link

iOS App Store Link
 
Last edited:

RangerX

Member
Instead of one object per cell, why not having a grid with the grid functions? You might be able to create your game with just a couple of objects there.
 

Mick

Member
So my point is: Why can't GameMaker handle this many objects at the same time? I feel like 500 objects in 1 room is the most it could take for my Minesweeper game. Any thoughts or suggestions on this?
Gamemaker can definitely handle more than 500 instances in one room, it all depends on what those instances do. Often when there is this amount of lag like you now experience, the problem is in the code, something that could be heavily optimised.

Anyway, what @RangerX suggested seems to be a good optimisation.
 
Have you disabled surfaces? Having surfaces enabled can cause significant performance problems with android devices.
You can disable surfaces by putting " application_surface_enable(false); " in your rooms creation code.
 

rwkay

YoYo Games Staff
YYG Staff
We have fixed the majority of the performance issues with the application_surface(), these days I would not recommend switching off the application_surface

Russell
 
We have fixed the majority of the performance issues with the application_surface(), these days I would not recommend switching off the application_surface

Russell
Does that apply to "GameMaker Studio 1.4.x (the release prior to the latest one)."? Probably 1.4.1763 Because that's the version Still57 says they're using.
 

rwkay

YoYo Games Staff
YYG Staff
It looks like the fix went into 1.4.1767 and any EA after release 551 - it is in the release notes as

"Misc In-game
Removed Scissoring testing of surfaces on mobiles (in most cases), gives a decent performance boost on some devices

And affects OpenGL devices (so iOS, macOS, Linux as well as Android)

Russell
 

Still57

Member
Hey everyone thanks for the suggestions. It turns out I forgot to optimize the code that handles the positioning of the cells. I had 2 nested for loops that went through each of the 480 cells in the grid and updated their positions EVERY FRAME! Obviously this was why the phone was heating up. I optimized the code and its all good now. I'll think twice next time before blaming GameMaker for performance issues :)
 
Top