fheroes2 icon indicating copy to clipboard operation
fheroes2 copied to clipboard

Golem sprite is shifted during diagonal movement

Open Branikolog opened this issue 4 years ago • 4 comments

While diagonal moving golem's sprite shifts. We can notice that, when golems stop, they jump a bit, right after the movement had finished.

Branikolog avatar Sep 15 '20 13:09 Branikolog

Is it in the original game as well?

ihhub avatar Sep 15 '20 15:09 ihhub

No, Original game doesn't have such issue. But original golem actually walks not on a straight line: It's route looks like " )"

Branikolog avatar Sep 15 '20 17:09 Branikolog

Hm, some screenshots would be helpful here...

a1exsh avatar Sep 04 '21 06:09 a1exsh

Hi, @a1exsh ! Here some screenshot I tried to make... Golem Move 1 Here's how golem is placed in fheroes2: Golem Move 2 Here's OG placement of sprite: Golem Move OG Also, while making of these screenshots I've noticed, that movement starts from different sprite. Could anyone check frame-by-frame, am I right?

Branikolog avatar Sep 04 '21 09:09 Branikolog

Hi, @Branikolog, I checked this issue and can tall that it is partly from the original game:

https://user-images.githubusercontent.com/113276641/208291991-5ebdbd0c-9b08-4442-9c89-f71666285242.mp4

You can see, the after moving for one cell the golem shifts horizontally for about half a cell width. The fheroes2 issue is, that besides FLY_OFF for flyers there is MOVE_START, which is not used. And only Skeleton, (Master) Swordsman and Steel/Iron Golem has this extra MOVE_START frames. Skeleton and Swordsman has only 2 such frames. It is funny, but Golem has 4 frames of MOVE_START animation and its MOVING animation sprites are drawn to move only 3/4 of the cell. I think that the authors have drawn only MOVE_START animation and then took a part of it for MOVING.

I've modified fheroes2 code to use MOVE_START animation:

https://user-images.githubusercontent.com/113276641/208293136-a03936d7-8e11-4af9-82fb-f34de82267a7.mp4

But can correct sprite horizontal position, but in this case golem will slide a little when walking forward:

https://user-images.githubusercontent.com/113276641/208293561-d53d12f4-9dbf-46d3-8d1f-69562b663922.mp4

Or somehow add frames to the MOVEMENT animation, with sprite coordinates correction, to help golem to walk the other 1/4 of cell.

Districh-ru avatar Dec 18 '22 10:12 Districh-ru

Hello, @Districh-ru ! So nice, that you've decided to take this issue. Golems are one of my most favourite units in game, with pretty animations of attacking and especially moving. I love their non-linear speed and the sounds they produce while acting. :)

I checked this issue and can tall that it is partly from the original game:

I see. Shifting in the middle of trajectory looks less noticeable, while in fheroes2 currently, we have two such shiftings: First in the beginning and the second one is even shifting back, since Golems finish their path a little bit onwards.

https://user-images.githubusercontent.com/55348946/208432422-95a8bc49-87c3-4293-bfe2-5b7ab77a8472.mp4

Correct sprite horizontal position, but in this case golem will slide a little when walking forward:

I personally love the way golems walk diagonally on your last video, but at the same time, straight walking looked better on previous one. I mean, horizontal shifting while walking horizontally is much less noticeable, than shifting during diagonal movement... Some minor shifts while walking improves an impression, that this is a mechanical creature. The thing is that current fheroes2 (and the original game as well) have that shifting too noticeable during diagonal movement. Is it possible to implement something in the middle between sliding and shifting? Or take two different approaches, for straight and diagonal movement, as I've mentioned above?

Branikolog avatar Dec 19 '22 13:12 Branikolog

@Branikolog, I slightly 'optimized' its horizontal movement. What do you think?

https://user-images.githubusercontent.com/113276641/208439273-fbc92a29-a30b-4cb1-ba0c-dd8401838db8.mp4

Also I changed the movement algorithm for all 'walkers' and added there, besides main MOVEMENT animation:

  • MOVE_QUICK - when creature moves for 1 cell,
  • MOVE_START - movement from beginning till the first cell,
  • MOVE_END - movement to the last cell.

The biggest difficulty is the backward movement of wide creatures. :)

When I open this PR and I want to ask you to check the movement of all creatures (also with passing the bridge), including slowed flyers.

Districh-ru avatar Dec 19 '22 13:12 Districh-ru

Hi, @Districh-ru . Now animation looks smooth, without noticeable shifts during whole path. :+1 The only thing I've noticed is one frame is missing in starting animation.

When I open this PR and I want to ask you to check the movement of all creatures (also with passing the bridge), including slowed flyers.

That would be not an easy task, but a pleasant one. :) I'm happy, that there're only six factions in game. :)

Branikolog avatar Dec 19 '22 14:12 Branikolog

The only thing I've noticed is one frame is missing in starting animation.

It's a video recorder issue, you can see, that the third golem has this frame. :)

That would be not an easy task, but a pleasant one. :) I'm happy, that there're only six factions in game. :)

You forgot about the seventh: Elementals, Rogue, Nomad, Genie, Ghost, Medusa. :)

I already found some issues in new animations and fixing them. You can check this fix in common: by creature types (walking. walking+wide, slow+flying, slow+flying+wide) and maybe you want to pay attention to some creatures. But to check everyone is the best. :)

And a question we have to think at: the game sets the animation speed for every creature movement in milliseconds fer movement. And it is OK for main the movement animation, but now we have 3 new and they may have different frame number than in the main movement. Should we keep the constant time for movement from cell to cell (as the OG), or keep constant delay between frames, as I did in previous video? For comparison: Golems with constant time for cell movement:

https://user-images.githubusercontent.com/113276641/208452328-5a752c19-a8d3-449e-9aaf-66d60c85f189.mp4

Districh-ru avatar Dec 19 '22 14:12 Districh-ru

Hi, @Districh-ru

It's a video recorder issue, you can see, that the third golem has this frame. :)

I see.

But to check everyone is the best. :)

Sure. Since all creatures have different animations.

Should we keep the constant time for movement from cell to cell (as the OG), or keep constant delay between frames, as I did in previous video?

I can barely notice the difference on these videos.. :) The last video looks more close to the original game, regarding golem animation... Looks like it fixes #1302.

Branikolog avatar Dec 19 '22 15:12 Branikolog