Kodiqi
Member
GMS v1.4.1804
I have a Breakout style game which involves multiple balls (up to 1,000) and bricks (up to 100) on screen at a time. This means I have a lot of frequent collisions and I am getting some significant lag in the HTML5 version of my game. I'm just wondering if there is a better way I should be approaching my collisions to reduce this lag?
Initially, I was using place_meeting in the Step event of each Ball object to check if it met with a brick in its next step. After reading about grid collisions, I switched to using a ds_grid to store the location of the bricks, then in the step event of the Ball, I had it lookup the relevant grid to get the Brick ID (if any) it would collide with (images below might help explain the setup).
In the Windows build, this did have an improvement on performance; with 500+ Balls active I could maintain over 100 fps still. In the HTML5 build though, I still saw a lot of lag. Is this just the performance hit I have to live with in HTML5? Is there a better (faster) way for me to handle collisions specific to HTML5 (or in general)?
Link to my game: https://kodiqi.itch.io/idle-breakout
I have a Breakout style game which involves multiple balls (up to 1,000) and bricks (up to 100) on screen at a time. This means I have a lot of frequent collisions and I am getting some significant lag in the HTML5 version of my game. I'm just wondering if there is a better way I should be approaching my collisions to reduce this lag?
Initially, I was using place_meeting in the Step event of each Ball object to check if it met with a brick in its next step. After reading about grid collisions, I switched to using a ds_grid to store the location of the bricks, then in the step event of the Ball, I had it lookup the relevant grid to get the Brick ID (if any) it would collide with (images below might help explain the setup).
In the Windows build, this did have an improvement on performance; with 500+ Balls active I could maintain over 100 fps still. In the HTML5 build though, I still saw a lot of lag. Is this just the performance hit I have to live with in HTML5? Is there a better (faster) way for me to handle collisions specific to HTML5 (or in general)?
Link to my game: https://kodiqi.itch.io/idle-breakout