Best Way to Make a Timer Every 0.01 seconds

I have a timer that I want to have spawn an actor every 0.01 seconds. Using the timer rule makes the game a bit buggy. Are there any ways to improve performance, or any ways to avoid using the timer?

Comments

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
    The fastest that GameSalad can go is 60 frames per second. Thats slower than 0.01 seconds (which would be 100 frames a second).

    You might try making a timer set to every .05 seconds and spawn 5 actors at once. You might achieve the desired end result (100 spawns per second) that way.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited April 2013

    Hi @CandDApps Good advice from @SnapFireStudios and good thinking from @RThurman...

    Another way would be for a spawned actor to spawn... so in the Prototype actor Rules that's first spawned:

    Timer: After 0.01 seconds
    Spawn
    ---Behaviours for Random x,y I guess...

    One point: 0.01 is such a small amount of time, and as RT pointed out, that's 100 actors per second.... after just 10 seconds you'll have 1000 actors.... but hey, if that's what you're after...

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • POMPOM Member Posts: 2,599
    edited April 2013
    The fastest that GameSalad can go is 60 frames per second. Thats slower than 0.01 seconds (which would be 100 frames a second).

    You might try making a timer set to every .05 seconds and spawn 5 actors at once. You might achieve the desired end result (100 spawns per second) that way.
    Hey @RThurman, I don't think that there is a relation between the 60 fps and rules or behaviors such as timers, the fact that the highest fps is 60 don't limit you to make 60 actions per second.
    You can absolutely spawn 100 actors per second, although its highly not recommended, and probably will take more than 1 second for the engine to execute.

    @CandDApps What are you trying to do exactly? Maybe give a bit more info and we can help finding a different way to achieve the same effect..

    Roy.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
    edited April 2013
    @POM -- you are right, there probably isn't a relationship between 60fps and many of the behaviors. For example, a constrain behavior will work as fast at it can.

    However, the timer can't go much faster than .033 seconds. Even though it should theoretically be able to go approximately .0167 seconds. (There is a reason for this -- the relationship between the two numbers should give a hint.)

    The original post seemed to indicate the use of the timer behavior. I was just pointing out that the timer can't go that fast (0.01 seconds). So... one way to work around that limitation is to use a slowed down timer, but squeeze more spawn behaviors into its timing window. Its much more consistent to do it this way. That is, one will get a more consistent 100 spawns per second than if one attempts use a "0.01" timer.
Sign In or Register to comment.