Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Tanks Multiplayer - complete networking project [UNET]

Discussion in 'Assets and Asset Store' started by Baroni, Jun 11, 2016.

?

Which networking solution would you like to use with this asset?

  1. Unity Networking

    99 vote(s)
    60.7%
  2. Photon Networking

    55 vote(s)
    33.7%
  3. Other

    9 vote(s)
    5.5%
  1. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    Interested? Ask us anything in this thread - from developer to developer :)
    Looking for support?
    Please use our dedicated support forum, where we share member-only content such as beta versions, pre-bugfixes, in-depth guides or custom code extensions, requested by other customers.

    Tanks Multiplayer
    is an action packed multiplayer template using Unity Networking (UNET) or Photon Unity Networking (PUN) - your choice! On the default settings, it allows up to 12 players in 2 or 4 different teams, per room, to compete for the highest score in a Capture The Flag or classic Team Deathmatch mode. It features player model selection, shooting, powerups, player death & respawn, networked object pooling, several Unity services and more. With this template, we are laying the ground for a successful multiplayer game, by demonstrating common network tasks such as fully authoritative server actions, commands & RPCs, synced variables / object states and host migration, but also monetizing players using in-app purchases and video ads to keep your servers running. We’ve included an in-depth documentation about all approaches we took while building this and commented each and every method, so you can follow along easily.

    Features:
    • Online Matchmaking & Host Migration integration
    • Game Modes: Capture The Flag & Team Deathmatch
    • Supports Local Area Network (LAN) game discovery & auto join
    • Supports Offline mode vs. AI bots, using pathfinding for movement
    • Authoritative Auto Team Balance: across red, blue, yellow, green team
    • Synchronized Player Properties: name, model, team, health, shield, ammo
    • Synchronized Player Input: driving, turret rotation, shooting
    • Authoritative Player Actions: death, respawn, game score calculation
    • Respawn Delay: "killcam" following the killer or displaying video ad
    • Networked Object Pooling: synced client pools for bullets & powerups
    • Extendable Powerups: health, shield, double damage, bouncing bullet
    • Reusable Manager Scripts: audio, pools, Unity IAP, Everyplay, Unity Ads
    • In-App Purchases: buying different tank models (visual or game impact)
    • Unity UI: menus, team fill display, team scores, mobile joysticks
    • Input for Mobile (touch) & Standalone (keyboard + mouse)
    • Documentation: scripting reference & step by step guide
    (Optional) Use of Unity Services:
    • Unity Multiplayer
    • Unity Ads
    • Unity IAP
    Docs:
    Get it here:
    Try it here:




     
    Last edited: May 1, 2019
  2. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    Good news! This asset is now in the final stages of testing.
    • Documentation has been finished (17 pages including screenshots)
    • Scripting Reference is online (updated first post with a link)
    The preparations for supporting Photon multiplayer in a later update are done too, but it will go live with Unity Networking (UNET) support for now. Still time for you to submit your vote in the poll above!
     
  3. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    This asset is now pending review by the Unity Asset Store team.
     
  4. geekchau

    geekchau

    Joined:
    Jun 13, 2013
    Posts:
    16
    I'm interested and will be keeping an eye out.
     
    Baroni likes this.
  5. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    Tanks Multiplayer has been released!

    Watch our trailer video for an in-game overview of all features (see first post).
     
  6. Acid-NN-9

    Acid-NN-9

    Joined:
    Apr 29, 2015
    Posts:
    10
    Looks good. It is very possible that I buy the asset because it is practically a complete project and hope that the documentation is thorough and complete
     
  7. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    Thanks @Acid-NN-9! It is - happy for any feedback you might share. Documentation has 17 pages (written including screenshots, not just variable explanations or something like that).
     
  8. IsaiahKelly

    IsaiahKelly

    Joined:
    Nov 11, 2012
    Posts:
    333
    Interesting asset, but I would really need to read through the documentation before deciding if it's something I really want. I can't find any documentation online, and that's something you really should provide to potential buyers and customers alike.
     
  9. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    Hi @IsaiahKelly, the documentation is a core asset of our product and reveals many network and authoritative approaches we took while building this complete project. We won't reveal it in the process before purchasing this asset. Our scripting reference is available publicly, but not the full documentation.
     
  10. IsaiahKelly

    IsaiahKelly

    Joined:
    Nov 11, 2012
    Posts:
    333
    I thought that's what the documentation covered, as well as how to initially set it up, etc. So is this 'documentation' you speak of more like a tutorial? How much setup is actually required to get your package up and running then? It's just hard to get a good idea of what the asset does without reading detailed documents or watching videos about how it's actually used.
     
  11. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    This asset is a complete project. The documentation explains what every component does in detail and how it fits into the final user experience.

    That's basically enabling Unity Networking in the editor services tab (or importing Photon Networking at a later point).

    The video I've uploaded shows what it does after enabling all of the integrated Unity services (which is optional).
     
  12. robert301990

    robert301990

    Joined:
    Jul 1, 2014
    Posts:
    30
    When do you think that the Photon will be added?
     
  13. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    I'm working on this now, but including all the testing and documenting it could still take 2 months from now.
     
  14. robert301990

    robert301990

    Joined:
    Jul 1, 2014
    Posts:
    30
    I might buy it until then, but sounds great.
     
  15. darynduff

    darynduff

    Joined:
    Jul 27, 2016
    Posts:
    2
  16. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    @darynduff you can change and replace everything, as always. If you want to have the turret rotated to the direction you are aiming, then it has to be a separate game object on the model (usually that's the case with tank models).
     
  17. houzy

    houzy

    Joined:
    Oct 24, 2015
    Posts:
    8
    Hi, when I import the package, I got errors:
    Assets/TanksMultiplayer/Scripts/IAPProduct.cs(9,19): error CS0234: The type or namespace name `Purchasing' does not exist in the namespace `UnityEngine'. Are you missing an assembly reference?
    Assets/TanksMultiplayer/Scripts/UnityIAPManager.cs(9,19): error CS0234: The type or namespace name `Purchasing' does not exist in the namespace `UnityEngine'. Are you missing an assembly reference?
    Assets/TanksMultiplayer/Scripts/UnityIAPManager.cs(19,51): error CS0246: The type or namespace name `IStoreListener' could not be found. Are you missing a using directive or an assembly reference?

    I am using Unity 5.4.0 on Mac.
     
  18. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    Hi @houzy, please have a look at #2 in our FAQ and see if that helps.
     
  19. houzy

    houzy

    Joined:
    Oct 24, 2015
    Posts:
    8
    Yes, It is helpful. Thanks.
     
  20. doojin

    doojin

    Joined:
    Sep 5, 2016
    Posts:
    2
    The play button not working.
     
  21. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    Please read the instructions. You need to enable Unity Networking and import our UNET package.
     
  22. doojin

    doojin

    Joined:
    Sep 5, 2016
    Posts:
    2
    using UnityEngine;
    using UnityEngine.UI;

    namespace TanksMP
    {
    /// <summary>
    /// PLACEHOLDER IMPLEMENTATION. RUN THE NETWORK SETUP!
    /// </summary>
    public class UIMain : MonoBehaviour
    {
    public GameObject loadingWindow;
    public GameObject connectionErrorWindow;
    public GameObject billingErrorWindow;
    public Button everyplayButton;
    public InputField nameField;
    public Toggle musicToggle;
    public Slider volumeSlider;
    public Toggle recordToggle;

    public void Play() {} ====> This code is correct?
    public void OpenShop() {}
    public void OpenSettings() {}
    public void OnMusicChanged(bool value) {}
    public void OnVolumeChanged(float value) {}
    public void CloseSettings() {}
    public void OnEveryplaySupport(bool supported) {}
    public void ShowEveryplay() {}
    public void RateApp() {}
    }
    }

    public void Play() {} ====> This code is correct?
    What is the full code ?
     
  23. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    @doojin as I said, read the README.
     
  24. cptkakashi

    cptkakashi

    Joined:
    Sep 8, 2016
    Posts:
    1
    This is a great asset, I had problems at first, because unity wasn't showing me the network setup option, but I just restarted unity and that's it, I could run the network setup, I followed the instructions step by step and that's it!
     
  25. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    Thank you @cptkakashi! Maybe there was an error in your project that did not get compiled until after restarting Unity. Would you please leave a rating/review on our Asset Store page, it would mean a lot :)

    If you experience any other issues or have questions, please follow up here. Thanks again.
     
  26. Odain

    Odain

    Joined:
    Sep 11, 2016
    Posts:
    3
    Hi, i purchased the asset but i was just wondering if it is possible to add AI opponents if there aren't enough people in a room? and also adding drops from destroyed opponents?
     
  27. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    Hi @Odain, thank you for your purchase. Actually I have implemented AI opponents already to provide something like an "offline single player" thing. I need to polish it a bit so it is easier to get going, but if you send me your invoice # via email I could send it over.

    By "drops from destroyed opponents", do you mean killing players would spawn powerups such as health? If that's the case, then the TakeDamage method in the Player script, which is only executed by the server, would be a good fit to call NetworkServer.Spawn with the powerup/object to spawn.
     
  28. Warsoul

    Warsoul

    Joined:
    Sep 9, 2016
    Posts:
    35
    I can't figure how to make these tanks jump or climb some slopes. I switched to Vector3 but it wont work at all. My wheels Colliders Doesn't look to work either.
     
  29. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    @Warsoul the Rigidbody on tank prefabs is locked to the x-z axis, so you would need to uncheck y axis there. Also the movement on the Player script is only applied to those axes. Having the tank move up to slopes could require a modification of the Update/Move methods in the Player script.
     
  30. tonyBkln

    tonyBkln

    Joined:
    Jul 9, 2015
    Posts:
    5
    Hi, I am very interested in your asset. Is it all Unet-based framework or are you using HLAPI features? Does it allow complete networking setup and operation via C# scripts? Or is there a fair amount of network behavior that is wired via Unity editor, as in Unity own Tanks multiplayer? Thanks!
     
  31. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    Hi @tonyBkln, this asset is built on top of Unity UNET (with Photon coming at a later release) and uses the HLAPI only, with overrides of exposed UNET methods for customization, i.e. letting the server assign players teams when a new client joins. Network settings such as teams and spawn positions can be further customized in the editor without touching code.

    Not sure if this answers your second and third question about C# scripts and "wired via Unity editor", could you please elaborate?
     
  32. tonyBkln

    tonyBkln

    Joined:
    Jul 9, 2015
    Posts:
    5
    Hi, I played with Unity Tanks multiplayer some time back, so my memory is rusty. I remember they did a quite a bit of network logic by wiring it in the editor, but I cannot locate the tutorial now, and, thankfully, a lot of Unity network documentation online has been updated and improved since then.

    From what I see, the HLAPI spec heavily relies on the tags [like Command], [ClientRpc] and the like, in attempt to simplify the development and have the same application running as client and the server, etc. I wonder if this is the same approach you've taken with your game? And if so, what is the basic advantage of your project over theirs? Thanks!
     
  33. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    @tonyBkln thanks for clarifying. I am going the same HLAPI route with Commands, ClientRpc, and Server attributes in this project.

    Well, basically the full feature summary I've posted in the first thread is a list of things that stand out in our project, especially auto matchmaking and networked pools. There is a lot more going on with host migration, synced power up timers, selectable players (cross platform input) and different bullets, also team assignments. Also we've posted this in the tutorial section because the extensive documentation explains all approaches we took so you can easily learn from and extend it on your own.
     
  34. Kevin1990

    Kevin1990

    Joined:
    Sep 3, 2015
    Posts:
    2
    I have a quick question before i buy is it possible to add a lobby system and leveling system where player get set amount of exp per match which in turn increase there level which could unlock new tanks or what ever from the lobby. And a login system to save the information levels unlocked items and player names
     
  35. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    Not sure how I would be able to answer that without knowing your coding skills :) Meaning everything is possible depending on your expertise. The asset does not provide this out of the box so it is in your hand to extend it. You are purchasing full source code and documentation so you should be able to figure out the best starting point for these things - or just ask me!
     
  36. Kevin1990

    Kevin1990

    Joined:
    Sep 3, 2015
    Posts:
    2
    My coding skills are pretty good but not everyone has the same styles juat wanted to make sure it was possible.
     
  37. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    I think you will find the code easy to work with. It is placed in the tutorial section, after all. You can also have a look through our scripting reference beforehand.
     
  38. Warsoul

    Warsoul

    Joined:
    Sep 9, 2016
    Posts:
    35
    Okay, i figured how to move in 3d space.
    But i have 2 issues :
    1- My turret is locked on a 2d plane and i can't shot upward or downward. My turret model is locked on Y. (I have to recode the player script but i'm unsure how to use an 2d plane to aim in 3d and how to clamp my turret in a way to prevent them to clip into mu hull)
    2- My player can't collide into each other over the network.

    Can you help me ?
     
  39. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    @Warsoul
    1. You could try raycasting from the mouse position onto colliders in the scene and let the tank shoot on that position/direction. I haven't approached 3d aiming for this asset, and the turret is specifically synced on the Y axis only, so how you would want to implement this is up to you. It gets even more complicated when doing this for touch controls...
    2. By design. Open the physics matrix under Edit > Project Settings > Physics and enable Player <> Player collisions.
     
  40. Warsoul

    Warsoul

    Joined:
    Sep 9, 2016
    Posts:
    35
    I think this asset need fews things to be an better complete project;

    1- Lobby System
    2- Ip hosting alternative solution from matchmaking
    3- ESC menu to restart, pause or Quit the game
    4- Minimap
    5- Player customisation (Unit,Gears and perks)

    I tried to implement this minimap; https://www.assetstore.unity3d.com/en/#!/content/33729
    But i can't figure out how to set the player.transform for each players.
    I tried many way with no success.
     
  41. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    Thanks for the feedback @Warsoul.

    Please note that while feature requests are being considered as always, this asset is specifically meant as a template or tutorial that you can extend by yourself, so not all features will get implemented for the sake of not extending this asset to death. "Complete project" is an irritating term here, it is a complete, working multiplayer project but was never designed to include all possible features in the universe. Instead, I would be more than happy to explain the concepts of how to implement a specific feature or add a short section in the documentation about it.

    A lobby system is counter-productive to the way the gameplay is designed. The intention was to press play, directly get into the battle on go on from there. Implementing a lobby system would mean interrupting this flow with a waiting time before players can play against each other.

    Playing over LAN is something I am looking into, but there is also the difficulty of getting LAN discovery working to not require entering an IP address.

    There is no progress you could achieve or lose during a game, thus a restart button would imply players leave and reconnect (maybe even the same match) all the time. A pause button is not something that works over the network in a fast-paced battle game. Again, interrupting the game was not the intention in the matchmaking workflow - besides having a pause button for the local player would not have any effect. The quit button is already in place, at the end of a match. You can easily duplicate that button and place it somewhere in your UI all the time, if that's a desired feature for your app.

    Due to the nature of being cross-platform, a minimap has not been considered because of screen space issues on mobile devices. There simply isn't enough space to place a minimap, with the joysticks being on the left and right corner on mobile devices already. If your app doesn't have this limitation (maybe it's desktops only?) then feel free to go ahead. Also while there are many free minimap assets out there, we are not allowed to redistribute them in our asset on the Asset Store, meaning we would have to create a minimap system from scratch.

    You can modify the player prefabs as you wish, like I did with the different player models that can be purchased. These player prefabs can also have different properties (health, movement speed, shot delay, etc.) and even different bullets. A perk/ranking system is explicitly something I didn't want to develop, because it highly depends on your needs - not everyone wants to have it in the way you do, making it impossible for me to implement a one-fits-them-all solution (which is not the goal of this asset anyway).

    I might create a guide on our forums on how to implement (4) and (5) so these things stay completely optional and out of the standard asset.

    I'm not familiar with that asset, but you could access the NetworkServer.connections variable and look up the client owned objects i.e. player prefabs. Or get all Player script components in the scene and access their transform.
     
  42. Warsoul

    Warsoul

    Joined:
    Sep 9, 2016
    Posts:
    35
    Sorry if i was irritate you; it was not my intentions. I think many of your customers will buy your template has a base for multiplayer project. I know the main template is focusing on mobile platform but i think many of us will be happy to see an lobby system has an option. Adding an plus value to your template. I understand you can't work on this until death. But i think it will be more attractive with theses features implemented for who want to turn you template into an Desktop Multiplayer Game. I apologize again if i insulted you. I really apreciate your template has i seeked for one like this for month on the asset store. I will made an short video soon to demonstrate what you can accomplish with your template to help yours sales. Great jobs.
     
  43. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    @Warsoul no no no! You didn't insult me at all! With "extending this asset to death" I just meant that I am not going to integrate all requested features in it, to not bloat it up with complex stuff that basically lies in the hands of the project owners.

    In the not too distant future this could be one of the guides on my forums then ;) Did you see that Unity has a tutorial project covering that on the Asset Store?

    Much appreciated! But please keep in mind to not show any original code snippets as that's what we are selling :)
     
  44. Warsoul

    Warsoul

    Joined:
    Sep 9, 2016
    Posts:
    35
    There is an short example
     
    pixelsteam likes this.
  45. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    This looks like you have heavily modified the Player script :)
     
  46. Warsoul

    Warsoul

    Joined:
    Sep 9, 2016
    Posts:
    35
    Now i need to figure out how to modify your 2d turret into 3d with clamps and raycasting. Made an lobby and adding a minimap working in network to complete the loop to made an complete arena game. Maybe an Star Control like campaign.

    I will made an better video when my turret are fixed and when i found enough aplha tester to fill an room.

    Where i can change the music ?
     
    Last edited: Sep 16, 2016
  47. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
    Thanks for posting your development. I am wanting solve similar issues.
     
  48. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,277
    On the AudioManager. See 4.2 in the documentation for a detailed explanation of this component.
     
  49. Ionnes

    Ionnes

    Joined:
    Apr 3, 2016
    Posts:
    1
    I've been really enjoying playing around with this. The main things I've changed is zooming the camera out a bit because play testing people with it they said bottom up had too much of an advantage.

    I've also messed about with creating my own power ups a lot, like speed increase for x seconds, grow for x seconds etc. Has anyone else created any cool power ups?
     
  50. Devision4

    Devision4

    Joined:
    Jan 12, 2013
    Posts:
    1,312
    a few pre-purchase questions: Can 2 ppl start match or does it need specific minimum player? Does it contain AI enemies? are you plan to add new feature?