GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Constrained actors not moving in sync, not colliding with walls and scrolling backgrounds

Hey there,
I'm working on a project wherein I've created an actor, and have constrained its various body parts in order to get perfect collisions. It's working and its constrained perfectly but I have three issues, viz :

  1. Constrained shadow (Being placed at the bottom of other parts obviously) moves with a lag when the entire actor moves.

  2. I've set up walls on three sides of my screen, have set up collide behaviours to enable them to collide with my actor(tagged with other group of actors and parts) but still, it wouldn't collide with a few actors and would collide with others. (Half of my actor moves off the screen and only its main body collides even though other parts are set to collide as well) and yes I've also tried adding collide with walls behaviours in the actors but even that doesn't work. Also, on scrutiny, I found out that when I tick "Movable" under walls, it collides properly, but when Movable is set to off (un-ticked) it only collides partially with a few body parts only.

  3. The most annoying issue,
    I have my background scrolling infinitely (Portrait scrolling), using tricks and tips given by Jamie cross, BBEnk and others (Cheers for your extremely helpful videos guys) I've set it up perfectly and have used BBEnk's tip for Universal builds and it works wonders using camera and offset actors and using stretch while keeping the actors size intact. The issue which I face is, When I use stretch while previewing on other platforms, say on an iPhone 6 plus (Ive made the project taking iPad portrait as the base), what happens is, there is a big black belt that appears between two backgrounds when I preview on other devices (In GS Creator), This belt does not appear if I preview it normally using iPad portrait as screen.
    BBEnk suggested to use a larger background but that too does not work for me.

Please help me solve these issues
Thanks and regards,
Harsh

Comments

  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,913Member

    Constrains override the physics engine so collisions will not effect constrained actors. You will need to constrain the shadows to the velocity of the actors movement. There is a video over at gshelper on constraining and keeping collisions intact.

  • HopscotchHopscotch Posts: 2,782Member, PRO
    edited July 2015

    @harsh3112 , regarding nr 3:

    I do not use BBEnk's method, but know how it works. I can only imagine that this method is at odds with aspect adjusted moving background images. The method squashes or stretches the images to correct the aspect ratio, their position on the scene does not change though. This is what causes the big gaps between them. At different aspect ratios they might overlap due to increased width.

    You would either have to do complicated calculations to reposition the background images - moving them closer together or farther apart - to counter the scaling. Or, not apply the scaling to the background images at all.

    Personally I would not use BBEnk's method in this particular instance, given that you want aspect adjusted background images.

    In this case I would suggest Overscan and using @Lovejoy 's method for positioning stationary elements on screen: http://forums.gamesalad.com/discussion/86157/my-universal-binary-overscan-secret-weapon/p1

    @BBEnk, this does not put your excellent method down, it just overcomplicates particular projects which rely on moving background images. Correct me if I am wrong.

  • HopscotchHopscotch Posts: 2,782Member, PRO

    @harsh3112, regarding nr1:

    the shadow lag you are seeing is due to the fact that in the order of processing, your shadow is drawn before that actor. Thus, the actor updates the constrain attributes, but the shadow only receives/uses then on the next draw cycle.

    To get around this, have an invisible main actor (with all the logic as the current actor) at the bottom of the stack. This actor updates its position to the game attributes. Then follow the shadow and then the image of the actual actor.

    This way, the updating and all the constrains happen in the same draw cycle and stay synchronized.

  • harsh3112harsh3112 Posts: 10Member

    @Hopscotch Hey! Thanks !! I had read this article before, had tried it earlier as well but it never worked for me earlier as I totally forgot to refresh after switching devices! It works perfectly! Could you tell me how do I fix a colliding with walls using @Lovejoy 's method as the walls are far beyond the screen edges after devices are switched. Hence the actor goes too far beyond the screen after applying the method.
    Thanks again pal!

  • harsh3112harsh3112 Posts: 10Member

    @Hopscotch Re;Constraining Shadow : Thanks for this invaluable tip! I'll do it! I'll duplicate the actor which used to be the main actor, make it invisible and constrain all other actors to its position and shift it to the bottom of the stack as you suggested! Thanks !!

  • harsh3112harsh3112 Posts: 10Member

    @The_Gamesalad_Guru Thanks for explaining pal! @Hopscotch 's idea fixes the constraining shadow issue. Thanks a lot for your prompt response ! :blush:

  • HopscotchHopscotch Posts: 2,782Member, PRO

    @harsh3112 said
    the walls are far beyond the screen edges after devices are switched

    Maybe post a screenshot or a sketch describing your question.

    In @Lovejoy 's method you use overscan and don't scale or reposition the gameplay elements at all. Rather just reposition the stationary HUD elements.

  • LovejoyLovejoy Posts: 2,078Member

    Sweet, I'm glad some find my method useful. I should of added to hit the reset button when changing devices, seems like many people forget that part.

    Fortuna Infortuna Forti Una

  • BBEnkBBEnk Posts: 1,764Member

    @harsh3112 Sorry I missed this thread, Is your back ground scrolling top to bottom or right to left , ETC ?.

  • BBEnkBBEnk Posts: 1,764Member

    @Hopscotch said:

    harsh3112 , regarding nr 3:

    BBEnk, this does not put your excellent method down, it just overcomplicates particular projects which rely on moving background images. Correct me if I am wrong.

    It complicates if your game is in landscape and your background moves right to left or left to right, But if your building in portrait and background moves right to left or left to right then nothing needs to be done because only the height changes not the width.

    Hummm maybe it is complicated, maybe I need to make a new video,lol.

  • harsh3112harsh3112 Posts: 10Member

    @Hopscotch Hey it solved the collide with walls issue as well.. It wasn't colliding before as I had not placed change behaviours mentioned by @Lovejoy in the wall actors (@Lovejoy thanks for your life saving method ;)) Once I did so, It collides well! But just one issue persists, Since the actor's parts are constrained, only the main body collides with the wall while its parts don't. But as @The_Gamesalad_Guru mentioned above, Constrains override collisions, I see no fix for that.. Could anyone suggest a way out ?
    Thanks for your precious help guys! You'll are amazing!!

  • harsh3112harsh3112 Posts: 10Member

    @BBEnk My project is a landscape one, with backgrounds scrolling vertically.. but Even then, those blank thick annoying bands used to appear.. Rest everything went perfect except for those background bands (Maybe vertical scrolling needs some tweak) .. But thanks to @Lovejoy 's method and @Hopscotch 's tip, Its now solved :smiley: :blush:
    Ive also

  • harsh3112harsh3112 Posts: 10Member

    Also, I face an issue of my game lagging a bit when I preview it.
    At times it doesn't, but most of the times, when I accelerate my actor to the left or right (The background scrolls vertically so I don't have it set to move upwards, just left and right), it lags and it just doesn't seem smooth,
    Could you please help me out with this? Its bothering a lot and if it lags so much, it would just take the fun out of the game :disappointed:

    Please suggest how should I go about it and does this issue arise only when previewing in game salad creator or it will persist even while I preview it on my iPhone 6 plus or an iPad?

    Note: I have plenty of actors (About 30 including the main actor's 17 body parts) and have many constrain behaviours affixed.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,913Member

    @harsh3112 said:
    But as The_Gamesalad_Guru mentioned above, Constrains override collisions, I see no fix for that.. Could anyone suggest a way out ?

    I told you how in a post above..lol use the method in the first video to constrain the velocity of your shadow to the velocity of the actor it follows instead of the mouse like in the video. in the second video I show you how to access an on scene actors attributes without making game level attributes to transfer the data. in this instance unlocking the prototypes on your shadows would be beneficial.

  • BBEnkBBEnk Posts: 1,764Member

    @harsh3112 If your game is in landscape and your backgrounds scroll vertically then nothing special needs to be done in my universal build, something else is wrong.

  • harsh3112harsh3112 Posts: 10Member

    @BBEnk , My bad.. It was a typing error.. Its a Portrait game.. Sorry about that!
    But anyways., I might be going wrong somewhere maybe
    But that issue is solved now by using the alternative method of @Lovejoy

  • harsh3112harsh3112 Posts: 10Member

    Thanks a ton @The_Gamesalad_Guru !! I'll do that !! :D

  • harsh3112harsh3112 Posts: 10Member

    I'll get back to you if There is anything! Thanks again @The_Gamesalad_Guru , @Hopscotch , @Lovejoy , @BBEnk !
    Your help was precious and Extremely helpful!
    Cheers!! :smile:

  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,913Member

    @harsh3112 said:
    I'll get back to you if There is anything! Thanks again The_Gamesalad_Guru , Hopscotch , Lovejoy , BBEnk !
    Your help was precious and Extremely helpful!
    Cheers!! :smile:

    you're welcome.

Sign In or Register to comment.