Is there a way I can reset my spawner timers every 3 seconds so that they don't have lag over time?

Skyler128Skyler128 Member, PRO Posts: 10
Is there a way I can reset my spawner timers every 3 seconds so that they don't have lag over time?
It starts to lag after 15 seconds. Here is what I have.

Timer every 1.1 seconds
spawn actor ball1

Timer every 1.8 seconds
spawn actor ball2

timer every 0.7 seconds
spawn actor ball3

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Can you describe what you mean by "lag"?

    Are they not spawning when expected? Try adding a Log Debugging Statement to each actor with "prec(game.Time,1)" in the expression editor. That will output the time the actor is spawned in tenths of a second. You'll need to open the Debugger window to see the output.

    Do your ball actors have processor intensive rules (e.g. lots of constrains, spawns, particles, etc.)?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Skyler128Skyler128 Member, PRO Posts: 10
    They spawn when expected.
    Its the frame rate that goes down, making it less and less responsive.
    My actors have direction 0.0 horizontal position random(70,350)
    and vertical position 30

    Here is what the debugger said each time a ball is spawned
    Log(Actor: spawnpoint): prec(game.Time,1)
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I guess I don't understand what you mean by "spawner timers" then. Are you creating custom timers? Or do you mean that after you spawn a certain number of ball actors, everything slows down in the game?

    According to your spawn rules above, you would have a maximum of about 44 actors after 15 seconds. That shouldn't be enough to make the game lag, but again it depends on each actors' rules. You don't say if the actors are moving but if they are, you might want to destroy them after they leave the screen boundary.

    I'm not sure the debugger is going to be helpful since I misunderstood you but to get it to work properly, you have to click on the 'e' button to edit the expression and then select game.Time from the drop-down menu instead of typing it in.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Skyler128Skyler128 Member, PRO Posts: 10
    In my Ball actors I have
    Accelerate Direction 270
    Acceleration 90

    Rule
    Actor receives event overlaps or collides with actor of type bird
    spawn actor squish
    destroy this actor
    change attribute game.score to game.score+4

    Rule
    Actor receives event overlaps or collides with actor of type floor
    destroy
    destroy this actor
    change attribute
    change attribute game.HP game.HP-1
  • Skyler128Skyler128 Member, PRO Posts: 10
    my actors move
    after they spawn a certain number of ball actors, everything slows down in the game.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Here's a demo I made that doesn't seem to suffer from lag. I didn't destroy the balls at all.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Skyler128Skyler128 Member, PRO Posts: 10
    I test it on my Iphone 4s
  • Skyler128Skyler128 Member, PRO Posts: 10
    The lag happens on my iphone 4s
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    The lag happens on my iphone 4s
    Good to know. Does lag occur with my demo file or just with the project file you're working on? I don't notice any lag on my iPhone 5 with my demo file.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Skyler128Skyler128 Member, PRO Posts: 10
    Thank you I will test your template on my iphone.
  • Skyler128Skyler128 Member, PRO Posts: 10
    Just the project file that I am working on.
Sign In or Register to comment.