Why is Bukkit/Minecraft server 20 ticks per second?

Discussion in 'Plugin Development' started by IamHD, Apr 8, 2014.

Thread Status:
Not open for further replies.
  1. Offline


    I've been developing for a bit, and I'm on my way to become a novice plugin dev. But this question has been bothering me for a while.

    #Why the Minecraft server's max TPS 20?#

    What makes is this the magic number? 20? it's way to slow to produce a fluent experience for the users!

    My guesses:
    - Client only accepts 20 packets per second, therefore the server has no reason to run faster then that.
    - Minecraft servers are way too slow, it's generally not possible for a server to run faster then 20TPS.

    If I was the server developer, I'd try to at least get the ticks up to 30, if not 60. Even If it takes to redevelop the server in C++ (Not literally! Exaggeration) Or doing some heavy changing!

    So fellow developers, what is your thought?

    So concluding what everyone said
    • It's 20 ticks because Minecraft Server is poorly programmed, and it can't go any faster
    • It's 20 ticks because that's how the Minecraft game engine was programmed(In game time is based on ticks not delta time)
    Show Spoiler

    if you're not confident about your knowledge on this topic or you know little/less of this topic, please be humble and reply with a friendly tone.
  2. Offline


    The only reason I thought of this is well... think of it where the max is 100.... Just imagine how tough that would be in minecraft
  3. Offline


    Counter-Strike servers ran at 128 ticks if I recall.
    Imagine if Minecraft ran at 128 ticks.

    I guess Notch wanted to have 24000 ticks a day, so that it looks like 24 hours.
  4. In Minecraft 20 ticks is equal to one second, it was simply designed that way. :p
  5. Offline


    As stated, it was just designed that way.

    This has no relevance to the TPS.
  6. Offline


    Mojang decided on a 20 ticks-per-second system. Despite what most people like to think, Minecraft is an extremely complex game, compounded by the fact that Mojang has subpar Java programmers. The only way to improve the tick rate would be to cut down on unnecessary code and features, and then implement a variable time per tick system, since after about 20 tps the tick rate depends greatly on how powerful the server is and what its load is.
  7. Offline


    I don't understand why it would be tough

    My question was "Way is it designed that way?".
    And when I said even if it takes to reprogram in C++, I mean generally people think C++ is faster then Java when it comes to heavy duty. So the point that I'm making there is that the laggy servers that minecraft is so horrible that it's even worth re doing everything.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 7, 2016
  8. Offline


    Yes 20 ticks = 1 second... Why you need more? Mojang decided that it should be so.. counter strike decided that it should be 128 ticks.. It's their decision!
    20 ticks are enought... why need more? They did so and basta! :D
  9. Offline


    But why is it designed that way? The 20 TPS doesn't make logical sense

    I agree that Minecraft is extremely complex, but think about all the other games that are as complex but has a server that handles just fine.
    If the case is like how you've stated, then we can only blame on either of two things:
    • Mojang staff are subpar Java programmers.
    • Java just can't handle the heavy duty. (Which is probably really controlversial and debatable)

    20 ticks per second is farrrrrrr from enough! (literally far!) the eyes will see that something as fluent when it's at 24 FPS. That is the lowest limt! when something is at 24 FPS, we still don't feel perfect but our brains can accept it. Something that is perfectly fluent is about somewhere between 50~60 FPS.
    Back to the point, minecraft server runs at a low 20TPS! It's far too low to let the user experience fluent motion. (Think of the animation of how players turn their head, the animation is so choppy!)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 7, 2016
  10. Offline


    ya.. but there are still 12 million players playing minecraft :p
    It's enought from me.. minecraft isn't a r´high realistic game.. it's .. just minecraft!
  11. Offline


    And guys, I know I'm making a big deal out of this. Yes, we can still "play" at 20 TPS and it's still extremely fun, and doesn't really affect game play to the extent that it's unplayable. But why stop there? We can do better! way better!

    Ya it doesn't affect too much, but think about a fluent Minecraft experience! That would just be beyond words can explain, the user will experience a much more immense game play experience.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 7, 2016
  12. Offline


  13. Offline


    Minecraft suffers from crappy coding. Remember the whole deal with 1.6.2 monsters lagging entire servers due to really bad pathing algorithms?

    20 ticks is something that was used in the olden days of network programming - you will find that info in old networking books, where they discuss the problem of synchronization.

    As it is, Minecraft can BARELLY work with said 20 ticks. It's not uncommon for it to chug, hang or crash. Servers require lots of RAM and CPU power, despite other modern games being more complex and running more fluently. Mojang just didn't care to update their architecture much, hence we are left with parts of code that are most likely obsolete and unoptimized.

    If you want to rewrite stuff in C++, go ahead - no one has done it before because it is hard and not worth the effort, because 20 TPS seems to be enough for players and server admins alike
  14. I made asteroids 20 ticks as well. Counter strike has more ticks, probably because it is a rather fast.paced action game, and that high maybe because it is a fixed/simpl-ish to calculate environment.

    If you don't want to occupy a data center for running a server, you will likely have to split it all into ticks. 20 is just a reasonable choice. Could be the 20 is ranging back to Minecraft being single-player-only.
  15. Offline


    Don't mix TPS and FPS. Minecraft servers are 20tps which is enough. Client can run at any fps, so you can still see everything fluent.

    Why 20? In my opinion, nobody needs more. processing 300 mobs 20 times per second is a lot, not to mention player and physics updates.

    Minecraft uses a lot of ram due to it's chunks. They are all 16x256x16 Blocks, each block has it's id and data, some even more... Don't expect miracles...

    If you want c++ rewrite, then do it and let me go take my popcorn. I'd love to see all those "me pro, but u do that" struggling with networking, interfaces, containers...

    I'm not a great fan of java, I mostly use c++. If server was writen in Java, let it be that way. Rewritnig it with lower level language would only afect performance and very very slightly memory usage.

    I think thats all.
  16. Offline


    sadly you ignored my article that explained source of "lags" on server side, try again.
  17. Offline


    "reprogram in C++" was purely just to make a point on how badly the lag is. A disclaimer there.

    I understand the difference between TPS and FPS very well. What I meant was that the animation(not graphics) of mobs moving depends on TPS, and that 20 TPS effects how movements are updated in the game creating the famous choppy animations in Minecraft. That doesn't; mean the FPS is low on the client, it's just how things update and move around.

    I was offline while you posted that, sorry. I'll have a look at it

    Ohhhh you're making a good point there, yes!
    Minecraft was single player! when Notch did it, he made everything 20 TPS!! SO therefore when they did the server they has to only do 20 TPS! That's probably it right? (my hypothesis )

    Well written! Learned a lot. Your title was impossible to search up(Or useful to the reader!), who would search "Things not covered by any tutorial or javadocs"? I would search "why is bukkit 20 tps". And yes, you explain HOW it's 20 tps, but not WHY it's 20 tps (The purpose of 20 TPS )

    So it's 20 TPS because Mojang sucks at programming (Not saying I'm better, but compared to other game companies. Disclaimer, I love Minecraft and Mojang) XD

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 7, 2016
  18. Offline



    protip - c++ application much more harder to mod, minecraft is soo popular due mods.

    in case of c++ minecraft - good coding, nice performance but no popularity at all.
    kittyPL likes this.
  19. Offline


    20 ticks per seconds means that everything updates every 50 ms. It is enough for minecraft. Even if update comes every 70 ms all the actions are still look smooth to player. So mojang decided that there is no need to update everything faster than 50 ms.
  20. Offline


    Java runs faster than C++ in most cases, it's just usually more intensive.
  21. Offline


    Java may not run faster then C++ in any cases, it always run slower.
    Main issue - it does not matters on modern PC.

    But development time and minimal skill level for java application (and cost) less for java.
  22. Offline


    It certainly doesn't always run slower. Hotspot VM combined with abstraction of memory management produces many real-world test cases where Java/C# will run faster:


    Java can tune itself while it is still running, not to mention that JVMs are tuned a bit more fine for specific machine implementations.

    Overall, it really depends. Good C++ can outperform bad Java, and vice-versa. Fixing things like time complexities in your code as well as memory management and the allocations.
  23. Offline


    also keep in mind that even if the server was running at, say, 8 TPS, the client still does some work to make things look smooth. ever noticed on a laggy server where items appear to be flying all over the place? that's the server telling the client where the item actually is, but then the client does its own physics calculations which means the item SHOULD move smoothly. unfortunately, since the server and client aren't running at exactly the same speed due to lag, the server-side item entity moves slower than the client's version of it, meaning the item could have only fallen half the distance of the one on the client, and so when the server says to the client 'hey, the item [entityid] is at [x,y,z]!' the client thinks 'oh, i didn't quite get the calculations right, i'd better move it to the right spot' and the item jumps. this is a bad system on laggy servers, but when the client and server run at a nice synchronized speed, it smooths out physics incredibly well.

    ps. i think mojang/bukkit should use system time to compensate for lag, meaning physics runs at the same speed no matter how slow the tps gets.

    pps. sorry for the long rant. if too many ppl complain i will spoiler it.
  24. Offline


    That doesn't really make any sense...
  25. Offline


    Garris0n i mean like, if the server detects that each tick is lasting 100ms instead of 50 (10TPS) then it would compensate by making the physics engine do the same things (eg. move entities the same distance) in half the number of ticks, so speed of entities would be measured in virtual ticks rather than actual ticks. so if a pig can walk 10 blocks in 100 ticks at 20TPS, it would walk 10 blocks in 50 ticks at 10TPS, thus taking the same amount of time.
  26. Offline


    I suppose that might work, but it would probably create a disconnect with everything else in the game (click a villager? Sorry, he's actually over there.)
  27. Offline


    Totally not true. Java need VM, It's kinda emulated, translating bytecode to actual processor instruction takes some time. The only Java > C++ is that there are a lot of usefull libs and you don't need to recompile to run on other systems (you can run it on any machine with JVM, which are usually written in C++).

    You need a really bad C++ programmer producing inefficient code to loose with Java programmer. Java and it's garbage collector, nice memory management can deafinitely OPTIMIZE the original code in runtime/compilation, but it will not RUN faster. It just takes some work from programmer, who should care about optimizations...

    I might be wrong now, that is what I've heard some time ago. Look at following pseudo-code:
    Player someLongLookupFunction(int id) //Finds player in list container using his id
        //Implementation, Complexity O(n) = n;
    void doSomething()
        if (someLongLookupFunction(5).isAlive())
    Of course one would cache the variable that someLongLookupFunction returned to prevent double search.
    I'm not sure, again, but I've heard that Java caches the variable during the first lookup and the second call is much faster. I'll try that when I get home. If anyone knows if I'm right or wrong, please do so, I'm really curious if that's true.

    Afaik, animations are almost fully handled by client. There is a thing called interpolation, it's commonly used almost everywhere. Ticks are just to process all AI's and update blocks. 20 is enough and good. And I bet you aren't able to notice the zombie not going directly towards you when you move. He updates each 50ms... You just can not see the moment when it changes its target, and you won't. Even if it was 5 tps you would think it runs fine...

    In my opinion 20 TPS is a great balance between performance issues and fluent gameplay. But that's just me.
  28. Offline


    True it is 24. However the human eye is more of a continuous feed and as our eyes move around they collect the image blah blah blah, however is something is moving so fast (example move your hand across your face quickly) the eye can't move fast enough to keep up with it thus it blurs it. On a side note things running at really high FPS like over 1000 can damage the human eye simply because it shouldn't be captured that fast it can cause headaches etc.
  29. Offline


    Minecraft could probably run at a higher tick rate on a good server, proof being that we can use several plugins and maintain 20 TPS. Vanilla code actually leaves a reasonable amount of time between ticks, enough that more ticks could be executed.

    Saying that the server should be rewritten in C++ is somewhat misinformed, because unless you're using insane C++ only optimization, you get practically no difference between Java and C++ if written correctly. The overhead of java is now nearly zero on a good JVM.
    1Rogue likes this.
  30. Offline


    And at least, you need something like ticks because minecraft isn't written dynamicly (things are executed 20 times per second) and if you want a dynamic in minecraft, it will be much more complex.
Thread Status:
Not open for further replies.

Share This Page