goglness.blogg.se

Docs2 motion planning gamemaker
Docs2 motion planning gamemaker







docs2 motion planning gamemaker

Take off vsync and remove enemies and see how much fps you have. What is really going on here though? Do you have vsync on? Is that why the FPS shows as 60 without enemies? You need to turn of vsync for a moment while you resolve this. If your expecting to only lose 10 or so fps with that many enemies it's just not possible. Your game should run much faster than that. If your saying that your game runs from 50 to 60 fps without enemies then there is already a problem. I still think something else is going on.

docs2 motion planning gamemaker

DOCS2 MOTION PLANNING GAMEMAKER CODE

You might expect from reading the code I put above, that I call it more than 5 times per step, but some place_meetings only are triggered when an if statement returns true. And we call scHspd() 135 times per step, because there are 135 enemies on the screen. 30889 times place_meeting seems incredibly much at first, but we run place_meeting 30889 / 6187 = 5 times per step per scHspd() call. If we do the math right it calls scHspd() 6187 times in 46 steps.

docs2 motion planning gamemaker

But after running the profiler I have found the thing that is causing the most lag of all. Yes, there indeed are many possibilities. There are so many possibilities why you could be experiencing lag it's difficult to say. With the enemies the counter shows a value around 30 to 40 fps.Ĭhecking if the enemy is going to collide with a solid object, then if so, move it as close to the solid object as possible and then reset the values.Īre you looping at all after the collision? Are you looping through collisions? Without the enemies the FPS counter shows 50 to 60 fps. I have ran the profiler in the debugger and it said that the enemy object was taking in the most memory. If(place_meeting(x+hspd_final,y,par_solid))Have you tried removing place_meeting to make sure that it is in fact causing the lag? *edit 3: Okay, just tested again with 32x32 precise collisions (circles) and that really didn't seem to reduce the FPS by that much to my surprise. *edit 2: Okay, I was curious to see what is possible with place_meeting, and with my tests it shows that I can have over 2,000 place_meetings running all at the same time, even all colliding at the same time, and my FPS only drops to about two thousand (instead of 5,000). *edit: also, are you running precise collisions? If so, what resolution is your sprites? The more pixels the more processing, so if your running precise collisions on high resolution art then yes it will be slow. Not to be rude, but I would almost be assured the issue is in some way that you have implemented the code, unless you are really running the function many hundreds of times per step. Place meeting is about as basic as it gets with gamemaker collisions apart from writing your own simple bounding box code, which I doubt would be any faster. Also, are you certain that you have enemies outside the view disabled? Are you certain your not accidentally calling place_meeting many times per enemy per step? Or maybe there is another reason the game is lagging? Have you tried removing place_meeting to make sure that it is in fact causing the lag? And how much lag, just a bit or a lot? What device are you testing on? What are you doing with the collision? Are you looping at all after the collision? Are you looping through collisions? There are so many possibilities why you could be experiencing lag it's difficult to say. How many enemies are you talking? I'm not sure how many is too many, but I would suspect you could get away with at least a couple dozen, if not a hundred or so, place meetings each step without a tremendous amount of lag, but that all depends on the device your running it on.









Docs2 motion planning gamemaker