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. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

I want to make a simple multiplayer game

Discussion in 'Getting Started' started by omnisdingin, Aug 13, 2015.

  1. omnisdingin

    omnisdingin

    Joined:
    Aug 13, 2015
    Posts:
    24
    I'm really interested in programming video games, but to be honest I've given it a try before(learning I mean) and I couldnt seem to figure anything out. From what I understand... you can do something with just some models(with animation clips) and simple scripts. I wanted to make a game similar to the "Worminator" game from the "Tornado Twins"(which you can check out on youtube(type in Worminator Tornado Twins.)

    The first thing I want to do is get some models with animation clips. Then I want to create scripts for movement and animation and firing projectiles and getting hit by the projectiles and subtracting health and respawning. After that is all done I want to make it multiplayer.

    If you check out the worminator game from the tornado twins you will see that the models in that video are not animated with animation clips... nor is it multiplayer. I think I can figure out how to make some simple scripts for movement and animation and the combat(which is basically just projectiles and getting hit and subtracting health and respawning.)

    ... but I don't think I can figure out the multiplayer. I was wonering if someone could just show me a simple way to make a game where the players can connect the host and be given their character.
     
  2. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,852
    Forget animations or models or multiplayer for now.

    Start with 2D single player. Then work out 2D for split screen multiplayer. Then look at building a game with UNet multiplayer.

    UNet does a lot of the hard work of networking for you. This still leaves it as one of the hardest topics to program.
     
  3. omnisdingin

    omnisdingin

    Joined:
    Aug 13, 2015
    Posts:
    24
    You're suggesting that 2d is easier than 3d. I don't think there is anything difficult to understand about 3d modeling and rigging and animation.
     
  4. Master-Frog

    Master-Frog

    Joined:
    Jun 22, 2015
    Posts:
    2,302
    Simple multiplayer... what is that?

    You can make super simple games without programming but only with purchased assets. If you want any customization, then you'll run into programming. Ironically, at that level you'll be super lost just looking at the scripts...

    And so forth
     
    Last edited: Aug 13, 2015
  5. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,499
    I agree, simple multiplayer sounds like an oxymoron. Everything is relative sure (simpler than something), but still.
     
  6. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    Multiplayer should be considered an advanced topic. You might be able to fake it till you make it, but with limited programming experience dont expect it to be easy.

    2D is generally easier than 3D. The things you mentioned are trivial when it comes to 3D. The complexity comes in 3D code.
     
  7. Fantastic Worlds Studio

    Fantastic Worlds Studio

    Joined:
    Apr 26, 2015
    Posts:
    48
    Simple multiplayer? You find that and I'll join you. I've been trying to get my head around the complexity of java networking, and let me tell you, its a clusterf*ck of classes, methods, threads and so interwoven that I have to close my project after a while and wonder what I got myself into.
     
    georetro and Ryiah like this.
  8. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,852
    In 2D none of these things need to happen, therefore it's much quicker. Sticking to 2D is simply a way to get you to doing multiplayer faster.
     
    Ryiah likes this.
  9. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,156
    Well of course it's like that if you bother to do it correctly. If you want something easier on the eyes, just jam it all into one class :) Java networking isn't that bad.

    @omnisdingin it doesn't get any easier than UNet, download some of the sample projects in the multiplayer section of the forums and look at everything marked [SyncVar], [Command] and [ClientRpc].
     
  10. Fantastic Worlds Studio

    Fantastic Worlds Studio

    Joined:
    Apr 26, 2015
    Posts:
    48
    The problem for me is trying to find a good tutorial on java networking that covers multiplayer/mmo game design. I can't find one, and you'd think that after all the MMOs and multiplayer games made, even with java, there'd be at least one. But all the tutorials I have found do some simple networking or the person doing the tutorial doesn't take the time to explain they why of the code, just zips through it.

    That's why I am waiting for the Linux editor for Unity, their new networking system is awesome and I can focus less on the underbelly of the code and work on my game.
     
  11. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,156
    Definitely look into RPCs. You'll have less network traffic and less not-good-ness. The built in unity stuff is demonstrable not-good. Download any of the samples and then on the client try running into a wall. The server gets there first and your client bounces off the wall before reaching it.
     
  12. ostrich160

    ostrich160

    Joined:
    Feb 28, 2012
    Posts:
    679
    HA, simple multiplayer, good one.
    Im currently using Playfab for my multiplayer however.

    If its so simple, do it.
     
    Kiwasi likes this.
  13. omnisdingin

    omnisdingin

    Joined:
    Aug 13, 2015
    Posts:
    24
    Yeah I really woukl like to make some models with animations. And I truly do think it is simple .Just characters that slide and jump and shoot.
     
  14. omnisdingin

    omnisdingin

    Joined:
    Aug 13, 2015
    Posts:
    24
    Here's a script I have so far it is for a character that moves/jumps/shoots/gets hit and takes damage/dies/respawns. I don't have the translate set to any specific vectors because I'm not sure what x/y/z are in the series nor am I sure how big the integers have to be. Its also not for any specific engine.

    http://pastebin.com/CiqVK9Z4

    I want a script that will connect the clients to the server and give the players control of certain game objects.
     
    Last edited: Aug 15, 2015
  15. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,852
    Starting to sound a lot like a "Please make my game for me" thread. If you want a script, write one.

    Here is a starting place. http://docs.unity3d.com/Manual/UNet.html
     
    ostrich160 likes this.
  16. omnisdingin

    omnisdingin

    Joined:
    Aug 13, 2015
    Posts:
    24
    I mean like how much could I pay someone 1. to take my script 2. revise it for an engine 3. make a script to connect the clients to the server and give the players control of characters with this script attached to it 4. revise my same script again to work with the multiplayer script
     
  17. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,156
    Oh, right, this thread.

    Go download the samples from the multiplayer section and check out what's already available before you think you need to get more people involved.
     
  18. omnisdingin

    omnisdingin

    Joined:
    Aug 13, 2015
    Posts:
    24
    Well that would entail me trying to figure out something that I maybe can't comprehend. It would be cool maybe to see how to add custom assets to a marketplace project but I would rather pay someone(when I have money) to make something much more simple... and then add my assets to that.
     
  19. tedthebug

    tedthebug

    Joined:
    May 6, 2015
    Posts:
    2,570
    Just make it with primitives to see if the gameplay works & is fun. If it is try your multiplayer on one screen. If it's still fun start replacing the assets with nicer ones. It will take a little bit longer but you won't be wasting time & money on assets up front only to find the game isn't fun or is to hard to make.
     
  20. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,852
    Paying someone is a valid option if you have no interest in programming. Check out the commercial threads or PM someone you trust. You'll typically need an artist as well for most projects. Some people can do both.

    Be aware that programmers aren't cheap. About two thirds of the potential clients that approach me disappear as soon as they hear my rates. I'm starting full time work tomorrow, so my time available for freelancing is limited. But you are welcome to PM me for further discussions. Quoting rates and making deals in the public threads is frowned on by the mods.
     
    Ryiah and Schneider21 like this.
  21. AndreasU

    AndreasU

    Joined:
    Apr 23, 2015
    Posts:
    98
    quill18 has a tutorial for a FPS game using Photon for the networking:
     
  22. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,156
    Oh do you have the art assets and an idea already? That's definitely a good case to hire then.
     
  23. omnisdingin

    omnisdingin

    Joined:
    Aug 13, 2015
    Posts:
    24
    It wouldn't be hard to make the assets... the assets are just animated characters(simple clips) and scenery.
     
  24. omnisdingin

    omnisdingin

    Joined:
    Aug 13, 2015
    Posts:
    24
    I mean like how much could I pay someone 1. to take my script 2. revise it for an engine 3. make a script to connect the clients to the server and give the players control of characters with this script attached to it 4. revise my same script again to work with the multiplayer script
     
  25. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,499
    As @BoredMormon said, quoting rates is frowned upon in public here. Post in the Commercial board and I'm sure people will get back to you with offers.

    The amount you could pay depends on their rate and how many hours they estimate the work to be. If you have a limited budget, indicate that in the post so you're not wasting each other's time if they're out of your price range.
     
  26. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,156
    $0 if it's well documented / commented, but you should definitely get an NDA

    Is it a single script? Is it a short script? The price will vary greatly based on the details, so you can't get an estimate until you pass step 1 with whomever you find.

    $0, that entire description is achieved with the function 'StartClient()' called within your NetworkManager, which is a built in component. This is why I suggested looking at the multiplayer samples :p

    $0 to minimal, if there's some logic that applies to players only, move that inside if(isLocalPlayer). If it's movement related, use an RPC to sync the movement vars based on the locally set inputs and then leave that code outside of the isLocalPlayer check so it runs on every instance of the class. The most work to be done here is a few RPC and CMD functions to make sure things are synchronized on all of the clients. The effort is minimal, in fact today my day is dedicated to making a small singleplayer game and then converting it to multiplayer so it's something I can say I've done in the future. Something you considered charging for I'm doing for lulz on a saturday afternoon.

    A lot of it is trivial, I suggest the things I do so people won't get taken advantage of. I'm even more of a threat to this field than globalization :p
     
  27. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,499
    When a client speaks about a subject they don't understand as if it's simple, they almost always are far underestimating the actual amount of work to be done.

    In this case, while the OP is saying "I just want this script to work with multiplayer", I suspect what he actually means is "Build everything, too."
     
    Tomnnn likes this.
  28. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,156
    Yea maybe, but that is implied with step 2. If you're aware of step 4 then you're going to incorporate it into step 2... unless you're trying to bleed more money out of the guy. It's possible to get away with having 4 local games with RPCs trying to keep things in sync, but multiplayer games work out better if they're built with multiplayer in mind from the beginning.

    You know someone could totally not mention that and give @omnisdingin a price for 2 and 4 separately. My mechanic could have done the same. My car had trouble shifting gears and of course the go to reason for that is transmission problems. But he thoroughly checked the car and it turns out most of the problems came from it having 3 cylinders instead of 4 (don't know what that means but it sounds significant!). It would have been easy for any mechanic to tell me the issue was that, the transmission and several other things.
     
  29. omnisdingin

    omnisdingin

    Joined:
    Aug 13, 2015
    Posts:
    24
    http://pastebin.com/CiqVK9Z4

    Here's my script it does what I said it does... which is just make a character move and animate and shoot projectiles which if he is hit with he then loses health and dies and respawns.

    I want someone to make me a script which will make the players connect to the server and be given a character with this script attached to it.

    I think everyone understands where I'm coming from.
     
  30. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,852
    Easy there. Your $0 rate is impossible to undercut ;) Some people make a living off of those who don't have the time to invest in coding.

    So this script is already in JavaScript for Unity. This means is will work as is. The networking cost will vary. If someone already has a framework they can just plug in then it could be done in a couple if hours. Working from scratch you are looking at a days work, possibly longer in you want lobbies and the like.

    How much you get charged per hour really depends on who you go with. You can get pretty cheap coders out of India if you are willing to deal with the language barrier. Most if the English speaking world are more expensive. You will have to poke people and see.
     
  31. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,156
    People should definitely charge to finish the script and "revise it for an engine". I don't think I'd stay at $0 for something like that unless I was in a particularly evil and destructive mood.

    Globalization is scary.
     
  32. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,852
    Script is already written for unity, albeit in JavaScript. So you could call that one a $0 too. That said most devs would be reluctant to touch UNet with JavaScript, so it probably does need conversion. Depends what language the rest of the project is in.

    I would expect contracting out JavaScript would attract a premium. There are just less devs intimately familiar with the language.
     
  33. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,156
    Hah, haven't even seen that yet. I probably won't for a long time, if ever :D

    The importance of context of this conversation is unbelievably high. Can you imagine this being stated without people knowing it was a unity discussion?
     
    Last edited: Aug 16, 2015
    Kiwasi likes this.
  34. georetro

    georetro

    Joined:
    Jan 18, 2013
    Posts:
    218
    Dude I recommend listening to these guys and not to argue. 2d is a lot easier because your only dealing with two axis. Also multiplayer isn't simple if you don't know what your doing lol.

    I have collected quite a few tutorials (the thread is linked in my signature) that I have used, and others, and have found helpful. Although most of the list is geared towards 3D, I have some very basic tutorials that help when learning C#!
     
  35. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,156
    I'm running an experiment for 'multiplayer the hard way'. It could also be called the wrong way. I built a singleplayer game and now I'm trying to leave as much as I can as singleplayer and creating an empty input listener that is network enabled and controls a network dummy on other clients.
     
  36. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,499
    @Tomnnn I don't know how much would apply, but if you've never read the retrospective on X-Wing vs TIE Fighter, it's a must when you're rolling your own multiplayer solution. Granted, the Internet is a lot better today, but still a nice example of gotcha's that pop up.
     
  37. ostrich160

    ostrich160

    Joined:
    Feb 28, 2012
    Posts:
    679
    then do it
     
  38. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,156
    It's still using built in functions and markup like [Command] and [ClientRPC] but instead of having any of the players be NetworkBehaviors with NetworkIdentities, they're locally instantiated gameobjects. And the network manager contains a reference to everything on everyone's local machine. Then, when you connect to a server, I override the player spawn junk with my own NetworkServer.AddPlayerForConnection to give them control of the only thing in the project with a NetworkIdentity... an empty with a class that mirrors the input from the local client and sends it to one of the remote bodies on everyone else's local game.

    I'm going to clean up the example later tonight with 4 bodies and having local players be moved to their correct position where they appear on everyone else's screen. I also am aware that this setup will leave the body behind when a player disconnects. This is intentional so a botscript can take over when a player leaves. It's basically multiplayer pacman :D Maybe I'll post the project on this thread when it's done so people can see what horror truly looks like.
     
    Schneider21 likes this.
  39. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,156
    Hey all! Just making good on my promise. Here is my monstrosity, definitely wear protective eyewear before checking it out. This is a singleplayer game hacked into a multiplayer game. None of the players or network dummies have network identities, but they just kinda know when to move where.

    In order to start, you need to run 5 instances of this project. One is a server and 4 are clients. When you first start up, press 1 to start a server and press 2 to start the clients. When all 4 clients connect then you will see something. You can adjust whether it's 4 or 2 or whatever by looking very closely into my Game.cs network manager subclass.

    https://drive.google.com/file/d/0B9b5rsaXNB-KVXhxU0NobWRHVmc/view?usp=sharing

    local player is one color and network dummies are another, for dramatic effect. Use WASD to move.
     
    Last edited: Aug 18, 2015