Strange Offset - serious problem

Started by Chomba, Sat 08/05/2021 09:58:08

Previous topic - Next topic

Chomba

I have been struggling for hours to find the cause of a recent problem in my game.

This wasn't happening, it started happening all of a sudden and I don't know why.

Suddenly, when I send the character to pick up an object for the first time in the game (which is usually when I use the "Lockview" command) I automatically get a slight offset in which the character is stuck, that is, from then on, the character will be in "offset" and the animations will no longer match well with the original positions of the character in other actions...

I will give an example to see if I can be clearer.

In the game I have to do the action of replacing a golden idol with a stone (yes, indiana jones style). There I have an animation where the character dodges an arrow that is thrown from the other end of the room. This animation was made at full resolution size (320x200), placing the character in the necessary point (I made it before I knew about the lockviewoffset command and that's how I could solve it).
I never had problems with this animation, but now, if I grabbed an object before, the character doesn't stop in the right place before doing the animation, it is shifted a few pixels to the side and up, the animation runs in the right place and then with the unlockview it goes back to the shifted position.

The really strange thing is that if I use the stone with the idol, but without having picked it up from the ground (that is, getting it by debug commands) the animation and the position of the character run well.....


In another case, in which he takes some things from a hiding place (unless he has picked up another item before), the character stands in the right place (unless he has picked up another item before) and runs the animation using lockviewoffset correctly, but when it finishes, the character is somewhere else.

It's very strange because everything was working fine and all of a sudden the game fell apart.

If someone wants to see what's going on, I can zip the project for you to see it. The game for now is in Spanish, but it is not necessary to understand what it says to be able to see this. I can guide you to see what happens if necessary.

------------

In code there is nothing strange that could have triggered this, that I can notice, it started to happen all of a sudden in actions already defined some time ago and it didn't happen before.

Edit: I´m using version 3.5.0 (I upgraded it to patch 9 to see if this may solve it but it doesn´t), I tried it also in 3.6.0 (with another copy of the game) and it´s all the same

eri0o

Have you done a manual scaling of the player character at a room and forgot to deactivate it before going to the other rooms? Have you changed the player character z attribute (vertical offset) ? Have you changed the pathfinding algorithm?

rongel

What is the scaling value of the character? If the animation is using different sized loop (for example the loop is 10 pixels wider than the default character sprite) and the scaling is not 100 %, there can be a slight offset. I'm not sure if that's the case, but I posted a question about it yesterday: https://www.adventuregamestudio.co.uk/forums/index.php?topic=59095.0

If you have changed the walkable area scaling, that could have caused the slight offset.
Dreams in the Witch House on Steam & GOG

Chomba

Thanks for your answers guys, they helped me to realise (kind of) what was going on.

I Think I could fix it...

QuoteWhat is the scaling value of the character? If the animation is using different sized loop (for example the loop is 10 pixels wider than the default character sprite) and the scaling is not 100 %, there can be a slight offset. I'm not sure if that's the case, but I posted a question about it yesterday:

I didn't change the scale values (at least not on purpose), it was one of the things I was checking but I couldn't get anything with it.

The strange thing is that the error is triggered by picking up some object.

QuoteHave you done a manual scaling of the player character at a room and forgot to deactivate it before going to the other rooms? Have you changed the player character z attribute (vertical offset) ? Have you changed the pathfinding algorithm?

No, the rooms before didn´t have scaling.

Te problem and the solution (Maybe?)

thanks to what eerio said, I stopped concentrating on the room and its code and I was tracking where I could have made some modification that affects the character, not specifically that aspect, but any.

As I had added some cutscenes before, I went to check the end of the last one before this room where there were problems (the problems were only in that room).

I noticed that at the end of the cutscene code I used "cplayer.changeview" instead of "cplayer.lockview".
So after some lockview and unlockview in that room and in the problem room, it seems to be fixed.

I don't understand why the offset (not the function, but that the character was moving) was sometimes applied and sometimes not. Nor if that was the only reason why it happened as it did (or if it was because of that)... but for the moment it seems to be fixed.
I don't know if it was a stroke of luck and something else has changed along the way or if it really could be that...

It was a bummer that this happened so close to the demo (I'm about 3/4 done, missing some menu graphics, close some gui´s, work on sound, music and maybe voices).

PD: apparently, the real problem was that the character was offset in its main view and the animations stayed in place... all very weird to me (it was not as I thought, that the animations were in offset)



SMF spam blocked by CleanTalk