Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Multiplayer is really easy to add to a game nowadays, right?

Discussion in 'General Discussion' started by imaginaryhuman, Apr 6, 2017.

Thread Status:
Not open for further replies.
  1. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Who wants to add networked multiplayer to their game? It sure seems like a popular and highly sought-after feature, and partly the reason for that is that it's so cool to play against real people with real intelligence, but also it's traditionally been hard to do, what with all the server setup and scaling and network traffic handling and connections and object sharing and all that. This therefore makes it more 'rare', therefore sought after.

    Well I've been thinking about doing it, and so I wondered how easy it is now. We've had years of modern software development right, so... it should be EASY PEASY by now? Here's what I think the experience should be like as a total newb:

    1) Create a scene, select some objects, check a box, they're automatically networked.

    2) Create a virtual lobby in a built-in editor window, with chat and some settings for how many people per game etc, easy customizable UI, it just works. Players can now find each other and play games.

    3) Built-in automatic support for high score table(s).

    4) Easily upload and download user-generated content/data and built-in browsing of said content.

    That's all.

    If not why not? Why is it any more complicated in this day and age?
     
    lagalot123 likes this.
  2. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    5) make mmo button!

    Game development is hard. Network game development is harder. You've been around for a while, how have you not learned that there are no shortcuts to making a good game? Or am I misreading your post?
     
    AxPetre and wccrawford like this.
  3. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Why is what more complicated? you listed several different things that have zero relationship to each other aside from vague references to multiplayer. If you're wondering why it might be complicated it's because 1, 2, 3, 4 all require different types of internet technology and networking. Some need databases, some need hosting, and so on.

    Plus the more automatic it is, the slower and more inefficient it will become unless you add more limitations, then pretty much only a handful of people want it.

    I agree things can get easier, but it's not easy.
     
  4. ChazBass

    ChazBass

    Joined:
    Jul 14, 2013
    Posts:
    153
    In a theoretical zero latency, fully networked, single format, un-policed world, I think you could easily get there. But in the real world the problem becomes hard for those very reasons, right?
     
    wccrawford and Martin_H like this.
  5. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,196
    If you are talking about a very simple multiplayer game and using Unity's new networking or Photon... well, maybe, I was able to tackle a very simple multiplayer game using Photon with lobby, color choosing, name, custom character outfit and some other things... and I am a very (very) bad programmer.
     
  6. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
  7. Master-Frog

    Master-Frog

    Joined:
    Jun 22, 2015
    Posts:
    2,302
    I would avoid the word "hard", because it's not nuanced enough.

    Networking is involved, involved and very interesting, but not as complex as some make it out to be. Many networking functions are wrapped for you, because the low level business is of no real concern to you. Chances are you couldn't write it better than the guys who wrote the library, anyway.

    when you start doing networking you're going to be asked to think about data. You going to be asked to understand the shape that your data takes inside of the machine. and how it's transmitted between 2 machines and also how it is stored within all machines. For some people who like to attack those like myself that suggest everyone can benefit from learning c and how memory is allocated, yes I guess it can be very challenging even impossible.

    At the point you're sending things over the network you're stripping away all of your fancy stuff, because training wheels require too much bandwidth. One day that technology will be there, but it's not there yet.

    but if you approach it like you should as a serious problem that is interesting that you need to study in order to solve then you will succeed.

    but at no point would I describe networking in games as being hard.

    wiping your bum with a hook for a hand is really hard.

    networking in games is just involved.
     
    GarBenjamin likes this.
  8. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,321
    Wrong.

    Dealing with lag and movement prediction. Basically, multiplayer should be built into the game from the beginning, and not added afterwards.

    Lobbies and high score tables do not deal with this. Actual gameplay, though... that's where things stop being easy.
     
  9. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,124
    Because solutions like that aren't very flexible. You'll only really find them in engines designed to create reskinned clones.
     
    Martin_H, Kiwasi and ADNCG like this.
  10. EternalAmbiguity

    EternalAmbiguity

    Joined:
    Dec 27, 2014
    Posts:
    3,144
    I'm not sure what this thread is about. Is it someone requesting information on implementing mp? Is it someone commenting on how easy it is to add mp? Is it someone asking why mp is in so many new games, and positing that it's because it's so easy? Is it someone asking if we want to add mp since it's so easy?

    I don't know.

    Okay, sure.

    I imagine part of it is because it maintains a userbase on multiple levels. And because it can give a diversity of experiences, based on what is possible in the game (like someone having virtual sex in WoW, for example).

    No, I have no interest in multi-player. It's a totally different experience from what I want to supply to a player of my game(s).
     
  11. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,384
    Someone is asking why there is no make mmo button.
     
    Martin_H, Ryiah and EternalAmbiguity like this.
  12. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,511
    I'm sort of coming from the angle of the OP, but I've been in the industry for about a decade, I worked on a AAA multiplayer game, but not directly with the backend, etc. It was mainly with the gameplay code that used the MP architecture.

    And now, with Unity, I was telling myself exactly that... that "it shouldn't be too hard now." I recently decided to implement MP in my next game, but it's not a real-time game. I wouldn't even touch that, as that's still a full-time job. I'm working on a turn-based, asynchronous game. Of course, I chose Photon and PlayFab for this.

    Photon/Playfab marketing make it sound easy, but there's still a lot of work involved to get a product out with a highly polished state. Sure, I can login, create game "rooms", interact, save them on a webserver, log out, and revisit that saved room. But there are still a lot of moving parts. User accounts and authentication (in my case, with PlayFab), I'm having to learn Javascript and JSON specifically for writing the web hooks on the server side. Testing these scripts is a pain, because you update the server side, debug on the client, etc. It doesn't really help that the Photon/PlayFab documentation, while thorough, is scattered all over the place on the internet. I also didn't realize how big a topic Matchmaking is. Generating a list of games in a timely manner is definitely a problem. And then there's the budget to worry about... The free tiers of Photon/Playfab are limited with storage and bandwidth, so you have to be careful. That's the business side of it, where, you have to take a gamble as to which "tier" you are expecting for your game, and obviously scale up or down accordingly, but that's all $$$. For an example, one gripe I have about Playfab is that the db storage where I'd save room sessions (shared group data) allows for only 1000 bytes for the session. As is, I can't fit all my game's state data in that small space. I'd have to upgrade.

    And then, there's the client side handling. You still have to capture all those server state changes, and error messages on the client, lock out the player accordingly with loading icons, and generally, just reflect exactly the state of the server. While, straightforward, it's always been an annoyance to get this thing right, meaning several iterations so as to give the player a good experience.

    So yeah, it's easier, I don't have to worry about standing up my own servers, balancing players in regions and shards, setting up my own user account db, authentication, game server dbs, leaderboard dbs, analytics, etc. But it's still a lengthy process to get it done at a high level of quality.

    I have an upcoming blog article about this, and I plan on writing more about it as I get further along in my game.

    EDIT:
    Added client-side handling comments.
     
    Last edited: Apr 6, 2017
    Kiwasi, Ryiah and Rodolfo-Rubens like this.
  13. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    5,984
    I worked for a while on a multiplayer fps, mainly to become familiar with photon and multiplayer in general. I only worked on the game scene itself, and I'm not an expert by any means, but it wasn't incredibly difficult to approach.

    What turned out to be quite difficult though was efficiently synchronizing gameplay across all the different clients, and dealing with game-breaking issues arising from lag etc. Not to mention that the only way to debug was to make a build, run it and start a game with the editor version and the build version, which slowed things down a lot. From the perspective of someone inexperienced, it's also relatively easy to make a mistake where something becomes recursive back and forth across the network.

    So my take is that ok, it's fairly easy to set it up, but it's not easy to smooth it out, and it multiplies debugging and iteration time by a few factors. Still, it wasn't as difficult as I expected, given the general reactions on the forum to the very idea of a multiplayer game. An mmo though (hundreds or thousands of players) would probably be a lot more difficult in terms of optimisation and synchronization.
     
  14. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    I've been making MP Games off and on for years and I find the only truly hard part is cheat prevention.

    Everything else I can knock out without thinking twice (Interest Management, GameLogic, Spawning, etc).
    I haven't attempted an MMO type game either, where server-to-server networking comes into play, but then again never been interested in making one either. I prefer games like Battlefield an such, which in reality - aren't that hard to make, the logic is quite simple, - players and vehicles spawn - player transitions from and to vehicles, health, weapons, either Triggers/Sphere casts for the capture points... Yeah yeah there's definitely more to it than that, but you get what I mean. The base mechanics for any online game is actually quite simple to make.

    The hardest part outside of cheat prevention is coding things to a point where they actually make sense to do what you did, anyone can spawn an object, but not everyone know's the most efficient ways to do things properly.

    So in my opinion, it's quite easy to make pretty much any online game, but it's not easy for someone with no experience to make it correctly in terms of performance.
     
  15. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Thanks for the replies guys. My proposition is that, in general, this area of development IS generally 'hard' or at least involved and complicated with many things to consider. And since Unity is in the business of taking the pain out of development, or solving hard problems so that we don't have to, I think this is an ideal area in which Unity should focus to really improve the experience of adding multiplayer to a game. It really should and COULD be as easy as I described so that someone who is even just an artist and not even barely a programmer could create a multiplayer game that works reasonably reliably.. as in you could sell a decent product based on it and have a reasonably large number of users etc.

    I'm not totally new about networking I am mainly trying to provoke some discussion as to why this is still such an area of pain and struggle and what can be done to make it much easier to use. If Unity wants to democratize development, this is one area that needs some serious attention. I'd be happy with some simply editor features built in which allow me to just 'plug in' multiplayer and set it up very quickly and easily for some basic scenarios or game types, in a WYSIWYG fashion without having to go write a bunch of scripts. Even in the documents about how to get started doing networking in Unity, it's an incredibly long piece of information to digest and learn from, and it really should not have to be this hard or as complex or as much of a struggle to even understand all the little quirks of trying to sync state over a laggy or NAT-translated or whatever network. Give me a basic simple way to connect people and to hook them up to the scene and to sync the game state. Is that too much to ask?
     
  16. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,384
    Why is building a house hard? Because there is no standard floor plan to automate.

    Networking is such that you cannot provide an optimized auto-magic solution that actually performs well. Significant work is required to make networking good for your specific project.

    It's clear you have zero networking knowledge so there is little reason to explain the details to you because it doesn't seem like you're listening. I would suggest trying to do a networked game on your own and revist your complaints afterwards and maybe even provide some constructive criticism instead of whining about the existing implementation of something you don't even use.
     
  17. GarBenjamin

    GarBenjamin

    Joined:
    Dec 26, 2013
    Posts:
    7,441
    It's been a long time since I dabbled with it but it sounds like you would like something like the old DirectPlay (think that is what it was called). As I remember it had support for client, server and peer to peer as well as lobbies. The beautiful thing is it took care of all of the underlying connection stuff. I remember playing around with it and thinking dang this makes it dead easy.

    Only you want it to be Editor-based instead of just a programming api. Of course you still have to manage the actual gameplay side of things. You're always gonna need to do that I think because you need to decide how to deal with delays and such. Although theoretically this could be included in your Editor-based thingy in the form of time-scaling I suppose or better yet update iterations.

    I do agree it is strange this kind of thing isn't available out of the box built in these days (maybe it is but I always hear about Photon)... considering Blitz had it a decade or so ago (actually that was based on the MS DirectPlay as I recall) and I think Dark Basic did too.

    Honestly I wouldn't be surprised if there are drag n drop multiplayer game makers out there on the web that have what you want. I'd almost bet there are. I mean hey it is 2017.
     
  18. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,321
    I really don't think so.

    Yes. It is that one point where you need to stop being "just an artist" and start working on improving programming skills.
     
  19. tango209

    tango209

    Joined:
    Feb 23, 2011
    Posts:
    379
    If you just want a framework for specific genre and can live without much customization, it's possible, if not available somewhere already. Otherwise, you are using a general purpose API, which pretty much by definition means it's not going to be trivial.

    Networking, threading/parallelism/async, complex/unclear optimization, etc., these things all have one thing in common, you do them when you have to. They are an order of magnitude more involved; coding wise, debugging, and supporting.
     
    LaneFox, GarBenjamin and aer0ace like this.
  20. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,528
    I agree about threading/parallelism and complex optimization. But networking has such a profound impact on the design and implementation of a game that you must handle it from the outset or not at all.
     
    aer0ace and tango209 like this.
  21. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,196
    I'm wondering how is to work this way with big games where the builds results in >1gb... :confused:
     
  22. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    5,984
    That would be bad. Fortunately the game I was working on was mainly the core and didn't have too many assets. I wonder if it would be possible to create some sort of editor test environment for this?
     
    Rodolfo-Rubens likes this.
  23. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,196
    That would be great, like separate game views each for a client that act as it was a running in a different machine or something like that!
     
    Billy4184 likes this.
  24. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,511
  25. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    I surprisingly find MP games MUCH easier than making a single player game, I find authoritation, etc. way more simpler than Single Player games.

    Simply for the fact that it's much easier to code a game (for me) that says hey, the player can do XYZ things and nothing else, however on a single player game, you gotta deal with XYZ for this player, XYZ for this AI, then code the AI to do XYZ things, then make it Smart enough to make sense with today's AI's.

    Which is why I prefer MP games, the only major draw back is - if your game isn't popular, you're gonna go into debt by owing money to Photon or Unity, unless you choose another package.. I stick with Photon, the cheapest solution I've found so far, and is reliable.

    EDIT: I am in no way saying Networking is easy. Only it's what I prefer to make.... I've tried and failed so many times with MP games that it's become one of my favorite things to make. But this came with failure, failure is a way that will either show you where you want to go, or show you the door.
     
  26. ADNCG

    ADNCG

    Joined:
    Jun 9, 2014
    Posts:
    990
    Personally I've been working on my first MP game. It's a tile/board game where 2 players play together or versus in real time. Designing it has been a nightmare.

    Initially I designed the game as a single player game, released it as such, then decided to make a multiplayer remake and starting rewriting core systems from scratch.

    Got bored to death halfway through, tried to plug half the old systems to the new half. I take pride in saying that I probably have designed the ugliest code in 2017. It's a broken mess, but hey, it works. I'll never touch it again.

    Long story short, if the thought "I'll start designing the game for singleplayer and maybe I'll implement multiplayer later" sounds familiar, odds are that you'll end up being scarred for life as well.

    Edit : Realized I strayed away from the topic. I think that MP is hard to implement because it's very design sensitive. It can involve so many different things and obviously a solution that is good for some ends up being a step backward/a limitation for all others.
     
    Last edited: May 4, 2017
  27. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    That's why you if you develop it for MP then design it that way.... At least with Photon you can code the entire game as if it were Multuplayer and at the end of the day can make it working for Single Player by typing in 1 line of code... It will call the RPC's as if you were calling Methods without using any online functionality. It's just sorta one of them things that if you ever plan to implement MP into your game, may as well just go ahead and do it otherwise you'll be creating your game twice, at least in terms of coding.
     
    theANMATOR2b likes this.
  28. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    Here:


    4,5 hours and you have a playable multiplayer first person shooter with a lobby. That has to be considered easy peasy? I've followed this tutorial myself and I've played the resulting game with my friends. It worked perfectly fine, and I thought it was amazingly easy, way easier than I thought it would be to make a multiplayer game.

    It's far from a good game, and it's far from a solid multiplayer implementation, but after 4,5 hours you wouldn't have a good singleplayer game either.
     
    theANMATOR2b and N1warhead like this.
Thread Status:
Not open for further replies.