Hello folks, I have a problem with my game. The longer it is open and you start playing it more and more jerking. I have no idea what else to change. The whole project is only 1.5 MB in size, graphics are all pixel art so nothing big. Does anyone have an idea of what it is?
run it in debug mode, and keep an eye on how many objects there are, how many collision checks, etc...
you may have enemies or bullets building up over time off screen.
Ok now i have found the Problem.. If i am on normal screen the fps are between 100 - 162... and generate objects between 100 - 120.. But if i go on fullscreen the object generation goes to 18000 - 27000+ objects perhaps the minimap.
Any1 can find the problem?
Ok theres a fullscreen Problem.
I have disabled the Minimap and now if i go in fullscreen the fps drops extrem.
that trigger once in the loop doesn't do anything, so it is creating new minimap objects for each obj_Ore1 on every tick... which will very quickly create thousands and thousands of objects.
what you might want to do is give the obj_Ore1 an instance variable that holds the UID of the minimap object assoiciated with it (and do the same for any other objects that need to appear on the minimap), then create the minimap object whenever you create a new object and store the minimap version's UID so you can pick it and update it as needed.
another way would be to make the obj_Ore1 a container so that the minimap object gets automatically created and associated (picked) with its parent object.
Hey thanks for reply. But can you give me a c3p example? Or can you change it in my Project? If i see what is changed i learn better :D
Develop games in your browser. Powerful, performant & highly capable.
here is a quick sample...
I will be out for a while, but could take a look at your file later if you post it here.
Thanks for your help. i will test your file and heres mine. If u have more Performance tips, feel free to Change it.
You don't need to use that "for each" statement inside of the player collision w/ ore block tho.
It's redundant a may drop performance a little bit.
Another tip is to set the "update" block to trigger at every 0.1 seconds. It'll help to alleviate the cpu load whenever there are many objects present.
You might wanna start to use families for the minimap icons and objects as well, since it may start to get a bit messy the larger your project grows.