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
Do you have very narrow walkable areas? The pathfinding wants them to be at least 3 pixels wide.
No, it usually happens in screens with very wide walkable areas.
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?
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...
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.
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.
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.
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".
Are you setting a view just before starting conversations that you forget to unlock?
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).
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?
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?
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?
As GG says, the loop number is not saved/restored by Lock/Unlock views
Ok, I'll try to fix that later and check if it works. Meanwhile, thank you...
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