My runner is 100,000 in scene.width... tips on making game smoother?
Simple Gamer Arts
Member, PRO Posts: 305
So yes, my runner game is 100,000 in scene.width and it's starting to get laggy.
Is testing the game on GAMESALAD different than when the game is an actual file and running on a device or up on a website HTML style?
So, what do you suggest I do for my game to not be so laggy?
All my actors have PRELOAD check "on."
Comments
What is causing it to be laggy ?
@Socks I believe it's 100,000 width and all the set platforms I have on it.
It used to be 50,000 width, but I decided to extend it to 100,000... it has set platforms that move to the left,,, making it a runner.
At 50,000 it had no lag...
I was curious I set 100,000 scene then move an actor at speed 150 to see how long it would take. I stopped it after 110 seconds. thats a big scene........ Maybe more levels but shorter? I guess unless your character is moving really fast thats pretty long......
I don't think you can get a straight answer to this , there can be many factors that affect your game's performance.
It might be a layering problem , image size , bloated code , number of actors that are using the physics engine (moveable) , device your using , heavy calculations constantly running every frame (abusing the constrain attribute) , actors on the scene that are not visible running code that is not needed (can include animations), rendering transparent pixels , heavy particle effects, amount of visible pixels on the scene / transparent pixels , conflicting logic , amount of code etc..
Try making a copy of your game "Save as " a different file and experiment with it , reduce the number of actors switch some behaviours on and off , try to trace whats causing the lag. Don't expect a straight answer in the forums its really hard to figure out what causes your game to lag , sometimes it can be from GS side , only you have enough information to look through the project and decide how to optimise it as much as possible and sometimes you might be forced to reduce some actors/game mechanics to make it work, many developers end up doing that. Game design/mechanics can easily be changed due to limitations of the target devices.
The scene size has no effect on performance. The number of actors and number and type of rules within those actors will have an effect on performance.
Those platforms only need to exist (and their rules only need to fire) when they are viewable by the player - so you should ideally spawn them just outside of the camera - they scroll through the frame - and are then destroyed when they leave the screen on the left . . . . doing it this way means you will only have 3 or 4 (or whatever) 'live' actors firing (and impacting performance) compared to having dozens or hundreds (to however many you'd typically have in a 100k px wide scene) of actors firing at once.
There is an option that says Can Sleep. Never tested it myself if it makes a difference to actors though.
GSLearn.com | Templates | Free Demos | Udemy Course
The thing is, I have meticulously placed every platform in this long 100,000 scenario... they're all moving at a speed 1400... there must be like a 1000 of them or more... that should be it... cause at width 50,000 it was still very smooth.
Yes, the platforms are being destroy as soon as they exit the screen.
The good thing is that those platforms have no image... they are just normal solid blocks from game salad.
Thank you I appreciate your help Socks
@Two.E Thanks, I will give it a shot.
@Icebox Thanks for that Icebox, I will definitely experiment. Little info helps like as Socks said that scenario width has no impact in game performance, which is good to know. I also read that timerspay a heavy toll when it comes to performance... so coders try to replace them with interpolate and loops ect. Little details like that help guide.
I appreciate your help please keep it coming if you have any more info.
@Toque The platforms are traveling at 1400 speed... remember, it is at 720 HD... which is the equivalent as 700 speed if it were in iPhone5 screen size.
Instead of moving all the platforms, move the camera and player.
@BBEnk Damn, that sounds like a plan!!! Gave me the holly grail there man, I'll try it out. Makes sense that it should cut down the lag. THANKS!
@BBEnk You did it! thanks! SUPER SMOOTH PERFORMANCE
Why not move the player rather than the platforms, an instant saving of 1,000 move rules ?
EDIT: what BBEnk said !
Yes, totally worked. Thank you as well @Socks !!!
That's really old info, and not really accurate anymore. Unless you have tens to hundreds of timers, you won't see a significant effect.
Great you got your problem solved!