I keep thinking about what it is like to do the physics on the server, so that it is authoritative, and thus avoid cheating, in a game that manages the world by noise, ie the collisors are being generated from the player walking. If the server also generates the world, how do you deal with several players? I can not imagine that it manages the server-side world to give the last word, because if a player is far from each other, they would be in different chunks, so the game would have to run the algorithm to generate for each of those chunks.

Or is it simply ignored, and the server is not authoritative in this type of game (minecraft, terraria, No Man's Sky, or any other that generates logic by noise)?

The problem of not doing this on the server is that players can cheat and send what features are where they are not or which mountains no longer collide among others.


1 Answer 1


and the server is not authoritative in this type of game

Server should always be authoritative and handle all physics and interactions. Clients can run same logic on their side and then just do small corrections if they receive different state from server but server has last say what's correct. Really good article on that topic is Source Multiplayer Networking article.

If the server also generates the world, how do you deal with several players?

You generate world as they explore it. You need to generate world server-side and send that data to client-side. Not sure about other games but Minecraft does exactly that. If you overload your server (TPS lag) or there's network lag, new chunks simply won't appear and if your character moves into them, it will start glitching, falling into void and such. If you have multiple characters exploring world at the same time, you just need to generate terrain at 2 different locations.

Terrain generated using noise can be generated in chunks. When implementing the algorithm, you need to choose chunks that are small enough that they don't cause performance issues but still big enough so that player doesn't see edge of terrain.

  • 1
    \$\begingroup\$ I have read this article. But here it is, noise function is heavy + physics calculation + other possible AI logic. How does it spawn for multiple players? And I read a comment once saying that the server does not use an infinite loop and rather deals with events, I do not quite understand. Does not it have to continue to generate without stopping to work? \$\endgroup\$
    – PerduGames
    Dec 2, 2017 at 4:32
  • \$\begingroup\$ Servers can't generate all terrain in such games because it is infinite. They simply generate small chunks around players. And regarding infinite loop vs events... All networking libraries I've worked so far were working based on loop but you can modify that to work with events too. It doesn't really matter for server, really. \$\endgroup\$
    – Dread Boy
    Dec 2, 2017 at 4:55
  • \$\begingroup\$ yes, I understand that it would not be possible to generate everything, but it is these small pieces for each player, this would not be much processing for the server (it is certain that the server does not have to render, which is already a great help, 100 players would it be impossible for this type of game?) and how do they usually do the loop, generate the world at all times (1/60) or every 20ms or even 50ms to send to the clients? \$\endgroup\$
    – PerduGames
    Dec 2, 2017 at 5:02
  • \$\begingroup\$ Tick rate depends on type of game. If you need deterministic physics, developers usually go with fixed rate (let's say 30f/s) otherwise server tick rate can be variable. Each frame server would generate new terrain if it needs to, process entities, update physics interactions... If terrain generation proves to be demanding, it can also be done in separate thread so it doesn't block main processing thread. \$\endgroup\$
    – Dread Boy
    Dec 2, 2017 at 5:49
  • \$\begingroup\$ If you think I answered original question, please accept my answer. \$\endgroup\$
    – Dread Boy
    Dec 3, 2017 at 5:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .