Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Tamanegi on Mon 24/09/2012 16:22:59

Title: [solved] Scaled movement wobbly
Post by: Tamanegi on Mon 24/09/2012 16:22:59
I set "adjust speed with scaling" to True for a character, and it works. But at a scaling of 65%, he isn't actually moved between two particular frames, so he just stays in place and shuffles his feet one frame long. At 50% scaling, everything looks smooth.

This happens in a game where almost nothing happens yet. I have a single walkable area that has "continuous scaling" set to True and uses 50 and 65 as min/max values. Resolution is 800x600.

Is this a known problem, or did I miss something to prevent this?
Title: Re: Scaled movement wobbly
Post by: Crimson Wizard on Mon 24/09/2012 17:15:35
My guess is that this may easily be result of rounding error. Many things in AGS are done with integer math and scaling involves division operations which may (will) produce such mistakes.
Title: Re: Scaled movement wobbly
Post by: Alan v.Drake on Mon 24/09/2012 17:40:58
Sort of, the offending piece of code was this:

- ac.cpp , "int wantMoveNow" function -

Code (C++) Select

  // scaling 60-80%, move 75% speed
  if (charextra[chnum].zoom >= 60) {
    if ((chi->walkwaitcounter % 4) >= 1)
      return 1;
  }


What I did to lessen the issue was changing it like this:
Code (C++) Select

  // scaling 60-80%, move 75% speed
  if (charextra[chnum].zoom >= 60) {
    if ((chi->walkwaitcounter % 4) >= 1)
      return -1;
    else if (charextra[chnum].xwas != INVALID_X) {
      // move the second half of the movement to make it smoother
      chi->x = charextra[chnum].xwas;
      chi->y = charextra[chnum].ywas;
      charextra[chnum].xwas = INVALID_X;
    }
  }


Hope it helps.


- Alan
Title: Re: Scaled movement wobbly
Post by: Crimson Wizard on Mon 24/09/2012 18:36:28
Come on, how that may help the guy? :) Unless he is going to hack the engine... or you have that fixed in your own version?
Title: Re: Scaled movement wobbly
Post by: Tamanegi on Mon 24/09/2012 18:44:15
Thank you, but what do I do with this? I have no ac.cpp or at least I don't know where.
Title: Re: Scaled movement wobbly
Post by: Alan v.Drake on Mon 24/09/2012 19:34:41
Right, just use the draconian version then: http://www.adventuregamestudio.co.uk/forums/index.php?topic=44502.0
Can't blame a man for trying to get people to put their hands on the source, heh :P

- Alan
Title: Re: Scaled movement wobbly
Post by: Tamanegi on Mon 24/09/2012 20:53:56
Thank you! Works perfectly :)