Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Getting Started with Auth Server Question

Discussion in 'Multiplayer' started by dklompmaker, Apr 26, 2009.

  1. dklompmaker

    dklompmaker

    Joined:
    Sep 12, 2008
    Posts:
    80
    I have done some peer to peer networking. So far I understand all the principles. I am trying to get started working with a very- very simple auth server..

    1. player asks if he can move
    2. server checks and then moves
    3. player uses dead-reckoning to move to next spot.

    How can this be programmed? I don't need full code, just some pseudo would work.

    Should I use rpc calls? or use my own scripts with OnSerialize?

    If I use RPC calls, how would this be set up?

    Just looking for a little head start, thanks in advance!
     
  2. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
  3. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    I think that network example is a little bit complicated (for me :D )

    I'm starting with network programming, I know somethings already, but, I got lost on that tutorial.

    Anyone, please, can give me a little explanation in where to start in that tutorial? I only need to know how can I start a server, make some little chat and move a character where other players can do the same and see the characters moving.

    Is it very complicated?

    Thanks in advance.
     
  4. Tempest

    Tempest

    Joined:
    Dec 10, 2008
    Posts:
    1,286
    I've started a little side project today to come up with a new tutorial / demo of the Networking Demo, something more along the lines of my PHPHandler class in the "Teaching" forum.

    The multiplayer networking is quite a large thing to digest, so I started today by finding all the resources in the Unity reference/manual/demos related to this, and try to boil it down.

    It probably won't be as simple as a "Networking 101", but it should be a little more demonstrative as in "Networking Implemented in Phases" instead of the Networking Demo which is just *blargh* all at once.
     
  5. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    Yeah, Tempest, thats what I think on that network tutorial. It seems good and work, but I dont know where to start from :D

    I'm reading the network scripting reference, upside down, and still reading other tutorials... but for me its a little bit complicated.
     
  6. Tempest

    Tempest

    Joined:
    Dec 10, 2008
    Posts:
    1,286
    My first project was a multiplayer tutorial, and the only thing I had to look at really was that Demo, as no tutorials are provided.

    I understood what was going on but it was still overwhelming.

    I actually just got some e-mails not but 10 minutes after making that original post, so there's some definite interest in it, :)

    I will be reading / working on the project this week, with something posted up by the end of the week. Expect it to be a condensed "Networking Implementation in Phases" type of Tutorial, instead of a line-by-line explanation of how it all works.
     
  7. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    Very nice from you, as said in e-mail. :D

    I wish I can help in anything. Just let me know.
     
  8. Yann

    Yann

    Joined:
    Oct 20, 2007
    Posts:
    432
    Tempest, this is a great initiative. I have gone through the same experience you describe : working on a multiplayer game based on this network example project and forum lurking - plus what I found the less pleasant part of all : having to browse Microsoft's .Net cryptic documentation :? after years of coding with RealBasic and its unbelievably good docs.

    It took me several weeks to feel comfortable enough with networking in Unity, and no doubt I would have saved much precious time with access to a documented tutorial. Seeing what you already did with php, your next baby will be more than welcome by many users :D
     
  9. matt77

    matt77

    Joined:
    Apr 14, 2009
    Posts:
    21
    I'm another fan of you now Tempest :D

    It's really true that the networking example doesn't help anyone with getting started. After some hours reading the forum, the examples and the reference i've understand much of the networking in unity, and how some parts of the network example work. But nevertheless i'm still a little lost and don't know how/where to begin a client/server.

    Besides, i've also noticed that much of the code is used by the client and by the server, without a clear separation. Is that ok? Would be better to separate the client code from the server code?

    And a final question, could someone suggest wich file(s) should i consider as a starting point for understanding the functioning of the network example?


    Best Regards!
     
  10. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    I've actually felt the straight opposite.
    I've checked the network related documentation to grasp the two major concepts as they are present in Unity (RPC and delta reliable updates) and then jumping straight into the examples to see them in action and toy with the examples to understand how everything works together.
    OK Unity is not the first time I got in touch with networking (I've worked with Torque in the past, worked with ENet as well as straight UDP and TCP in Blitz), but most middle ware technologies have their own user layer on top of everything and the concepts are commonly slightly to heavily different, so it took me the toying with the examples too to get a grasp of how it works in action.


    As for which file to check out: It depends on the networking type you are looking for. Server authored works significantly different than automatic transform updates and has a direct impact on how the networking looks.
    So which kind of networking do you want to use in your game?
     
  11. Tempest

    Tempest

    Joined:
    Dec 10, 2008
    Posts:
    1,286
    In my opinion, the chat script is the easiest to understand. It demonstrates how to recognize the difference between a message originated by you, versus another client.

    The Networking Examples are a godsend in a sense, a blessing in disguise. They contain the functionality that any prototype would probably ever need. It's all there, it's just overwhelming.

    I finished all the manual/document reading earlier today, and looked over the Chat.js. I'm currently going through the generic scripts like ConnectGuiMasterServer, and rewriting it.

    My code will exclusively be in C#, but if you need it in JavaScript, then you can find it in the Networking Example after you read my tutorial. It will be similar, but I will also be adding in a few of my own ideas on networking. Once I reveal these, anyone who has more experience please feel free to correct me.

    @Matt.
    Your question about the server/client code. This is going to come on a per project, per case basis. Take for example, Warcraft or Starcraft played over the internet with a friend. ONE of you two was the host. You had both server and client code executing on the host machine. Many multiplayer Flash games (like those on CasualConnect.com) require one player to be the 'host'.

    You'll notice in the Networking Example scripts the functions will have an If/Then clause in a function. If this client is ALSO the server, do this. Else, do that. It comes down to your own preference and project.

    MUDs, for example, were separate, client and server. The MUD was a couple of processes running on a server somewhere, which did all the storing, calculation, logic, etc, and then all the client was was a display screen. Your telnet application was not processing anything more than gathering and sending your keyboard input.

    So, case-by-case, arguments can be made both way. My project will have ONE of the clients also be the server because I feel that's the easiest way to get a prototype project in to presentation state. Without setting it up like this you would need a third application running instead of just the two for a demo.
     
  12. matt77

    matt77

    Joined:
    Apr 14, 2009
    Posts:
    21
    First of all, thanx for the replies, both dreamora and Tempest :D

    Maybe i was a little too harsh saying that the examples doesn't help anyone ... but i was expecting a more intuitive tutorial. I agree that the code really covers various network prototypes, but IMO the example lacks a tutorial to give some directions for begginers, instead of leaving them on their own to play with the code...

    dreamora, i want to create an authoritative server, at wich the clients will connect and receive updates about the world. I'm currently reading the auth. server code in the example, but would like to hear your opinion, anyway.

    thanx again
    regards!
     
  13. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    You are already going a good way if you read the auth scene related scripts (thats the easiest way to find all related scripts especially the animation sync one as they are different for auth and non auth).
    In addition you might find, given you have a programming background of some kind, gamasutra.org / gamedev.net a good place to find informations about the concepts and possible ways to create such communications, designs for server and especially articles on interpolation and extra polation.
     
  14. asger

    asger

    Joined:
    Apr 6, 2006
    Posts:
    38
    +1 for a network tutorial!

    How is it comming along?
     
  15. Kai

    Kai

    Joined:
    May 28, 2009
    Posts:
    24
    +1 on the tutorial for me as well! I have a pretty decent theoretical understanding on networking, but the Networking sample project felt like a big cluster*#$ to me. I guess maybe it was 4 or 5 samples all in one, with some assets shared between them... or something? LOL

    I guess if I'm honest it comes down more to me being lazy about wading through all the code as opposed to waiting until a nicely formatted, clear tutorial pops up somewhere... :D

    I salute you, makers of the super awesome networking tutorial!