minetest_game icon indicating copy to clipboard operation
minetest_game copied to clipboard

Lower frequency of standing/sitting animation

Open An0n3m0us opened this issue 5 years ago • 28 comments
trafficstars

Closes: #2220

Lowered the frequency of the standing and sitting animation from the model, then changed the frames in the API respectively.

-		stand     = {x = 0,   y = 79},
+		stand     = {x = 0,   y = 159},
-		sit       = {x = 81,  y = 160},
+		sit       = {x = 161,  y = 320},
-		lay       = {x = 162, y = 166},
+		lay       = {x = 322, y = 326},
-		walk      = {x = 168, y = 187},
+		walk      = {x = 328, y = 347},
-		mine      = {x = 189, y = 198},
+		mine      = {x = 349, y = 358},
-		walk_mine = {x = 200, y = 219},
+		walk_mine = {x = 360, y = 379},

The stand animation is slowed down to two times longer, so it lasts for 159 frames instead of 79. The sit animation is changed likewise; from lasting for 79 frames to now lasting for 159.

All of the other frames look like they have been changed; but that's just repositioning of the frames.

Here's what the sitting animation looks like now: https://my.pcloud.com/publink/show?code=XZcFT2kZDKhF629qeGLjKO4BF0OX3jxeQ63k

An0n3m0us avatar Jan 26 '20 21:01 An0n3m0us

@paramat For the sake of clarity, I've created a recording of exactly how I did it so you can easily determine that it's done correctly: https://my.pcloud.com/publink/show?code=XZihT2kZelaObzDQRk5VVUY6UtxcUbRchwfy

An0n3m0us avatar Jan 26 '20 23:01 An0n3m0us

Might this break mods that use certain frames of the current model? Not a big issue but just mentioning. The amplitude of the 'breathing' was reduced by your other PR, which helps make it look less 'demented', so slowing the animation is not so essential now. So with the above in mind, i am just wondering if this is worth doing?

paramat avatar Jan 27 '20 00:01 paramat

True, I didn't think about that. Are there many popular mods that use specific frames?; wouldn't they simply use, for example, player_set_animation(player, "mine")?

Well, here's a comparison anyway; it's not that much of a difference to the frequency and it moves a lot of the frames, so I get why you're wondering if this PR is worth it. So am I xD

https://my.pcloud.com/publink/show?code=XZOyP2kZmx8nC4D21J7sa0J15j3WGSPqrasX

If there are mods that use specific frames, and you think that the change above is too minor to notice; I'll be okay with closing the PR.

An0n3m0us avatar Jan 27 '20 10:01 An0n3m0us

I am thinking of 'emote' type mods that use certain frames for gestures. However, the number of mods affected may be very small, i find it hard to judge the risk.

paramat avatar Jan 27 '20 20:01 paramat

Since the animation frames are being modified; couldn't we solve #2227 while we're at it (as a seperate PR of course), so to minimize continuous changes to the animation?

An0n3m0us avatar Jan 27 '20 21:01 An0n3m0us

That proposal has no support from other core devs yet, best wait for that.

paramat avatar Jan 27 '20 23:01 paramat

Waiting for input from other core devs and anyone, concerning how much impact this will have on mods.

paramat avatar Feb 10 '20 00:02 paramat

Both mods seem to use their own copy of the player model; so changing the frames won't make a difference to them.

https://github.com/stujones11/minetest-3d_armor/blob/21cd467bd81f73d7eddc3b04180bd0b4771cf49d/3d_armor/init.lua#L261 https://github.com/minetest-mods/skinsdb/blob/ada930c0997d60f0de7778b85e9dee2233b32c6f/init.lua#L68

The only mod (from what I've found) that needs a change is Sofars emote mod: https://github.com/minetest-mods/emote/blob/3c39a8cded169e9f91a7a4e56f33cf3a10573431/init.lua#L15

An0n3m0us avatar Feb 12 '20 18:02 An0n3m0us

Keeping open as concept supported by at least 2 core devs (see issue).

paramat avatar Aug 03 '20 01:08 paramat

@stujones11 @GreenXenith any comments on possible breakage caused by this change?

If this is fairly harmless i will probably approve this.

paramat avatar Sep 20 '20 20:09 paramat

Stu hasn't been around in a while and bell07 is the skinsdb maintainer, but I'll throw in my two cents anyway.

This will break any mod that has hard-coded frame values for animations (pre-player_api or anyone just not using the API). However, the mods depending on the latest/dev MTG player model and using hard-coded frame animations are few, so it shouldn't impact a whole lot of mods (a few notable ones, at most?). Anyone using the player API with named animations or a custom model (3d_armor, skinsdb) will be fine.

Registering named animation ranges for models might be worth considering as an engine feature (such as minetest.register_animation_range("character.b3d", "walk", {x = 0, y = 1337})), but that is a topic for a different issue.

GreenXenith avatar Sep 20 '20 21:09 GreenXenith

Thanks.

Silly question, but now that the frames used are doubled, will this cause any significant reduction in rendering performance? I expect not but thought i would mention it.

paramat avatar Sep 20 '20 21:09 paramat

There is no rendering performance change. The only "loss" is a barely larger model file size.

GreenXenith avatar Sep 20 '20 22:09 GreenXenith

GreenXenith, saw you wondering on IRC. I tagged you because i followed the link in https://github.com/minetest/minetest_game/pull/2567#issuecomment-585360867 and saw you mentioned. My mistake, thought you were the mod maintainer but you were only the commit author.

paramat avatar Sep 20 '20 22:09 paramat

There is no rendering performance change. The only "loss" is a barely larger model file size.

The number of frames are the same, so there should be little if any change to the file size. Now I just need to check if I still have the branch after 9 months xP

I will probably have to update it with the latest revision of the player model, but that shouldn't be too difficult.

An0n3m0us avatar Sep 21 '20 06:09 An0n3m0us

I think this is worth a little breakage, so to be clear, i will approve this PR (which means a merge) if updated.

paramat avatar Sep 23 '20 20:09 paramat

I've updated the latest model with the frequency change. For some reason the model size is bigger, but I cannot determine truly why this is. It seems to be linked with the size of the frame range.

An0n3m0us avatar Sep 23 '20 21:09 An0n3m0us

Hmm that is unfortunate. I hope we can work out why that happens.

paramat avatar Sep 23 '20 23:09 paramat

Reminder: Will have to modify this if #2746 is merged.

An0n3m0us avatar Sep 26 '20 12:09 An0n3m0us

Removed SmallJoker's approval as this is currently broken.

paramat avatar Sep 26 '20 18:09 paramat

https://u.pcloud.link/publink/show?code=XZ47RJXZrISNl3f7g0BuNQapl8lb7bRFnHFk

We could have it so that the animation speed changes; it's a very simple code addition (3 lines changed)

This would remove the need to change the model at all.

Although, for mods like this . . .

image

. . . it won't work instantly because that is setting the speed to 30. But it will go back to 10 if the player moves and then stands again of course.

So again, a breaking change, but I think a minor one. Better than changing the model I'd say.

Plus, the animations will only be affected if a mod does what that mod does above. If instead they use 10 when setting the standing/sitting animation, it will work as expected of course.

An0n3m0us avatar Sep 26 '20 21:09 An0n3m0us

We could have it so that the animation speed changes

That was actually my initial approach to this, but i realised it was messy and abandoned it.

Better than changing the model I'd say.

I disagree, it is certainly better to bake-in the correct animation rates for all animations, so that they are consistent and correct at animation speed 30. This change is not important so if you cannot do this nevermind.

See https://github.com/minetest/minetest_game/issues/2220#issuecomment-424072575 and https://github.com/minetest/minetest_game/issues/2220#issuecomment-427603765

paramat avatar Sep 26 '20 22:09 paramat

This change is not important so if you cannot do this nevermind.

I've done it easily in the model, but the filesize is a bit off-putting because the framerange is larger. That's why I suggested the reason above.

Meaning, I doubt I will be able to make the filesize smaller than it is now.

An0n3m0us avatar Sep 27 '20 06:09 An0n3m0us

For some reason the model size is bigger, but I cannot determine truly why this is. It seems to be linked with the size of the frame range.

I might have misunderstood this. Do you mean the filesize or the in-game model dimensions measured in nodes? I suspect you mean the filesize. If so, the .b3d file has only increased to 150% of its previous size, this is fine.

paramat avatar Sep 27 '20 17:09 paramat

Yes, I meant the B3D model size.

An0n3m0us avatar Sep 27 '20 17:09 An0n3m0us

=D ok.

paramat avatar Sep 27 '20 17:09 paramat

I think this is much lower priority than #2746 so i request this is merged after that.

paramat avatar Nov 10 '20 15:11 paramat

I suppose this has high potential for breakage either way:

  • If the animation speed is changed, mods that hardcode it will be broken;
  • If the animation frames are changed, mods that hardcode it will be broken

Theoretically those mods should be using player_api, but they often aren't - sometimes in an attempt to work independent of MTG.

B3D stores an animation speed, but I suppose Minetest ignores/overrides it?

appgurueu avatar Jan 18 '22 07:01 appgurueu

Stale (author left?), closing.

sfan5 avatar Dec 24 '23 12:12 sfan5