2
\$\begingroup\$

Good time of the day to everyone who is reading this topic.

I've been enjoying playing Diablo 3 and decided to try myself in game development (to lure my friends into Diablo 3 and to, ofcourse, practice in game development).

I'd like to split the question in to following sections:

  1. Lobby System (using Unet)
  2. Game Server
  3. Scene Loading

So, lets start with the first part:
As far as i know, when user decided to play the multiplayer part of the game, he is either creating new game for others to join, or joining an existing game. This process can be observed on the "Joining/Creating Game" screen.

What i'm actually can't figure out, is that if the game created on the users machine (lets name it local) or the Blizzard server (this will be remote). If it is created on the local machine, how then it is protects itself from cheating. If it is created on the remote machine, does that mean that for every 5 (just any number) players, i will have to start new copy of the game server (probably on the different port)

Moving to the second question:
This requires to run a "headless" version of the game on the server. Is there a possibility to create many different rooms for many players by using only one server instance, or will it require to run separate instance for every 5 players. Also, if player is playing in single-player mode, he seems to be also connected to the game server. Looks like the game server is performing all of the necessary calculations and player only sends in the commands for server to process (e.g, move me from 1,0 to 1,1) and after receiving the response, client interpolates the movement received from the server.

And finally, the third question:
Server may have many different scenes, but many players may be situated across many different scenes. There could also be dungeons and other player oriented stuff. So the question is, is it possible to achieve this goal using default Unity functionality.

\$\endgroup\$

closed as too broad by Alexandre Vaillancourt, Kromster, DMGregory, Josh Mar 6 '17 at 17:15

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    \$\begingroup\$ If you're not really concerned about hacking and exploits, it's entirely possible without even a dedicated server to host the games. P2P would be enough for that (Diablo 2 without battle.net), so yes, it is possible with default UNET and Unity functionality. Although you'd need to code quite a lot of stuff. \$\endgroup\$ – John Hamilton Feb 28 '17 at 11:18
3
\$\begingroup\$

I can give some comments on question 1 and 2. I am not able to answer question 3.

Question 1

Remote server: If you have a remote server, you only keep one copy of the game remotely, not a copy for each player. The server stores the state of each connected player (positions, health, items etc). Each player runs the game locally, and mouse clicks and keyboard actions will be sent to the server for validation, and broadcasted to all other machines. Each local game will then use the input actions from the server to animate the players on their own screen.

Local server: The same as a remote server, but all communication will be sent through the server hosted on the local machine. The same rules apply here as on the remote server. The user action validation is still processed by the server instance.

EDIT: added some extra comments to the second question.

Question 2

I do not fully understand what you are asking about, but you do not need to have assigned servers for each room. The server can manage rooms in many different ways. I would suggest using a map with the roomId as key and containing an array of connected players (e.g. Java-style:HashMap<String,Array<Player>>. If you want to have each room playing their own game, you can assign a game instance (still on the same server) for the specific room with players. A server can run many game instances, still on the same server instance.

If you are playing single-player, you do not have to be connected online, because the server can be run on your local machine. The server will still receive the user actions (like moving attacking, picking up stuff and so on), but instead of passing all those actions over the network, pass them to the local instance of the server. I think it is common to still use an online server for authentication, but that server does not have to be the game server.

Final Thoughts

There are many different architectures for this specific problem, and I think you can find good resources if you try to search around on the internet. My answer is just some thoughts, and does not give THE correct answer, but hopefully it can be of help.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.