VOOZH about

URL: https://minecraft.wiki/w/Talk:Loyalty

⇱ Talk:Loyalty – Minecraft Wiki


Talk:Loyalty

From Minecraft Wiki
Latest comment: 19 August 2024 by Rampage455 in topic The maths behind Loyalty's return time
Jump to navigation Jump to search

The maths behind Loyalty's return time

[edit source]
Latest comment: 19 August 20247 comments6 people in discussion

So, seeing as this is one of the only Enchant pages with no explanation of how level mathematically affects the enchantment effect, I decided to do some testing. I tested Loyalty I, II, and III over distances of 5, 10, 15, 20, 25, 30, and 35 blocks. Here are my results for the time between strike and return (partly kept track of via command blocks to ensure accuracy):

Distance Loyalty I Loyalty II Loyalty III
5 Blocks 1.5s 1.25s 1.17s
10 Blocks 2s 1.5s 1.33s
15 Blocks 2.5s 1.75s 1.5s
20 Blocks 3s 2s 1.67s
25 Blocks 4s 2.5s 2s
30 Blocks 3.5s 2.25s 1.83s
35 Blocks 4.5s 2.75s 2.17s

Note that the only anomaly is 25 and 30 blocks, whose results, oddly enough, are swapped in-game (possibly an undetected/unreported bug?).

Observations: over 1 second (which seems to be the base time), return time takes an additional 0.1 seconds per block for Loyalty I, 0.05 seconds per block for Loyalty II, and 0.0333(...) seconds per block for Loyalty III. This works out to a nice, easy formula:

  • Return Time = 1 + (0.1 * Distance)/(Loyalty Level)

I'm not sure if this is 100% accurate (again, there's that weird glitch around 25~30 blocks I can't explain), but this seems to hold true for all other values tested. After testing Loyalty X at 35 Blocks, the formula seems to still be holding up (measured ~1.3 seconds, the formula gives 1.35).

Thoughts?

--23.124.116.45 16:44, 22 July 2020 (UTC) --23.124.116.45 16:45, 22 July 2020 (UTC) (slight edit because I'm dumb)

Thank you for this! SteelMerkava (talk) 03:25, 18 May 2024 (UTC)
Thanks for the very in depth experiment! Judging by your results, it looks like it takes 1 second for the Loyalty enchantment to take effect, then it travels at 10 bps (blocks per second) for level I, 20 bps for level II, and 30 bps for level III, which actually makes a lot of sense. I will add this information to the main page. 159.118.202.129 18:05, 18 August 2024 (UTC)
Thank you for adding the information. I'm unsure why the IP user who did the tests never added the information to the page honestly, but at least it's there now. - Harristic / Talk 👁 Image
18:26, 18 August 2024 (UTC)
I honestly think it's pretty embarrassing that it's taken six years for that snippet of information to be added to the Minecraft Wiki. Another thing I'm wondering about is the cause of the one second delay. My theory is that the delay is the cooldown between when a projectile lands and when it can be picked up again, but I haven't found any information about how long that cooldown is, which is a rather silly oversight on both the trident page and arrow page. AluminumPancakes (talk) 01:07, 19 August 2024 (UTC)
I think there is a little bit more to this. I looked through the game code and did some simple in-game testing (using the /tick command, which didn't exist when the original post was made) and I think the behavior is a little different. First for the game code, it appears to say that after the trident has been in the ground for more than 4 game ticks, the velocity of the trident changes every game tick according to: new velocity = (0.95)×(old velocity) + (0.05)×(level of loyalty). When testing, the sound that the trident makes when returning plays 5 or 6 game ticks after the sound of the trident hitting the block is played. I made an excel sheet to calculate the distances traveled after each tick, and the numbers lined up a lot of the time. I did discover a wrinkle in testing trident return times is that sometimes the trident immediately bounces back towards the player, and sometimes it seems to get a little lost and spins for a little bit before returning. I also did not see a discrepancy for 25 and 30 blocks for Loyalty II when testing. I think the above table and formula might be a good rule-of-thumb for estimating distances, but I don't think I would put it in the article, as it does not appear to be exact. Rampage455 (talk) 03:57, 19 August 2024 (UTC)
I had to make a new topic to add more info and a table to my previous reply, please check there for additional technical info.

I'd also like to address that it is "embarrassing" that it took so long to add. Yeah, six years is a long time, and I'm a little surprised nobody has attempted to add it, but the math and logic behind Minecraft gameplay mechanics can be pretty complicated, even if you have access to the game code (just look at the equations on the armor page). Sometimes figuring this stuff out requires access to the code, and at least a basic knowledge of programming, and decent math skills. That is certainly not everybody who edits the wiki. Also, these things can take a significant time commitment. The work that went into my original reply and the topic I made below took several hours. And as of writing this, I am working on figuring out exactly how mob pathfinding works; I've been tracing through the code for days now, and I'm still not done. So, please be understanding and patient. Rampage455 (talk) 23:31, 19 August 2024 (UTC)

Loyalty return time from code

[edit source]
Latest comment: 19 August 20241 comment1 person in discussion

I had to make a new topic since I couldn't get the table to render in a reply to the previous topic (The maths behind Loyalty's return time). I don't think Loyalty works quite as described in the original comment. If you have access to the game code, and have time to test, please help to verify or refine.

The game code appears to say that after being in ground for more than 4 game ticks, the trident's velocity changes every game tick according to new velocity = (0.95)×(old velocity) + (0.05)×(level of loyalty)

Through the magic of math, I have come up with a couple formulas to compute a trident's velocity and distance traveled for any number of ticks of travel time. These are based on the above equation. I also made a table based on these values to compare to the table in the previous post. In the testing I've done, the trident usually returns within a few ticks of these times. As noted above, there is the odd behavior that the trident sometimes spins around to reorient itself before returning to the player, so there is usually some variation in return times.


velocity at tick n:


total distance traveled at tick n:


Times are measured from the tick that the trident return sound plays, and are listed in: seconds (game ticks)

Distance
(blocks)
Loyalty I
Return Time
Loyalty II
Return Time
Loyalty III
Return Time
5 0.9s (18t) 0.6s (12t) 0.5s (10t)
10 1.25s (25t) 0.9s (18t) 0.75 (15t)
15 1.55s (31t) 1.05s (21t) 0.85s (17t)
20 1.9s (38t) 1.25s (25t) 1.0s (20t)
25 2.15s (43t) 1.4s (28t) 1.1s (22t)
30 2.45s (49t) 1.55s (31t) 1.25s (25t)
35 2.7s (54t) 1.75s (35t) 1.35 (27t)

Rampage455 (talk) 23:17, 19 August 2024 (UTC)

Retrieved from "https://minecraft.wiki/w/Talk:Loyalty?oldid=2666402"

Navigation menu