Awkward Transition from Normal to Idle View

Started by maximusfink, Tue 31/07/2012 18:09:28

Previous topic - Next topic

maximusfink

Hi all, I've been searching the forums and beating my head against my desk all day trying to figure this out. Basically the player character in my game is a robed guy with flames billowing out from under his cloak. He doesn't have a traditional walk cycle, instead he sort of glides around. So my Normal View is his "walk" cycle, which is essentially his robes flowing a bit, and flames coming out of them, but while there is a first standing frame in this animation, it is just a placeholder and not his actual standing pose, which I am handling with an Idle View. In the idle animation, his robes are not flowing but flames are still billowing out from under them.

I've put a line in the Global.asc under the Game_Start function: --->      cCharacter.SetIdleView([idleView], 0);

The game starts and he's standing there looking good and I move him and that all looks fine too, but when he reaches his destination he gets stuck on the first frame of his normal view for anywhere between one or a half of a second before switching to his Idle View, which loops uninterrupted once it gets going. By first frame I mean the standing frame, I know it is this frame because I had it blank at one point in which case he'd disappear before going into idle view.

It looks crappy and I can't figure out how to fix it. As a side question, is there any way to include those first frames of the normal view loops into the animation itself? Sorry if I'm posting too much, thanks for any help.

Khris

Don't cross post, people who answer tech questions will look at both forums anyway.

I don't think there's an easy answer here; maybe somebody who's used to browsing the engine source can shed some light on this issue?

Crimson Wizard

#2
This may be not easy to tell, since there are many things going on in the engine, but my blame goes for this condition:
Code: cpp

// count idle time
    else if ((loopcounter%40==0) || (chex->process_idle_this_time == 1)) {
      idleleft--;
      if (idleleft == -1) {

Doesn't that mean that idle timer only decremented once per second, meaning that if character stopped at 0.001 of a new second it will still wait for the rest 0.999 milliseconds?

EDIT: Probably explained incorrectly. The problem is not that it checks for idle time once per second, but that it makes one extra check if wait time is 0 (it needs it to become -1).

Anyway I don't see how knowing this may help. I guess the animation should be done some other way. What about force-playing animation depending on whether character is moving or not?

PS. We should probably still fix this in future versions of AGS.
EDIT2: opened an issue for later reference: http://www.adventuregamestudio.co.uk/yabb/index.php?issue=341.0

maximusfink

I don't know how to access the engine source code and I wouldn't be able to make much sense of it anyway, but (@ Crimson Wizard) what you posted there does explain why the hiccup between views varies slightly so that's good to know. Since that's the case though, I wonder why this problem is encountered so infrequently by people using the idle animation this way. Before I posted the topic I did try to force-play the animation through some scripting in repeatedly execute but I wasn't sure how to go about it, and wasn't sure if it was even possible so I gave up. I'll look into it more though, since detecting whether the char is in motion or not would be a lot more immediate. Thanks for the help guys.

Alan v.Drake

Ah, I encountered that issue, but changed the line to "loopcounter%2" so it started sooner. I should have removed that piece altogether so one could directly specify the number of frames to wait instead of seconds, but if you need a quick fix you can use AGS Draconian.

- Alan

KodiakBehr

Hey, I hate resurrecting this issue, but I'm in the exact same boat.

I noticed that Dualnames had a makeshift fix HERE, but I can't get it to work properly.

Code: ags

if (!cPlayerCharacter.Moving) {
if (cPlayerCharacter.View!=idl)cPlayerCharacter.ChangeView(idl);
if(exc!=Game.GetFrameCountForLoop(idl, cPlayerCharacter.Loop)) {
ViewFrame*getidle=Game.GetViewFrame(idl, cPlayerCharacter.Loop, exc);
cPlayerCharacter.Frame=exc;
if (fb!=cPlayerCharacter.AnimationSpeed+getidle.Speed) {
fb++;
return;
}
if (fb==cPlayerCharacter.AnimationSpeed+getidle.Speed) fb=0;
exc++;
}
if(exc==Game.GetFrameCountForLoop(idl, cPlayerCharacter.Loop)) exc=0;
}

if ((cPlayerCharacter.Moving) && (cPlayerCharacter.View==idl)) {
 cPlayerCharacter.ChangeView(wview);
 exc=0;
 fb=0;
}


I'm not calling the SetIdleView, as instructed, but despite this it doesn't animate at all unless it's in motion.  It just sits there.  Any ideas?

KodiakBehr

Y'know what?  Sorry to have brought it up -- I've changed my mechanics somewhat so that the person in question is always in motion, thus avoiding this entire issue.  Disregard.

SMF spam blocked by CleanTalk