Architect/Structure of authoritative rpg server system build up

Hi nakama devs,

To maintain a healthy online multiplayer server, authoritative server is a must to prevent any possible cheater to destroy the game we build. However, the structure/architect is completely different between online and offline game. I have a few question to ask about it.

  1. Authoritative server should not only apply in multiplayer environment, but also in single play. If either one loses the proper management, it will cause catastrophic problems (game ecosystem , real money trade etc.). How do you setup a proper authoritative server single play mode code logic?

  2. How does authoritative server actually work? How does the server know which information are to be compared with the information that player have sent to the server, and which one is correct?
    In PvE, player can do various buff, skill, attack, move, dodge, animation, and collision between boxes, If I need to authorize those things, what can I do to minimize server cost? Is there have something not necessary to authorize and why?

  3. Authoritative server mainly focuses on player decision. However, in PvE environment, authoritative server need to check the minions and the boss as well, otherwise, if the player cheats and set the boss dead immediately, or sets the boss and minion’s stat to be in incredibly low health and one shot, the server will not be able to deal with the cheater successfully. Also, having proper management of the player goal is important, otherwise, player can send a win or even in the reward stage message to server directly, which will skip the battle completely and receive the reward. To deal with these kind of problems, how should I build up a proper, high security authoritative server in PvE without causing a major internet latency or delay?

Thanks in advance for the answer, have a great day.

What you’re describing is an always-on single player experience, and yes it’s easily possible with Nakama. I’ll address each of your points below.

  1. You would connect to Nakama every time the game starts, regardless if your player wants to play singleplayer or multiplayer. Give them an RPC function to call that creates a single player authoritative match for them with the appropriate configuration to ensure no other players can join. You can pass this info through the match creation function as initialization parameters, and set the appropriate match label and state to ensure no other players join. How the game play is handled in this single player environment is up to your authoritative match code.
  2. The server doesn’t make any assumptions. It only runs the match handler logic you build using the Lua or Go runtimes. It’s up to you to decide what information the client sends to the server (by sending match data messages), how the server processes them and updates the authoritative state (in the match loop function), and what data the server sends back to the client (using the message broadcast functions). “Server cost” is a little broad, what exactly are you worried about?
  3. “Authoritative server mainly focuses on player decision.” I’m not sure what distinction you’re making here, but like I mentioned in point 2 above your match loop function can easily advance the game world simulation. You can track any number of NPCs and simulate their behaviour, then tell the client to update its state. The same goes for objects in the game world, projectiles, and so on.