[solved] Scaled movement wobbly

Started by Tamanegi, Mon 24/09/2012 16:22:59

Previous topic - Next topic

Tamanegi

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?
Don't Look! MAGS 12-2010
Mediocre Expectations Current development blog

Crimson Wizard

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.

Alan v.Drake

Sort of, the offending piece of code was this:

- ac.cpp , "int wantMoveNow" function -

Code: C++

  // 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++

  // 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

Crimson Wizard

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?

Tamanegi

Thank you, but what do I do with this? I have no ac.cpp or at least I don't know where.
Don't Look! MAGS 12-2010
Mediocre Expectations Current development blog

Alan v.Drake

#5
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

Tamanegi

Thank you! Works perfectly :)
Don't Look! MAGS 12-2010
Mediocre Expectations Current development blog

SMF spam blocked by CleanTalk