Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  6. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  7. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  8. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

How diffcult it is to make an online startegy game?

Discussion in 'General Discussion' started by mehdi_barca10, Aug 10, 2018 at 4:20 PM.

  1. mehdi_barca10

    mehdi_barca10

    Joined:
    Jun 16, 2018
    Posts:
    21
    Hello,

    So I am an indie game developper, I can manage making the game, I already made some games, but I was thinking about making it Multiplayer, is it so difficult than offline games?

    The game is simple, when playing PvP it has basic movements like chess or Tower defense, nothing fancy, so no lag problems I think, however, I don't know if I need any advanced programming skill? I have just average coding experience (1 year of coding).

    Can you guys pleas tell me what will I need? any tips? (ps: I am not gonna be hosting the game, I will use just Amazon or Unity services fo that, if you know any better alternatives let me know)
     
  2. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    5,914
    It's much more difficult to make multiplayer games. You have to sync the game state somehow and do it with the minimum bandwidth usage as infrequently as possible without introducing gameplay issues.

    Chess and Tower Defense are wildly different in terms of multiplayer design so you'll need to be more specific.
     
    dogzerx2 likes this.
  3. mehdi_barca10

    mehdi_barca10

    Joined:
    Jun 16, 2018
    Posts:
    21
    Thank you,
    The game consists on attacking other player towers, you select your troops and select one of his towers to attack, the attack won't consist of too much animation just very little ones.

    The player will have a personal profile with a bunch of agents he can buy, but nothing complicated.
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    2,966
    If you take the amount of time you expect a single player version of that game to take to complete, multiply that by 3, you'll have a rough guesstimate of how much time the multiplayer version will take to complete.
     
  5. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    3,654
    If it's turn-based, it won't be too hard. If it's real-time, prepare yourself for a grueling battle . The hardest thing in real-time multiplayer is syncing two different clients (or a client and a server) that are separated by, e.g. 0.1 or 0.2 seconds of network transit time.

    For example, if the player hits a button, it would take lets say 0.1s for the action to get to the server, and 0.1s more to get to a fellow player. That's way too long for a fast-paced game. So depending on your game, you have to make all sorts of predictions of the future, controlled de-syncs and re-syncs, the ability to rewind the (entire) game state (particles, animations and all) if your prediction is wrong, and all sorts of other meddling into the fabric of space and time.

    And in case you get through all of that, you will likely hear crickets on your server a week after launch.
     
    Martin_H likes this.
  6. IgnisIncendio

    IgnisIncendio

    Joined:
    Aug 16, 2017
    Posts:
    62
    This, if you're a small indie studio/person I don't recommend making a multiplayer-only game. At the very least, put in bots (good enough so that one wouldn't get bored only playing with bots) so that the game wouldn't die instantly on launch.
     
    Billy4184 likes this.
  7. mehdi_barca10

    mehdi_barca10

    Joined:
    Jun 16, 2018
    Posts:
    21
    It's an RTS game, you move your units in the game, but not with turn, both players can move the units any time in the game, for example baloonTD on mobile, the 2 players play at the same time.
     
    Last edited: Aug 11, 2018 at 9:16 PM
  8. mehdi_barca10

    mehdi_barca10

    Joined:
    Jun 16, 2018
    Posts:
    21
    The game is a tactical one, I think the bots should be really smart with a lot of code lines for each level, you think it's still easier than multiplayer?
     
  9. mehdi_barca10

    mehdi_barca10

    Joined:
    Jun 16, 2018
    Posts:
    21
    Even if I make it a peer to peer? not client/server?
     
  10. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    11,791
    Choosing peer-to-peer over a client/server architecture won't necessarily make it easier. It'll just change the problems you will have to solve. One immediate example that comes to mind being how will you handle people who are behind a NAT.
     
  11. mehdi_barca10

    mehdi_barca10

    Joined:
    Jun 16, 2018
    Posts:
    21

    So for and indie with not large experience in Network, it's gonna be a waste of time to make a multiplayer?
     
    Martin_H likes this.
  12. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    11,791
    Only if by "waste of time" you mean "I don't have sufficient time to learn how to do it while making it".
     
  13. mehdi_barca10

    mehdi_barca10

    Joined:
    Jun 16, 2018
    Posts:
    21
    Nah actually I have time, I have one free month ahead (I can work on it more than 5/6hrs a day) + after I can manage to work on it 1h -2h per day,will that be suficient?
     
  14. mehdi_barca10

    mehdi_barca10

    Joined:
    Jun 16, 2018
    Posts:
    21
    If anyone knows the steps to make a multiplayer, can you please write them down? just the general steps and I will look more into them, just so I have a better prespective, I wanna know eveything I will need, will be really halpful
     
  15. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,056
    Lockstep might be the way to go. Maybe check that out?
     
  16. mehdi_barca10

    mehdi_barca10

    Joined:
    Jun 16, 2018
    Posts:
    21
    Is it less complicated?, I've seen that's its not used anymore, u ever worked with it?
     
  17. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    15,371
    Lockstep simply trades one set of network problems for a different set. It solves the problem of needing to send large amounts of data across the network. It solves the syncing issues. It largely solves issues with cheating.

    But at the same time it introduces its own issues. You will need to make your system entirely deterministic. Unity is not deterministic in the slightest. That means rewriting physics, random, frame handling, time and so on. Its not a job for the faint hearted.
     
  18. mehdi_barca10

    mehdi_barca10

    Joined:
    Jun 16, 2018
    Posts:
    21
    Allright, so what do you think is the best option for a unity RTS?
     
  19. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    2,966
    You should start by researching the available networking API's. Maybe try out a few of them. Unity has deprecated the built in Unet API, and has not released its replacement, so I'd recommend going with a 3rd party API or writing your own socket implementation at this time.

    Generally you're going to have to design your game with consideration for:
    * How you sync the game state between the players
    * How your game will tolerate various levels of network latency
    * What data should be sent reliably, and what data should be sent unreliably
    * What network architecture you're going for
    * How to limit the impact of cheaters
    * How you will implement match making
    * If a player hosted architecture, how you will allow a player to host the game behind their firewall or NAT router
    * How you store and authenticate any player accounts, if any
    * How you will store and update any player progression, if any

    Depending on how you want your game to work, there could be a lot more, or some of the above could be ignored, but that list should be a good start.

    I'd probably take a look at Photon first, since it is generally well regarded, handles some of the issues above on its own, and has a low CCU free tier you can use while your game is in development.
     
    Billy4184 and Ryiah like this.
  20. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    11,791
    You have two basic paths available. You can approach the problem in the manner outlined by @Joe-Censored where you research and learn how to build your own solution. Alternatively you can use an existing solution from the Asset Store.

    A quick search of the Asset Store turned up "RTS Engine". It's a complete framework for creating an RTS with support for multiplayer using Unity's current networking solution. It's received good reviews and has been updated within the past couple of weeks showing the developer is still actively supporting it.

    https://www.assetstore.unity3d.com/en/#!/content/79732

    Unity may have deprecated it but the community has continued developing it. It's had a number of bug fixes as well as improvements and some of the limitations (eg SyncVars) have been lessened.

    https://forum.unity.com/threads/unet-hlapi-community-edition.425437/
     
  21. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    2,966
    The community has continued developing the HLAPI, but the low level API it sits on top of is closed source and also deprecated. Though I saw recently that vis2k is now working on his own LLAPI.
     
    Ryiah likes this.
  22. mehdi_barca10

    mehdi_barca10

    Joined:
    Jun 16, 2018
    Posts:
    21
    Alright thank you very much, was really helpful, alot of information to look for, I'm starting rn :D
     
  23. mehdi_barca10

    mehdi_barca10

    Joined:
    Jun 16, 2018
    Posts:
    21
    Solution like what? Photon for example?



    Yeah I tried this asset, their multiplayer support may be enough?

    Thank you very much, really appreciate your help ^^
     
    Last edited: Aug 13, 2018 at 9:22 PM
  24. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    6,342
    Check out some of the Unity integrated multiplayer services they should have good turn-based examples you can extend to make the game you want.

    You could even base your choice on the multiplayer turn-based system with the best unity example.

    The thing is though if it's going to take more than a couple of months to make your game then you might want to hold out for the new networking system as this will probably be ECS based/integrated and therefore much more performant (reduced CPU load).
     
  25. mehdi_barca10

    mehdi_barca10

    Joined:
    Jun 16, 2018
    Posts:
    21

    alright thank you, after finishing the game, can I hire someone to do the netwroking thing? do people offer such a service?
     
  26. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    15,371
    Networking needs to be done first, or at least very early on. It tends to worm its way through every single line of code you write. Adding in networking after the game is done is hard.
     
    zombiegorilla, Joe-Censored and Arowx like this.
  27. mehdi_barca10

    mehdi_barca10

    Joined:
    Jun 16, 2018
    Posts:
    21
    Then I think maybe I should save my game till I fully understand the networking process, thanks you for your help ^^
     
  28. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    6,342
    I would say no to this approach, you are putting something off you want to do. Just jump into it, find the best turn-based Unity example you can find and try converting it to a minimal viable product of your game.

    Networking needs to be built into the game from the get-go as none networked games run against the Unity engine networked games need to run via the server/PvP network. It's another layer to everything you do in your game.

    The upsides of net based games are they allow your game to become more abstract e.g. 'command' based as opposed to action/API call and event-based.

    I had a play with networking and managed to make this game even though I was new to Unity...





    It's not very good as a game but it was fun to make a multiplayer game and it was not that hard, just a different way of developing a game.
     
  29. mehdi_barca10

    mehdi_barca10

    Joined:
    Jun 16, 2018
    Posts:
    21

    Thank you , that's what I needed to hear, that it's possible to make, I started looking into networking, I will to do my best ^^
     
  30. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    15,371
    You should also stop changing your mind every time someone makes a new forum post. :p
     
  31. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    2,415
    It depends on how well designed your core architecture is. Our game started out as a sand box single player game. Then the game H3VR came out and we changed track. Most of the core design around our firearms, items and interaction was already done.

    After two weeks of working on our netcode we had this little demo on reddit :p

     
  32. mehdi_barca10

    mehdi_barca10

    Joined:
    Jun 16, 2018
    Posts:
    21
    Yeah you are roght probably xD I just didn't know anything abt networking, but now, its dosen't seem that hard
     
  33. mehdi_barca10

    mehdi_barca10

    Joined:
    Jun 16, 2018
    Posts:
    21
    what do u mean by core architecture?
     
  34. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    2,966
    Uhhh ohh....

    ;)

    It refers to the backend design of all your game's core systems.
     
    AndersMalmgren likes this.
  35. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    15,371
    It means you need several years more experience before tackling online multiplayer.
     
    AndersMalmgren and Joe-Censored like this.
  36. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    3,654
    @mehdi_barca10 download Photon or something like that and play around with their example projects. If you can understand them and modify them for your own purposes, you'll have a good chance of making it. No one can tell you if you're going to be able to do it, you'll have to find out for yourself. And never, ever follow online advice when you can easily try and see.

    Here's my suggestion. Make a game where:
    • One player has 5 cubes that they can move around in the scene
    • The other player has 5 spheres they can move around in the scene.
    • Sync the cubes and spheres on both computers in real time as the players move them around.
    That should take only a day or two. When you have done that, you can come back with some specific questions that you might actually get a useful answer for.
     
    AndersMalmgren, Ryiah and Kiwasi like this.
  37. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    2,415
    Like the other guys have mentioned its the core game logic, often refereed to as the domain. If you create a modular domain with high cohesion and low coupling its much easier to extend your domain with new features, like multiplayer.

    This is a very common mistake by many devs, seniors and junios alike. Though seniors do it in a lesser fashion. Its called Technical debt and we all do contribute to it. Thats why its so important to constantly revisit your code and your teams code (for example through code reviews) and refactor code smells. If this is not done you will reach a point when even simple features are hard to implement.

    I did a tutorial for our game. In all honesty I do not think I changed a single line of code in the existing domain code, the tutorial could just jack into the domain code through the different components but also by using the event bus. It was this easy because we have a high test coverage, and testable code often also are easy to extend like this.

    Here is the tutorial if of any interest
     
  38. mehdi_barca10

    mehdi_barca10

    Joined:
    Jun 16, 2018
    Posts:
    21
    Allright thank you very much, I will look into that ^^