Game Slowed down


#1

Hello admins and developers,

i have created a very nice game, with effects and solider sprites and so on, the game is like tower conquering game, you order your soliders to move from tower to another by dragging, number of soliders come out is half the total number present in the tower, and they are created by repeat for (time) and in hidden view.
a timer for each created solider is then triggered with scene variable to show and move them one by one to the tower.

now the problem is when there are many soliders viewed on screen the game slows down, but not upon creating so its not related to number of sprites rather than the visible movement on screen.

i have set the min. FPS to be 60 and max. FPS to unlimited but still issue isnt fixed.

can you please support.
thanks
Stormer


#2

Try to share some screenshots of your events so we can analyze and provide some tips. Maybe is for the assets or some foreach that is involved in the soldiers collision who knows. As I. said if is possible for you to share the events it would be better for everyone to help you.


#3

Thanks @UlisesFreitas,
sorry i was away from my PC and couldnt attach the screen shot.
belowis the creation event

also the collision event

yet and as i said none of those has an issue as soon as triggered, the issue is when there is a number of sprites in screen.

@arthuro555 @Gruk hope you can help.


#4

You are iterating through each tower and each soldier every frame. I would look at reducing the number you are iterating though :

  • put the tower repeat conditions into a normal event.
  • off this new event, have a subevent that repeats for each tower with the actions that change the tower’s variable, with the further repeat Tower.Variable(count) event off that:

Similalry for your repeat for each soldier event. Make a repeat event of the event that checks soldier’s tId & tID1 :

This may help, but the issue could be in other events.


#5

I really thank you @MrMen , i will try it as soon as i connect to the game.
however those action as i said doesn’t trigger slow down, i have removed the background to see all sprites in action and all of them were created smoothly, the problem begins when too many soldiers are moving across the screen not just standing waiting for the move trigger.

by the way the game regain its original performance when the number of soldiers visible on screen are fewer.

Stormer


#6

Found It , thanks @MrMen and @UlisesFreitas,

i thought i should revise all the actions related to soliders first, one of the action to move the soldier was iterating for each solider, thats made the game slow, i added a variable condition to prevent that from happening.

thanks again you gave the idea to look back on “for each” conditions.

Stormer