Trying to get a good grasp on how a lot of things work, what they do, and where they come into play

Hey there all,
I have been trying to get a solid idea of how things work, the order of operation, what things are essential, etc. I have been trying to go through a lot of code examples and things of that nature to learn how it all works but was hoping to find some more information. When it comes to something like the MMO demo, obviously the "World" master server and world would be up and running. The word cache I would imagine would be populated (from a database?). When a player is to be spawned into the world, they are then represented by the "Avatar"? Say I have a player model in Unity, does an avatar script need to be attached to a particular model with settings on it or are they attached at runtime? Say I have a few models, a human, an orc, and then a male and female of each. Is it predetermined by settings on the actual character model as to what they are, or how does the system know which is supposed to be what if a person wants to create a character and name it and play.

With the "World" running and someone does go to enter the world, what does this process look like from a "flow" perspective? They hit play, that seems like it sends an operation request asking to be put into the world, the server then is passed some parameters of what they want to load into the game. So a character name I guess is what would be considered a key value to know what model to use and where to place them, what gear they may have, etc? Once they tell the server they want to play, I am guessing that is when an avatar is applied to that player's model and spawned into the gameworld? What other things come into play during that process? Assuming only master server and world were actively running, it now would be bringing in the "Avatar" system/scripts, what other things are triggered, activated, loaded during this process? is it several different smaller processes that are called, or does the avatar "system" begin a set of processes itself and handles everything that needs to be done to get a character in-game?

I guess what I am trying to get to is what are the major files / methods that are involved in loading up the world and getting a character in-game? Once master is up, it loads the world. I see World.cs doesn' have much in it, so something must call and include that, what is the main overall process/script that begins the process of loading everything that is required to "load the world"? Once that is all done, what is the major starting point of loading the character into the game? Essentially I am looking for what the starting point is for each major process so I can start there and try to follow each process to see what it does and what all it subsequently loads, and where the next major starting point is for the next major action. World loading, character loading into game, then whatever takes over after that to handle the player moving and what not.

I realize that this became quite long, so I do apologize, it is really the only way I could think of to try and getout what I am after, lol. Hopefully, it makes sense. What would be ideal would be some sort of process flow chart of the major systems, but I have yet to see/find anything like that. I just made this to hopefully help clarify.



Just a high level explanation of what x,y,z,1,2,3 might be, be it the name of a file, the name of the method, anything really to help me better understand what all is going on when the process is happening so I know where to start, and then can follow through the code properly to see where the major components are, where they lead, and what they do would be awesome if anyone had some details.

Thank you much for your time!

Comments

  • Hi, @MostHated

    I'm not sure about what sample you are talking about.

    are you asking community in general? or you asking our help?

    I just can not spend so much time trying to shade some light on all this concepts. i do not have enough expirience in Game development

    best,
    ilya
  • Thank you for the reply. The answer can come from anyone really. It's not game development as a whole, I am referring specifically to Photon Server MMO, whos 3 main parts would be LoadBalancer, MasterServer, and World, right? I am trying to figure out what the major methods and files within Photons usage that are called / triggered when a user connects, logs in, and enters the game world. I realize it seems like a huge complicated question, mostly because it is somewhat hard to figure out how to ask it. As the pic shows and as it relates to Photon Server MMO, when you start the LoadBalancer it then starts the MasterApplication, which then in turn starts the World, yes? When Master starts the World, what methods is it calling, and when it does start the World, what methods load and run to constitute a running world? (High level over view, just the main ones)

    Then when a client connect which goes through the loadbalancer, don't need to know much about that, once they hit the Master Server ( Application) it is going to take that persons connection and put them in the game world, so master then is initiating this process technically, yes? When it is putting a character in the game, what is Photon/MMO's course of action to do this? It spawns a player I am assuming, it then applies an Avatar to them and then assigns the connected client to that player so he can run around in game, right? When this is happening, what are the initiating methods Photon is calling to spawn the player and to add the Avatar to the spawned player?

    Hopefully, this makes more sense?
    Thanks!
  • Hi,
    Are you working on the project that uses the same interest areas technique as used in mmo demo and want to clarify implementation details? Or you are asking how Photon server works in general and mmo demo is just a sample? If the latter is true, I would suggets you to start from simpler demos from client sdk which shows the basics. Please also read Photon documentation https://doc.photonengine.com/en-us/realtime/current/getting-started/realtime-intro to get an idea how it works.
    Feel free to ask if something in documentation or mmo demo code is not clear.
  • MostHated
    MostHated
    edited May 2018
    I am implementing a framework that I believe was built using the MMO demo (it is from 2014-15 though, so not sure if the MMO demo was around then?) It seems like a mix of the CJsomething? (CJR or CJS I think) Multiplayer gaming framework and the MMO demo. The naming conventions seemed to have been changed a bit and a lot of extra things added. There is "Player" in addition to "Avatar". So I am hoping that if I can get the answers to my above question it might help me better be able to look through the code of this and figure out what the currently named files and methods are vs what the MMO demo named file/methods are. I have been working for a 2-3 weeks upgrading Photon, the database system, the Unity code, etc but it would just help to know the major pieces so I can compare them to make sure I get things set up and flowing how they should be.
  • I've read your posts once again. It does not seems like you understand good how Photon Server or Photon Cloud works. MMO demo uses Photon Server with custom code. This is probably most advanced topic in Photon development. So I think you started from the wrong end.
    Did you read Photon documentation?
    Did you try Photon Cliend SDK demos with Photon Cloud?
    Did you try to run these client demos with Photon Server?
    Are you familiar with Photon Server plugin system which may be simper solution for your task.
  • Yes, I am familiar with them. I have most of it figured out and somewhat working now anyway, so It is no worry. Thanks.
  • MostHated
    MostHated
    edited May 2018
    Hello again,
    Back again with some more specific questions, so hopefully that will help for this part. When an individual subserver fires up, does each one get its own "assigned copies" of IncomingSubServerPeer, OutgoingMasterPeer, and a same named Server peer? Example being when the Login application starts, there is the LoginApplication which starts and just runs. Then there is a LoginServerPeer that gets started by something. Then does it also have its own Incoming and outgoing server peers, so all 4 make up the Login server? Is there only one instance of each?

    If so, is it the same for the MasterApplication? Though, Master seems to have a MasterClientPeer, does one of those get created and assigned to each client on the server? As in, does it create a new instance of the MasterClientPeer for every connection? Then does MasterApp also have an incoming and outgoing peer set, or is only 1 instance of each of those things started when you start up the server and they all share the instances? (If all server are running on the same machine, that is) Now that I look even more, I guess there are also OutgoingServerToServer peers in addition to the OutgoingMaster peer?

    --- Edit, just thought of something else. The Fibers, when and where should they be started? I saw the fiber.Start() command issued somewhere, is that something that is started per application and runs the whole time the application is running, or are they started and stopped as needed for things?

    Thanks!
  • hi, @MostHated

    I will answer in general. for every incomming connection server creates peer. we are looking on incomming port to distinguish between clients peers and server peers.

    when some server establish connection to another server it also creates peer. Outgoing peer. Other side creates Incomming peer. No matter whether you start servers on same machine or on different, it works same way.

    Instance of PoolFiber just your gate system theread pool. it does not do anything if you do not use it. so, use it as it suites to your needs. you may keep it during entire application life cycle, or create and release it. We use both ways, as you easly may see: Peers and Rooms fibers live time limted by their owners live time. Lobbies fibers live till application end, because lobbies are not deleted

    best,
    ilya
  • MostHated
    MostHated
    edited May 2018
    Thanks for the info, I appreciate it, it does bring up another question though. When a player connects, it is always straight to Master? From Master, it will create the incoming and outgoing peer for a client. When the player is communicating with say, World or Chat servers, it all still happens through Master, with Master being the gateway to all other servers or does the client end up communicating directly with World or Chat after the player is registered and added?

    If a client sends an operation request that's destination is the world server for movement or something, It sends that operation to the master servers incoming peer for that client and then master communicates through its outgoing server to server peer pair with the world server? I know there are there client incoming and outgoing peers and server to server pairs, but are the server to server peer pairs only for specific types of communication, say registering the server, or does communication that originated from the client get sent from one server to another through the server to server connection as well?

    What it boils down to I guess is, is there technically only one client peer pair, which would be from client to master and then anything else that happens after that is server to server communication or are there additional client connections aside from just the master server to, say, Login, or any others? There would be a lot of client peer pairs because there is one created per client, but then is there an additional peer pair per client per server, or is there only one server to server peer pair between master and world, one between master and login etc regardless of how many clients there are connected?

    Lastly, using World server as an example. There is the World application, then the incoming and outgoing peers, but then there is the "WorldServerPeer" itself. Is there only one of those? I would guess there would be only one incoming and outgoing server to server peer pair as well unless the servers also communicate with each other? As in Login communicating directly with World, though if everything goes through Master, then that would not be the case.
  • 1). Player may start from another server. for instance in case of cloud we start from NameServer, than we connect to master. then client disconnects from master and reconnects to GS. if client needs 'Chat', it establishes separate connection to chat servers.

    >From Master, it will create the incoming and outgoing peer for a client
    there is only one peer on master serving this needs .

    best,
    ilya
  • MostHated
    MostHated
    edited May 2018
    The first part is true for the standalone dedicated server as well, or just cloud ones? I am trying picture how the flow of messages are sent and received on the standalone. I know that Master, World, Chat are each in their own folder with their own settings file, etc. When you start the loadbalancer application it fires up all the things you have there in your folders / configs. When a client connects I guess the client then technically isn't hitting Master fight off the bat and something else that is directing them to master? If I am understanding correctly, once master come up and is active, the login, world, and chat servers would then each request their registration to the mater server, be it if they were all running on the same machine or not. So when Login requests its registration with Master, Master sees its a server based on the port and creates an incoming subserver peer for it.

    Incomingsubserver has an "OnEvent" on it though which had a comment that said "Events from a Sub-Servers are always sent to a client", which is what made me think that things were funneled through Master because it seems like an event coming from a subserver would hit this masters incoming subserverpeer, then master would send it to the client but you had said that a client can connect to master, but then disconnect from master and connects directly to World or Chat servers? In that case what are World and Chat using to communicate directly with the client? I only recall seeing IncomingsubserverPeer which seems like its for subserver on the masters receiving side, OutgoingMasterServerPeer which seems as to what master would use to talk back to world or chat, unless that is what world and chat are using to task to master, but that seems more like what
    outgoingServertoServerPeer would be for. Then there is the MasterClientPeer, which seems like what Master would use to talk to the client. How / what would the world server then use to communicate back to the client? It looks like makes it way back to the outgoingmasterserverpeer in order to send an operation response. which sounds like it would be going to master?

    Does that then not actually end up going to the master server, but instead it would go directly to the client? The next incoming operationrequests, if bound for the world server would end up going directly to the world server and not first through the master?
  • >The first part is true for the standalone dedicated server as well, or just cloud ones?
    currently for standalone there is no support for NameServer.
    Current Standalone version does not have Loging and chat. so, i'm not really sure what you are talking about. We have Master and Game Servers. GameServer register them self on master. NameServer is analoug of Login server in our case. It is not bound to register him self on master. It knows only address of master in order to redirect client to it.
    Similar situation when client connects to master. it gets ip of GS and connects to it in order to play. So, Master server different kinde of servers like World and Chat from your example. It may server either for World or for Chat.

    >In that case what are World and Chat using to communicate directly with the client?
    well, i'm talking about our basic LoadBalancing sample. it does not have Chat. clients connect to GameServers directly. When they finish with game or in case of some error they reconnect to master. 'GameClientPeer' name of class which handles client connection on GS

    >Does that then not actually end up going to the master server, but instead it would go directly to the client?
    exactly. Master Server communicates only with clients who connected to it. same for Game Servers. They communicate directly with clients who connected to them.

    GameServers update some stats on master. this in turn may force master to send something to clients. but that is it. Neither Master, nor GameServer nor other servers are serving in proxy in our case.

    best,
    ilya