.9 fix I've not seen mentioned - Interpolate

quantumsheepquantumsheep Member Posts: 8,188
edited November -1 in Working with GS (Mac)
Hey all,

Apologies if this has been mentioned already, but I didn't see it in the release notes and personally, I think it's a tiny thing with big plusses for us.

Interpolate now has, as far as I can tell, collision attached to it.

This is awesome. It means you can make actors move smoothly, change size etc etc with interpolate, and that they will behave in the same way as an actor that uses 'move to' and all that.

Additionally, you can switch off the 'moveable' tag in an actor's attributes, potentially saving some fps (though I can't vouch for that!).

Real world example:

In a shooter, you can have a boss character that interpolates position and size but still has collision - so you can shoot it!

Or use interpolate to launch missiles up the screen, rotate, then move back down the screen.

Or have enemies 'zoom' onto the screen in an ordered and cool fashion.

I really like it, and like I said, not sure others have spotted it!

Hope that helps!

QS :D

Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io

Comments

  • ktfrightktfright Member Posts: 964
    Sweet! Great find QS
  • dotsonj23dotsonj23 Member Posts: 316
    ditto
  • quantumsheepquantumsheep Member Posts: 8,188
    No worries - I think it'll be a very helpful fix!

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • dmcdowelldmcdowell Member Posts: 128
    Thanks for noticing :) That one didn't make it onto the release notes.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Wow! That will help a ton!
  • jjonaszjjonasz Member Posts: 7
    I just tried something like this out and it seems that interpolate is still preventing a collision from happening. I have a bullet actor that grows in size over time (using interpolate). As long as interpolate is running, it will not collide with other actors. As soon as I delete the interpolate behavior the collisions return and the actor works as intended (a bullet :)

    -JJ
  • SparkyidrSparkyidr Member Posts: 2,033
    i did some testing on this last week.

    it seems the collision detection only works once the interpolate has finished..interpolating.
    whilst it's running, the collisions don't register.
  • quantumsheepquantumsheep Member Posts: 8,188
    @Sparky

    I have three enemy spaceships that would disagree with those findings! ;)

    They interpolate down to the middle of the screen, stop, fire, then interpolate off-screen.

    During all of these three phases, my shots are registering as hits on them!

    Curiouser and curiouser...

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • PhoticsPhotics Member Posts: 4,172
    dmcdowell said:
    Thanks for noticing :) That one didn't make it onto the release notes.

    This isn't new. Arcade Action, Game #2 uses interpolate on the twin bullets — to simulate a 3D effect. It actually uses four interpolate behaviors to change the size and the location of the bullets.

    As mentioned in The Unofficial GameSalad Textbook, throw the Interpolate behaviors in timer if the collision detection isn't working properly. If I'm remembering correctly, I think it was improved with 0.8.9 so I could remove the timer.
  • beefy_clyrobeefy_clyro Member Posts: 5,394
    I think if there is an issue, its when interpolating ones size. I think movement will be fine as the collision area is staying the same.
  • SparkyidrSparkyidr Member Posts: 2,033
    quantumsheep said:
    @Sparky

    I have three enemy spaceships that would disagree with those findings! ;)

    They interpolate down to the middle of the screen, stop, fire, then interpolate off-screen.

    During all of these three phases, my shots are registering as hits on them!

    Curiouser and curiouser...

    QS :D

    Thats weird.
    I created a test scene

    2 actors, with a collision rule that changed the value of an attribute, so I could view and debug.

    here is what I did to test.

    1. moved actor 1 to actor 2 - collision worked
    2. moved actor 2 to actor 1 - collision worked

    I then added 2 interpolates to actor 2 (width and hight)

    1. moved actor 1 onto actor 2 as it was changing size - collision doesn't register. Once interpolation was finished, then moved actor 1, and collision registers
    2. Moved actor 2 onto actor 1 as it was interpolating - collision doesn't register
    3. Wait for actor 2's interpolation to finish, then move it into actor 1 - collision registers.

    As beefy says. It's the size interpolation that's the issue. not interpolation in itself. Movement interpolations seem to work a treat.

    It's as though, the new collision size doesn't "kick in" until the interpolation has actually finished.

    in-fact....my tests show that that IS the case.

    AsI have stated in another post, I'm not sure if to report this as a bug, as it might just be expected behaviour.
    If anyone fancies yellowing up this thread to shed some light on it?

    Damn me for trying to make a 3d (ish) game ;)
  • quantumsheepquantumsheep Member Posts: 8,188
    Ah, I see!

    I misread it as interpolation in general - if it's a scaling issue, then I stand corrected!

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • SparkyidrSparkyidr Member Posts: 2,033
    no worries man.

    it's hard with "undocumented" features, as some stuff obviously seems to work ok (movement related interpolations) and some stuff not (size based interpolations)

    and with that, I'm off to size interpolate my belly by eating this cheese and ham toastie.
  • beefy_clyrobeefy_clyro Member Posts: 5,394
    Sparky i had the exact same problem, this was before .9 though. I got around it in the end by using a timer and generalising the rule.

    I havent got my mac here with me now but i think .. i will check for you ... i did something along these lines;

    1. Interpolate the size and width to what you want minus say 10
    2. When inetrpolating stops at target destination minus i had a rule that when it reaches the minus 10 it then carries on interpolating to the actual target.
    3. Have a rule with what collides that says if its above the target minus say 11, then collide.

    This way it was getting close to the final target size. Stopping and having a new collision size at 10 pixels less than the final size. Then the rule that states if its above that minus 11 pixels then it will collide as it will stop and register a new size.

    The stop happens so quickly you dont notice any change in movement.

    e.g. You want to interpolate to 100

    interpolate x and y to 90
    when width and height is > 89, interpolate w & h to 100.

    When width and height is > than 89 collide

    That way it grows to your desired specs but will collide when in that last section.

    I achieved mine by applying something similar to that, again i cant fully remember as i dont have my mac with me, hope that helps a bit though.

    I dont think its a bug as such but would be great if they could tweak how it works so you dont have to apply any workarounds.
  • SparkyidrSparkyidr Member Posts: 2,033
    wicked workaround beefy.
    will give something like that a go.

    Yeah, my thoughts are that it's not a bug too. Just how interpolate works.
  • PhoticsPhotics Member Posts: 4,172
    Sparkyidr said:
    It's as though, the new collision size doesn't "kick in" until the interpolation has actually finished.

    That's why you might want to throw your interpolate behaviors in a timer. I did mention that. HA HA. It is possible to add some 3d effects to your GameSalad game.
  • SparkyidrSparkyidr Member Posts: 2,033
    Photics said:
    That's why you might want to throw your interpolate behaviors in a timer. I did mention that. HA HA. It is possible to add some 3d effects to your GameSalad game.

    yeah.
    I must admit, I didn have a bit of a play around with wrpping stuff in timers at the time I was trying to get it to work....but I wasn't trying too hard. Just swearing at the screen a lot.

    @Photics. Yeah, with a bit of maths, and a bit of imagination, you can get some pretty nice 3dish effects going.
    the next test for myself is to get some more full on effects going. Afterburner/outrun style.
    Pretty possible for sure.

    I might post up some vids of what I have been up to soon.
  • PhoticsPhotics Member Posts: 4,172
    Sparkyidr said:
    Pretty possible for sure.

    Wow... that's bold thinking. I think a retro style shooter or racer, like Afterburner or Outrun would be a challenge.
  • SparkyidrSparkyidr Member Posts: 2,033
    I didn't say it would be easy.........just "possible" :o)
  • SparkyidrSparkyidr Member Posts: 2,033
    a quick 3d tunnel thing I've been playing with

  • quantumsheepquantumsheep Member Posts: 8,188
    I like! :)

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

Sign In or Register to comment.