Should I interpolate or move?????

PortymanPortyman Member, PRO Posts: 409
edited November -1 in Working with GS (Mac)
I have a game that requires platforms to move upward. I have them set using the move behavior . Shpuld I rework gem use interpolate to save on game overhead?

Has anyone seen a significant improvement?

Thanks

Comments

  • DimensionGamesDimensionGames PRO Posts: 993
    interpolate. Move to is known to be buggy.

    Hope this helps :)
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    interpolate does not require your actors to have 'moveable' checked, which really helps with performance if you have a lot of actors.
  • PortymanPortyman Member, PRO Posts: 409
    That's the key fact, that moveable can be unclicked... It will be some work, but I will do it an give a full report.

    Thanks
  • AppChogieAppChogie Member Posts: 503
    Always interpolate you will never need move again!
  • EatingMyHatEatingMyHat Member Posts: 1,246
    But how can you have fix speed for interpolate?
  • DimensionGamesDimensionGames PRO Posts: 993
    changing the duration
  • EatingMyHatEatingMyHat Member Posts: 1,246
    the calc logic for that can be a headache if you need to go from X1/Y1 to X2/Y2 in fixed speed. Would it be better just to use Move in that case?

    Does anyone have a sample of using interpolate for that?
  • ORBZORBZ Member Posts: 1,304
    Constrain w/ game.time is fastest on the cpu, and the most complex to implement, it creates linear unnatural motion, but can push a LOT of objects around with minimal overhead.

    Interpolate is 2nd fastest cpu usage, middle complex to implement, easing functions provide smoother motion.

    Move is 3rd fastest, easy complexity, linear unnatural motion.

    Accelerate, most cpu intensive, easy complexity, very realistic motion.
  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    That's great to know Orbz - thanks.

    I have actors that use the move attribute with the speed set to a multiple of the player's score. This seems to result in a smooth movement and means all the different actors keep to the same speed. Also, the speed will be updated while the actor is moving as the player's score goes up or down.

    I used to have the actors change velocity every 0.01 seconds (using self.time, not a timer attribute) to a multiple of the current player score. But this gave a jerky movement and worse fps than using the move attribute.

    Could you give an example of how I could achieve the same thing using constrain with game.time?

    Cheers!
  • CapCap Member Posts: 225
    But what about collision? Does that work when using interpolate?
  • StormtrixStormtrix Member Posts: 256
    I believe collision does work with interpolate.. But, another question is - could you really use interpolate to lets say bounce an actor around the screen?
    If i put 4 walls up around the screen... how would you have the actor bounce around when usually interpolate is just moving to one spot. Timers and rules for when you reach a certain spot on screen?
  • AquariusAquarius Member Posts: 282
    Hmm. I usually use "move to" and I get no issues. Maybe I should play around with interpolated for fun
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Stormtrix said:
    I believe collision does work with interpolate.. But, another question is - could you really use interpolate to lets say bounce an actor around the screen?
    If i put 4 walls up around the screen... how would you have the actor bounce around when usually interpolate is just moving to one spot. Timers and rules for when you reach a certain spot on screen?

    if thats the case you wouldnt really need any sort of constant interpolate or move. You would just set one move or interpolate to start it up, then have your restution on the ball and walls set to how you want the bounce to be. To keep a continuous speed every time the ball collodies with the ball change its linear velocity to your set speed, or have a random change linear velocity as well if you wanna get crazy with it.
  • EatingMyHatEatingMyHat Member Posts: 1,246
    The other issue I had with interpolated is changing directions. With move you can just issue a new moveTo and it will start moving to the new direction using the new coordinates. With interpolated it seems that you first need to stop it by issuing an interpolate to your current position in order to cancel the previous one and than issue the new interpolate with the new location. Issuing a new interpolate command before canceling the previous one seems to work as 'cancel and change attribute'.

    While the logic might still be worth it from a CPU prospective, it did generated some jerky movement while moveTo was fairly smooth (at least until it reaches it's destination and have a small correction jump...).

    GR
  • StormtrixStormtrix Member Posts: 256
    JohnP -- hmm trying to think this out what you said.

    Interpolate is a attribute to an attribute over time.
    so in my lets say ball actor i put -

    Interpolate: self.position.x to 300 - duration: 4 sec.
    Interpolate: self.position.y to 340 - duration: 4 sec.

    it'll start to move at a upper right angle on landscape screen.. once
    it hit's the wall it should just bounce? don't see that happening. it wants to just move to that spot and doesn't bounce.. even if it did bounce it just doesn't seem like interpolate would give it the velocity to keep going?
    maybe i'm thinking this wrong

    i'm trying to have letters bounce around the screen without using the Moveable selected and Change Velocity feature to have it move.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    sorry didnt know you were trying to do that will moveable unchecked. That will turn the restitution off so it wotn boucne. If it was on though you coulod interpolate to one pixal over lapping the walls and when it hits the collision kicks in rule with high restitution on the walls and a lower one on the ball and by playin around with it you could get a continous bounce for a while
  • StormtrixStormtrix Member Posts: 256
    hmm turning moveable on the wall and ball make the wall move when hit.
    even with restitution at 2 and ball at 0

    kind of thinking there isn't a clean way to do it in place of using a 'moveable' actor with change velocity.
Sign In or Register to comment.