minetest / minetest_game

Minetest Game - A lightweight and well-maintained base for modding [https://github.com/minetest/minetest/]
http://minetest.net/
Other
1.43k stars 577 forks source link

new crack anylength #1705

Closed tobyplowy closed 7 years ago

tobyplowy commented 7 years ago

a new crack anylength i made fe870ad6-25ee-11e7-8bd1-026a8398f666 59e03698-25ed-11e7-9685-743b663cf732

5 frames waw crack_anylength

Calinou commented 7 years ago

I don't think the crack animation needs to look different right now, but it definitely needs more frames – it's not smooth enough on slow-to-dig nodes. Minecraft has 10 frames for the crack animation, but we could have even more (Minetest will automatically detect the number of frames based on the texture height).

tobyplowy commented 7 years ago

but it definitely needs more frames

I agree with that!

paramat commented 7 years ago

However remember each frame of the crack animation causes a mesh update, with the amount of digging players do this is critical. If anything there should be fewer frames. Even with 16 it will not be smooth, so smoothness should not be attempted.

tobyplowy commented 7 years ago

However remember each frame of the crack animation causes a mesh update

Is there a way to make this client side instead of server side?

paramat commented 7 years ago

So in the first post your texture is the left column and current is the right column? Could you explain what makes it better? I think the first frame is a waste because 1 pixel is not really noticeable.

flat

Note there are no bright pixels as in the current so it will not be seen on a dark node. Otherwise i quite like it, the lower contrast is less harsh. But will it still be visible on all nodes? needs testing. 4 frames would help with mesh updates so i suggest just removing the first frame.

tobyplowy commented 7 years ago

@paramat yes it's the left one

Why do I think it's better

The cracks connect into each other that makes it feel more natural (just imagine yourself hitting something over and over until it breaks it won't break from the centre and go into straight lines it will crack and go all over the place and the cracks will connect to each other)

Second it feels like you're doing more damage and that makes it more satisfying :)

But will it still be visible on all nodes?

Yes it is visible on all nodes (as far as I know)

4 frames would help with mesh updates so i suggest just removing the first frame.

I'm not sure about that but I guess if it improves performance I'm all for it

That's really it

tobyplowy commented 7 years ago

there are no bright pixels as in the current so it will not be seen on a dark node.

Yes I did that on purpose darker textures are mostly shade based so it doesn't need a lot of the detail so your attention gos to highlights (This is mostly personal taste) do you whant me to add a highlight?

paramat commented 7 years ago

Actually i realised bright pixels are probably not needed because the grey will be seen. So it's probably ok as it is (with preferably 4 frames). I should test it but so far i prefer it to the current one.

tobyplowy commented 7 years ago

@paramat so do I just resze the image that's it nothing more?

paramat commented 7 years ago

All i ask is to remove the first frame, but keep the original too in case other devs insist on all 5 frames.

tobyplowy commented 7 years ago

@paramat i updated the first post

sofar commented 7 years ago

The amount of frames needed should be dictated by the longest dig time. Some things, especially in mods, can take 3 - 5 seconds to dig. I'd think it's weird to go to 5 frames, I know the mesh is updated every frame, but having no frame updates for 1.0 second isn't a way to make the game more performing, it's just not the same scale performance wise as emerging 500 blocks when walking around a bit.

So, for me it can stay at 8+ frames easily. I wouldn't mind seeing 12 or even 16 frames.

paramat commented 7 years ago

Yes it's rate of crack changes that matters with the mesh update issue. The current crack texture has 5 frames. The mesh update issue is significant, an issue was opened for it showing CPU load spikes during digging, obviously if a tool is powerful those 5 frames are occuring in rapid succession constantly during the mining of many nodes and the 5 frames are running too fast to be useful. RBA was very concerned about this too and made a PR to make the crack optional. So if we can make crack frame rate more constant we can then have more frames, but not until then.

paramat commented 7 years ago

I find our current crack ugly, it's too high contrast, i'll try this one in-game.

tobyplowy commented 7 years ago

@paramat I agree

That's why I made this issue :)

VanessaE commented 7 years ago

:-1: fewer frames is bad, and it does not address the underlying issue of mesh updates.

kahrl commented 7 years ago

Changing the crack animation frame does NOT cause a mesh update (at least not in the sense of creating a whole mesh for a mapblock, which is what I believe everyone here is referring to). Only the first frame (starting to dig) and removing the crack (stopping to dig) does, as well as switching to a different node. The relevant function is Client::setCrack().

To change the crack animation frame, only the material of the existing mapblock mesh is updated. This takes pretty much no time at all. See the first part of MapBlockMesh::animate().

If anyone does not believe me and wants to test this in-game, here's how:

  1. In games/minimal/mods/default/init.lua, in register_item(":"), change line 41 to crumbly = {times={[2]=60.00, [3]=60.00}, uses=0, maxlevel=1}, Dirt will now take 60 seconds to dig with the hand, which makes it possible to use the in-game profiler to verify that no mesh updates happen when the crack frame changes. (the profiler only updates every 5 seconds)
  2. Start up a new minimal world.
  3. Set the viewing distance really small (e.g. 20) so that no far-away mesh updates will mess with the measurements.
  4. Look around you to make sure all the meshes in the viewing range have been generated.
  5. Open the profiler with F6 and wait until "Client: Mesh making" settles at 0.
  6. Start digging a dirt node with your hand. You'll see that starting to dig causes a mesh update ("Client: Mesh making" goes up a little), but further updates to the crack animation will not -- "Client: Mesh making" will remain at 0.
paramat commented 7 years ago

Thanks for the clarification, i'm happy i was wrong. Perhaps RBA meant that starting and finishing the crack animation caused mesh updates, and i misunderstood.

paramat commented 7 years ago

So, we could perhaps go up to 8 frames? Since most nodes are dug very quickly 16 seems too much, it would be excessively rapid.

tobyplowy commented 7 years ago

@paramat yes i also think 8 frames will do the job just fine crack big crack

paramat commented 7 years ago

screenshot_20170518_112627

It's not visible on coalblock and not very visible on stone, because it is so grey, if it had more contrast it would be good. The pattern of cracks and how they grow is good but there is a reversal of 'crackiness' in one area from frame 4 to 5.

tobyplowy commented 7 years ago

@paramat is this better? it fixes the frames and also the black is darker crack big

tobyplowy commented 7 years ago

@paramat i added some white to this one and id say this gives the best resolts crack

clay crack big stone crack big - kopie obsidian crack big - kopie 2

tobyplowy commented 7 years ago

@paramat is the above texture good or does it need to be Changed More?

paramat commented 7 years ago

I tried it but the cracks seem too wide now, as you can see on the obsidian above, it's a big mess of grey. It's also too grey and the more outward cracks are not visible on stone.

tobyplowy commented 7 years ago

@paramat ok I will see what I can do (NOTE I can't make it look good on light and dark textures at the same time)

tobyplowy commented 7 years ago

@paramat im not sure if this is better

893b073a-3bdf-11e7-8153-6689d4688fe8 893af024-3bdf-11e7-8f5d-ff692a9f3fd1 893a4386-3bdf-11e7-865f-3fac874340c8 a9d03fc4-3bdf-11e7-9ba2-4598976429bc

tobyplowy commented 7 years ago

@paramat i finally did it i made a PR https://github.com/minetest/minetest_game/pull/1796