Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Samwise on Sun 27/05/2007 14:47:57

Title: Walking Temporary Without Animation - Possible AGS Bug?
Post by: Samwise on Sun 27/05/2007 14:47:57
Hello,

I've got the strangest bug happening while I'm roaming around with my player character.  Every once in a while (let's say 10 minutes of gameplay or so), the player walks for several seconds (until he reaches his pointed destination) WITHOUT ANIMATION - "floating" while he's stuck on a single frame.  And then, when I tell him to go to a different place, he walks there just fine!

This is very strange because except one place (the game's first screen, where this bug tends to happen a lot), this temporary glitch seems to occur randomly.  It usually happens when I walk the player down ("forward"). 

The views/loops/frames are defined as they should be, I didn't forget to unlock any views etc., so I can't figure out what causes the problem.  Anyone has an idea?

Jonathan

Title: Re: Walking Temporary Without Animation - Possible AGS Bug?
Post by: Khris on Sun 27/05/2007 16:34:07
Do you have very narrow walkable areas? The pathfinding wants them to be at least 3 pixels wide.
Title: Re: Walking Temporary Without Animation - Possible AGS Bug?
Post by: Samwise on Mon 28/05/2007 06:54:24
No, it usually happens in screens with very wide walkable areas.
Title: Re: Walking Temporary Without Animation - Possible AGS Bug?
Post by: Pumaman on Mon 28/05/2007 11:18:42
Sounds very odd, I haven't heard of anything like this before.

How easy is it to reproduce the problem? If it can be done fairly easily, would you mind uploading the game for me to take a look?
Title: Re: Walking Temporary Without Animation - Possible AGS Bug?
Post by: Samwise on Mon 28/05/2007 12:55:44
It happens every 10 minutes or so, usually in the beginning of the game.

I wouldn't mind uploading the game, but it's about 500MB, or 200MB in a zip file...
Title: Re: Walking Temporary Without Animation - Possible AGS Bug?
Post by: Pumaman on Mon 28/05/2007 13:22:40
Ok, probably not worth uploading in that case. It's hard to say what the potential cause could be; potentially you could have some script in a repeatedly_exceute somewhere that is locking the view or something like that.
Title: Re: Walking Temporary Without Animation - Possible AGS Bug?
Post by: Samwise on Mon 28/05/2007 14:37:27
I've got only one function on the global repeatedly_exceute, and nothing in the repeatedly_exceute script of the room where it happens the most.  I'm pretty sure that it's not what causing the problem.

It does look like the character view is locked, but when I command the player to walk again, he returns to walk normally and everything is fine.

Another rare problem I'm having, which happen even less, is that the music "jumps" every now and then (like a bad audio CD often does).  Maybe these two problems are connected, and it's a memory issue or something like that?

These problems aren't severe, but they're a little annoying and making the game look less professional.

Title: Re: Walking Temporary Without Animation - Possible AGS Bug?
Post by: GarageGothic on Mon 28/05/2007 14:52:32
The music usually glitches when the engine is stuck in the same cycle for too long (low framerate). This can be due to disc access (for example on room changes) or CPU-heavy functions (often long while loops or DynamicSprite related operations). If the latter is the case, you can put a couple of Wait(1); commands into your code to allow the engine to proceed to the next game cycle.
Title: Re: Walking Temporary Without Animation - Possible AGS Bug?
Post by: Samwise on Mon 28/05/2007 14:57:22
Thank you, I'll try that.

It won't solve the walking glitches though, as they happen randomly.

Edit: I found out that the walking problem occurs every time I walk my player character down exactly after he'd faced forward at talked "to the camera".
Title: Re: Walking Temporary Without Animation - Possible AGS Bug?
Post by: Andail on Mon 28/05/2007 17:19:06
Are you setting a view just before starting conversations that you forget to unlock?
Title: Re: Walking Temporary Without Animation - Possible AGS Bug?
Post by: Samwise on Mon 28/05/2007 18:23:24
No - and anyway, I think it wouldn't have been the reason, becuase the after I move the character again it returns to normal (without any unclocking command).
Title: Re: Walking Temporary Without Animation - Possible AGS Bug?
Post by: Pumaman on Mon 28/05/2007 18:56:58
I presume your speech view isn't the same as your walking view?

Are you using the standard "Say" command when he talks to the camera, or is it some custom script?
Title: Re: Walking Temporary Without Animation - Possible AGS Bug?
Post by: Samwise on Mon 28/05/2007 21:05:47
Not, they're not on the same view.

But maybe you got a point with the "say" thing.  I'm not using a regular "say" command, but a function called "emor".  Here's its (global) script:

function Emor(Character* dmut,  String kovetz) {
int loopy;
loopy=dmut.Loop;
if ((loopy==4) || (loopy==6)) {loopy=0;}
if ((loopy==5) || (loopy==7)) {loopy=3;}
loopy += 8;
dmut.LockView(2);
dmut.Animate(loopy,4,eOnce,eBlock);
loopy -=8;
dmut.Loop=loopy;
dmut.Say("%s",  kovetz);
dmut.LockView(2);
loopy += 8;
dmut.Animate(loopy,4,eOnce,eBlock, eBackwards);
dmut.UnlockView();
}

Basically, this function enables me to view transition frames before the character's actually starting to talk, which makes the speaking animation much more "believable".  But maybe there's a problem with this function?

Title: Re: Walking Temporary Without Animation - Possible AGS Bug?
Post by: GarageGothic on Mon 28/05/2007 21:32:46
I'd say the problem is the line:

dmut.Loop=loopy;

Could you try storing dmut.Loop to an int before setting it to loopy, then reset it to the original state before the function ends? If you're just using it to make the player face the camera, perhaps you could use Character.FaceLocation instead?
Title: Re: Walking Temporary Without Animation - Possible AGS Bug?
Post by: SSH on Tue 29/05/2007 10:13:35
As GG says, the loop number is not saved/restored by Lock/Unlock views

Title: Re: Walking Temporary Without Animation - Possible AGS Bug?
Post by: Samwise on Tue 29/05/2007 13:53:54
Ok, I'll try to fix that later and check if it works.  Meanwhile, thank you...
Title: Re: Walking Temporary Without Animation - Possible AGS Bug?
Post by: Samwise on Sun 10/06/2007 13:34:31
Ok, I think I solved this issue:

function Emor(Character* dmut,  String kovetz) {
int loopy;
loopy=dmut.Loop;
if ((loopy==4) || (loopy==6)) {loopy=0;}
if ((loopy==5) || (loopy==7)) {loopy=3;}
loopy += 8;
dmut.LockView(2);
dmut.Animate(loopy,4,eOnce,eBlock);
loopy -=8;
dmut.Loop=loopy;
dmut.Say("%s",  kovetz);
loopy += 8;
dmut.LockViewAligned(2,  loopy, eAlignCentre);
dmut.Animate(loopy,4,eOnce,eBlock, eBackwards);
loopy -= 8;
dmut.LockViewAligned(2,  loopy, eAlignCentre);
dmut.UnlockView();
}

It seems to work.  Thank you guys for your help.

Jonathan