Search Unity

My tip for multiplayer.

Discussion in 'General Discussion' started by TheGaul, Dec 27, 2020.

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

    TheGaul

    Joined:
    Apr 15, 2019
    Posts:
    199
    If you want to make a simple multiplayer game using Unity and you don't care about graphics here is my tip.

    Download Unity 4.7. Read up on the legacy Networking code and things like RPC calls. Get a cheap cloud instance of Windows/Linux. Hot the Masterserver/NatPunchthrough on it.

    It is easy enough. It is free. (Maybe except for the cloud instance £10 a month?)

    If there is a better way I don't know what it is.

    Merry Christmas one and all.

    :)
     
  2. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,141
    Unity's networking solutions are constantly being deprecated and replaced with newer ones making them a terrible choice for any project that has to be supported long term. If you need an existing network system choose one that is not dependent on Unity.

    Link below is a couple years old but it has a few examples both free and paid as well as benchmarks.

    https://forum.unity.com/threads/ben...dgren-miniudp-hazel-photon-and-others.512507/
     
    Last edited: Dec 27, 2020
    TheGaul likes this.
  3. TheGaul

    TheGaul

    Joined:
    Apr 15, 2019
    Posts:
    199
    But my idea is just to use the old one because it will never change.
     
  4. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,141
    Choosing an old release of Unity will majorly handicap you. Old releases of Unity were primarily used for mobile development but neither Android nor iOS are compatible with old versions. You'd be stuck with the standalone platforms but even then I'm doubtful anything other than Windows would work properly.
     
    Last edited: Dec 27, 2020
    NotaNaN likes this.
  5. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    The best solution is to simply make your own socket server (or use an existing one), and then let your community host their own servers. The old games did this and it's a tried and true method that costs you absolutely nothing at all. Don't need any master servers, etc. Yeah it's good to have one, but your community can take comfort that even 20 years down the road they can still play your game with others. (assuming the internet hasn't changed at least).

    Try that today with all this cloud non-sense built in. The moment you want to pull the plug your entire playerbase will be all up in arms because it wasn't profitable enough to keep the cloud services so nobody can no longer play the game online.

    For example if Microsoft wanted to shut down minecraft and never touch it again ever, people could still play it because there's a direct IP connect. Heck even Terraria and Starbound use the ol' tried and true method of user host a server and people join by IP address. At the time there was no server lists, etc. Just had to know an IP to connect too.
     
    SparrowGS and TheGaul like this.
  6. ChazBass

    ChazBass

    Joined:
    Jul 14, 2013
    Posts:
    153
    Or just use the latest release of Unity and Photon. Yes, you have to pay beyond their free tier, but if its a paid game, that is a high class problem.
     
  7. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,513
    There's been a lot of buzz about Mirror in the past year or so. It's open source, and built for Unity. I'm definitely going to look into this if I decide to implement multiplayer for my game.
     
  8. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    Photon works for like 2% of the games that people want to make.

    [The below is assuming you are using the CLOUD version, not the OnPremise]
    1 - No way to prevent cheating (period at all).
    2 - Extremely limited in how many messages you can send. Which means limits in terms of player counts.
    3 - You have no control over how the influx of data is handled, it's literally a WYSIWYG.
    4 - Nearly impossible to get a proper interest management system working.
    5 - Obviously the payments.
    6 - Without a solid community with thousands of people ready to go, you are [potentially] wasting not only your time, but the money it will take to keep the game online.

    Don't take me wrong, there's nothing wrong with cloud based solutions, but don't complain when the problems above happen (mainly the cheating) part. Cheaters will disinterest players and #6 will become irrelevant fairly quickly because nobody wants to play a cheater infested game. So the game will die before it ever really has a chance to shine.

    Cloud solutions are moreso for co-op based games with 2-3 people where it doesn't matter if you're cheating because you're already all friends anyways, so chances are you'll cheat together lol.

    This is the problem with cloud solutions, it's a quick-fix bandaid solution to a problem. While it does work, it does have use cases (such as the co-op example). In the end, it's really a trap. Now if you own the entire cloud infrastructure than yeah duhhh it's a good choice, and this is why AAA companies that do use it can actually do it, either they have their own infrastructure for it, or they buy up a big bulk quantity of the machines from a company and then have their own master-server logic controlling the cheating systems.
     
  9. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,141
    It's just Unet (HLAPI) with some minor improvements and bug fixes. Once upon a time I was recommending it but posts like the following convinced me to steer clear of it.

    https://forum.unity.com/threads/im-confused-what-replaced-unet.643606/#post-4319818

    Incidentally the contents of that post were written by the MLAPI project which is now officially joined with Unity to offer a networking system for GameObject-based games.

    https://blogs.unity3d.com/2020/12/0...gameobjects-multiplayer-networking-framework/
     
    Last edited: Dec 28, 2020
    aer0ace, JoNax97 and Antypodish like this.
  10. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    How many multiplayer games have you released using this tip?
    one tip for you - start making games instead of threads (if i assume the answer correctly)
     
    JoNax97 and Antypodish like this.
  11. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    What you talk about has nothing with hosting in the cloud todo. You can be 100 procent authoritative in the cloud. Where you host your servers have nothing todo with the software they run.
     
  12. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    I don't think self hosting is a reliable solution today, kids today are not made of the same wood. If the NAT punchthrough fails (not all routers support NAT punchthrough) they will blame the game instead of opening ports.

    Best solution is probably a combo have some dedicated servers and also let the community self host.
     
  13. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    You must not have read what I said - I said Photon Cloud, not general cloud networking or Photon Server. And then towards then end I said the reason AAA companies and such can have a cloud system that can handle the global population is because they either can afford to buy their own infrastructure or afford to pay the tens of thousands a month to a 3rd party to let them use their infrastructure with their own master server to make sure cheating doesn't happen.

    And it's not as easy as one would think - Rockstar fails at preventing the cheating with their cloud network. People very easily steal your personal information such as your location, ip, can get you banned for crashing a server even though you didn't, red dead online they can yank your money, take your guns, follow you to any session you ever join and make it where you can't move, can literally crash your computer, etc. And this is why cloud systems inherently are band-aids, if the 3.5 billion dollar Rockstar can't even make a cloud solution authoritative, there's problems. Or perhaps it's not worth the investment to make it authoritative for a game of it's scale, can't say on that matter.
     
  14. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    Dude it has nothing todo with cloud hosting. You can take any code and run it in the cloud.

    Edit: reason they make it peer 2 per is cost. You pay for network traffic.
     
  15. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    Yeah this I can agree with - and would be relatively inexpensive. And if all fails you can at least offer a direct-ip connect if you have to yank the master servers down.
     
  16. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    Thing is any type of hosting costs money. If your game costs x money than after y hours the player have used up its time in traffic and CPU costs. That's why the need to mininize traffic. But it's a problem with all hosting, sure you can go fixed price but that's likely to run out of y hours even faster.

    Or you go subscription model instead of pay to own.
     
  17. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    I'm not sure you are quite understanding what I'm saying.

    You do not have any access to Photon's cloud servers is what I'm trying to say, so you cannot prevent the hacks. Not sure how this is hard to understand. Even the people who work at exitgames have said this a million times.

    Player A > Starts Session.
    Photon > Gets the request and starts a room.
    Player A > Joins Room
    Player B > Joins Room.

    Player A > Starts with a 9mm
    Photon > Doesn't have a clue what a 9mm is.
    Player A > goes to Cheat Engine and gets an M4A1 but also changes the projectile to a 500mm anti-tank round.
    Player A > Shoots
    Photon > Gets the request
    Photon > Sends the request.
    Player B > Gets the request
    Player B > Dies
    Player B > Tells Photon that they died to a 9mm shooting as a M4A1 with 500mm Anti-Tank Round.
    Photon > Again doesn't know what this means and relays this message back to Player A.
    Photon > Tells Player A that Player B died.
    Photon > Waits for next request.

    There's no way to access Photon to be like "Hey look out for this, make sure this is correct and if it isn't, correct it". Photon Cloud is a literal send message from A to B to Z, it doesn't have any concept of your game and it never will unless Exitgames allows you to have access to their servers.

    I'm speaking very very specially about 'photon' cloud. Not cloud. But [very] specially photon cloud.
    How can one make Photon 'cloud' Authoritative if one has no permission to go into their systems to make 'photon cloud'understand the concept of your game? You Can't, and even exitgames have said this over and over over the years on this specific forum.
     
  18. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    You mix photon and general talk about clouds (like rockstars) so it's hard to follow your logic that's why
     
  19. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,051
    It is off topic for a while... granted the original topic was of topic and odd. So we are going to end this. Use the connected games forum to have a specific discussion on available platform.... or see if one exists first.
     
Thread Status:
Not open for further replies.