odd jitter when zooming out with HUD

TouchiMediaTouchiMedia Member Posts: 154
edited January 2014 in Working with GS (Mac)
Ok so been following the helpful tutorials to get swipe camera move, zoom out and in, as well as keeping the HUD in place when doing such. Very thankful for the nice videos/help from others. Got it all working except ….

My LAST thing (I think!) … I have the zooming working with HUD - however, I can't solve this odd glitch on the start and end of the frames when zooming.

** My Actors testing are on Top Right if it matters **

Upon zooming out - the actor will 'stutter' for a frame move diagonally bottom left then starts to follow to the top right as it should - and stops right where it should smooth when completely zoomed out. Wouldn't notice it if it wasn't for the initial stutter.

Soon as I zoom back in it seems to skip ahead a couple frames to the diagonal bottom left direction. The frame or two before it stops it stutters the actor diagonal top right.

It's really not a lot of movement but it's noticeable and I really don't see anything wrong with my code, the interpolations are all matched up set at 1 second, positions / sizes saved, etc.

Curious if anyone else had this issue or if it's bug? Possibly my code but I honestly been looking over it and testing delays and other stuff and adding a few pixies to the position to counter the stutters but still does it!

Any insights feedback appreciated

edit - think I may have found the issue after a few long nights.

***** OK so I had same button track the 'game.zoom' attribute. That caused some havoc , can use this thread if it happens to someone else :) Cheers *****

Alright so I can get it to work if all actors zoom out on mouse click.. but if I try to do it when an attribute changes (game.zoom = true) it will cause actors to jitter. argh , seems like a bug ..

Comments

  • TouchiMediaTouchiMedia Member Posts: 154
    Anyone know if this isn't possible to sync zooming out HUD actors based on an attribute (not touch, or keyboard press).. I have a HUD Button that is Zoom.. click it, zooms out, click again zooms in. So in order for other HUD elements to react to the zoom, I made attribute 'game.zoom' when the zoom button gets pressed , change attribute to 'game.zoom' true.

    Then in my other HUD actors - I have it setup when 'zoom = true' yada yada yada -- interpolate actors position / resize actors.

    There seems to be an ever slight delay with the other hud actors which causes the stutter. Feel like I tried everything these past few days/long nights
  • natzuurnatzuur Member Posts: 304
    edited January 2014
    @henson802@hotmail.com I wrote about this in another thread, you will get minor jitter no matter what, but it's not so bad on the device, and layering matters a lot for this (as you've figured out). Let me see here... Ok found it.

    A (relatively) easy way to do this would be to create an attribute called zoom%.

    This will be your master controller for every aspect of zooming including the HUD.

    Obviously on each scene you need to access the Camera width and height for zoom, so if you plan on using this on more than one scene I would suggest creating a custom behavior for ease of copying the following logic into an unlocked actor.

    Camera controller actor:
    Constrain Scene.Camera.Width to 1024*Zoom%
    Constrain Scene.Camera.Height to 768*Zoom%

    (change the above static size values according to device)

    On another actor (does not need to be unlocked)

    Write logic to control the zoom with either
    a. interpolate zoom% to desired zoom
    b. timer change zoom% (actually smoother) to desired zoom

    Now finally on your hud elements:

    Constrain Self.Width to ( desired size)*zoom%
    Constrain Self.Height to ( desiredsize)*zoom%
    Constrain Self.Position.X to (desired Pos)*zoom%
    Constrain Self.Position.Y to (desired Pos)*zoom%

    Make sure the Camera controller actor is always above the actor doing the zooming in layers but below the UI elements and this should work for you! Let me know if you have questions.


    Edit: Oh Yeah, so in case you were wondering the zoom% nees to be a real attribute so basically .99 is 99% of camera size, or 1.1 is 110% camera size.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I have no idea if this would work but what about trying to force a time sync?

    On the actor that initiates the zoom
    When [condition]
         Change attribute game.zoom to true
         Change attribute game.zoomTime (real) to game.Time+0.1
    When game.zoom is true AND game.Time=game.zoomTime
         [change camera settings, etc.]

    On the other HUD actors
    When game.zoom is true AND game.Time=game.zoomTime
         [interpolate positions, resize actors, etc.]


    I would think 0.1 would be long enough but you could increase this if it isn't working.

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

  • TouchiMediaTouchiMedia Member Posts: 154
    Hey Natzur.. thanks for your input.. but you're basically doing the same thing as I am. It's the fact that when calling game attributes with other actors, there's that very slight delay from actually pressing button down so when the camera moves upon pressing the zoom button..all the other Actor HUDS are barely off sync to the camera because they are synced with the attribute not the button press... (hard to explain)

    I have tried using time delay attribute methods on the actual camera.. not sure how precise time is but I tried delaying the camera movement by '0.01' and still got jitter.

    Tatiang - thank you as well.. I will try that - I was using time delays but just as the 'timer' attribute and wrapped everything within that.. never thought about setting it up like you have it..

    Will do some further testing -- this is basically the last thing that's keeping me from going full steam on my project - as the user will need to zoom, having the HUD look glitchy when moving - even if it's only at start and end frames.. just kind of makes everything junky looking, but I'm super picky when it comes to games!

    Appreciate it you two!
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    You're welcome... I don't know if it will work but I figured you could give it a shot.

    If you need to notify someone here, type '@' followed by their exact username, such as @tatiang or @natzuur. By the way, that won't work for your account because you chose your entire email address (which includes the '@' symbol) as your username. I'd recommend that you change your username to something else (and no spaces!).

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

  • TouchiMediaTouchiMedia Member Posts: 154
    edited January 2014
    I'll see about your method tonight or tomorrow and report back.. this one been giving me a headache for awhile now ;)
  • TouchiMediaTouchiMedia Member Posts: 154
    edited January 2014
    I have no idea if this would work but what about trying to force a time sync?

    On the actor that initiates the zoom
    When [condition]
         Change attribute game.zoom to true
         Change attribute game.zoomTime (real) to game.Time+0.1
    When game.zoom is true AND game.Time=game.zoomTime
         [change camera settings, etc.]

    On the other HUD actors
    When game.zoom is true AND game.Time=game.zoomTime
         [interpolate positions, resize actors, etc.]


    I would think 0.1 would be long enough but you could increase this if it isn't working.
    Well I tried this and unfortunately same result. I think it has to do with game attributes switching and communicating that switch instaneously through the various other actors with it - whether that's delaying it or not - time still goes through attribute ???

    The actor that switches the attributes zooms out and in fine because it's on that actor. But when you have other actors zooming out and in based on that attribute switch, there seems to be an issue?


    *******

    I've gotten to the point where the actor receiving the zoom command (HUD) zooms out and in smoothly. But other HUD actors 'stutter' due to the timing, and no matter how I tweak the timing settings with delays, it seems to always happen.

    Maybe I'm just burned out on the code and need to come back to it later, or bug(?) gets cleaned up in a later release.

    **** If I set up a simple scene, and have all HUD items zoom out or in based on a mouse click or keyboard press (as seen in tutorial video) - then it works all fine. But when I want it so user has to click on one button (zoom) - that communicates the attribute to the rest of the HUD actors to zoom out or in - it causes the slight delay/stutter. ugh.

    :(

    And yes there is a tutorial on zoom but it's focused on hitting a keyboard press, I haven't seen much on an actual 'zoom button' which is what I'm trying to do with other HUD elements. I tried!
Sign In or Register to comment.