Search Unity

  1. Going to #UniteBerlin? Bring a buddy & get 25% off the 2nd ticket! More info here.
    Dismiss Notice
  2. Famed game designer and creator of The Sims, SimCIty, and Spore is looking for a 3D artist to join their team. Join the challenge.
    Dismiss Notice
  3. Unity 2017.4 has arrived! Read about it here.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. 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
  6. We've opened a new World Building sub-forum to faciltate all your world building discussions! Drop in and ask any ProBuilder, ProGrids, or PolyBrush questions.
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Tanks!!! Reference Project, for Unity Multiplayer Q&A

Discussion in 'Community Learning & Teaching' started by richard-lee, Feb 17, 2017.

  1. AlecLarsen1989

    AlecLarsen1989

    Joined:
    Feb 7, 2017
    Posts:
    18
    Hi LLRx

    As mentioned previously, Tanks!!! was not built with localisation in mind. But let me help you with the last batches of translations :). For shooting range UI and Settings UI, edit the following prefabs under UI:
    * ShootingRangeModal
    * ShootingRangeStartGameModal
    * Settings

    For the buttons in the ServerList and Lobby this text is changed in code. The easiest way to change this is to search the entire solution for the string literals and change them. I hope this helps :)
     
  2. AlecLarsen1989

    AlecLarsen1989

    Joined:
    Feb 7, 2017
    Posts:
    18
    Hi fnaveedshah

    I tested out the method I sent you and I am not seeing that issue. If you could send me the full editor log (console) then I'd be happy to look at it for you :)
     
  3. AlecLarsen1989

    AlecLarsen1989

    Joined:
    Feb 7, 2017
    Posts:
    18
    Hi iTzRixerGG

    Please refer to my response to @fnaveedshah where I describe this process :).
     
  4. AlecLarsen1989

    AlecLarsen1989

    Joined:
    Feb 7, 2017
    Posts:
    18
    Hi alexdion

    We have solved this issue in the Tanks!!! project, given in the first post on this forum :). The above code looks like an excerpt from the old Tanks networking project. The delay you are seeing is network delay (ping). It's basically there because the server is creating the projectile and causing the client to do the same. Check out our solution in the new Tanks!!! project :)
     
  5. miterrooter

    miterrooter

    Joined:
    Oct 4, 2016
    Posts:
    3
    Sorry about bumping my own post up I just wanted to add these tags for @richard-lee & @AlecLarsen1989 . I am not too familiar to posting in the forums so im not sure if this is necessary. I think my question is best targeted at you two so if you could find the time to explain how to get to a solution(or if im going in the entirely wrong direction) I would greatly appreciate the help. Alternatively the document mentioned in previous posts seems like it would be a great guide.
     
  6. richard-lee

    richard-lee

    Unity Technologies

    Joined:
    Jul 14, 2015
    Posts:
    49
    My mistake all. The package will be updated with the document. For now, it is attached to this post.
     

    Attached Files:

  7. miterrooter

    miterrooter

    Joined:
    Oct 4, 2016
    Posts:
    3
    Thanks @richard-lee the document is a good introduction of how the code is structured. It helps before going to reverse engineer the code. I have still run into difficulty if anyone can help. I have decided to try to add a local host feature for testing reasons. What I am trying is to add a button to the create game panel and from that button create a local host lobby. This has only worked so far as to create a lobby entry for the player but the ready button is not enabled. I would just like to know am i going about this the right way and if there are any tips to solve this.
     
  8. eDorosh

    eDorosh

    Joined:
    Aug 20, 2016
    Posts:
    1
    Hi. I'm developing my own project with UNet (4 person multiplayer) and have one very nasty issue with collapsing app on host (on mobile). I downloaded "Tanks!!!" to learn it, and found thing that :
    - If I get and run build that downloaded from AppStore, play it, and the host collapse his app -> it (host) has at least 2-3 seconds to maximize app and save current match without "server disconnected";
    - however If I create my own build of Tanks!!! (I change nothing, only make build), run it on mobile and host is collapsing -> other participants get "server disconnected" immediately!
    Why?
     
  9. richard-lee

    richard-lee

    Unity Technologies

    Joined:
    Jul 14, 2015
    Posts:
    49
    eDorosh. Couple of scenarios come to mind.

    - Difference in version. The version on the app store was built on, if I recall correctly, 5.4.
    - Didn't setup Multiplayer. You said you didn't make any changes to the app. At minimum, if you're taking the project and build locally, so you setup your Multiplayer settings. This is in the documentation (Section 2.1)
     
  10. fnaveedshah

    fnaveedshah

    Joined:
    Dec 15, 2013
    Posts:
    6
    Sir ty for looking at this problem, i hope you are fine
    sir i tried to put new tanks as you mentioned , but these tanks cant be purchased in shop,
    lot of people have same problem , so if you kindly make a tutorial for simply add new tank that can be purchase-able in shop
    Iam working on this project from months and i stuck here i hope you can help me
     
  11. Luke-Lamothe

    Luke-Lamothe

    Joined:
    Feb 6, 2013
    Posts:
    2
    @fnaveedshah, @AlecLarsen1989 responded to you previously above and said that if you are able to send him your full console log, he may be able to help you track down what is breaking on your side, so if possible, you should probably take him up on his offer :)
     
  12. fnaveedshah

    fnaveedshah

    Joined:
    Dec 15, 2013
    Posts:
    6
    @
    Luke-Lamothe actually i give up , worst support experience in unity , moving to unreal engine
     
  13. theferfactor

    theferfactor

    Joined:
    Dec 16, 2016
    Posts:
    1
    Thank you very much for this reference project, it's really amazing.
    I have just one question
    How can I make a local LAN multiplayer out of this?
     
    frank28 likes this.
  14. sajjad2016

    sajjad2016

    Joined:
    Jul 6, 2017
    Posts:
    1
    Hi.I recently imported Tanks reference project from asset store to a new project without any changing or deleting or adding anything.when i want to build it for android,it shows me this error:unable to convert classes into Dex format! I Know that i must delete duplicate files but i still cant build it!!!!! Ok,If my project and their project is the same,so how they published it for android in google play?
     
  15. Tomahawkppc

    Tomahawkppc

    Joined:
    Jul 31, 2012
    Posts:
    8
    Hi, has anyone tried to integrate a password for a private lobby? Cheers!
     
  16. wioluskaelk

    wioluskaelk

    Joined:
    Aug 22, 2015
    Posts:
    13
  17. orkungo

    orkungo

    Joined:
    May 3, 2014
    Posts:
    60
    Hi,

    I am trying to bundle the scenes to the AssetBundles, download them to the Application.persistentDataPath and load relevant scene at the Network Manager.

    Network Manager loads the game scene by ServerChangeScene(map.name);

    However, I need one previous step to load scene from asset bundle and progress to the scene, something like following:

    string scenePath = myLoadedAssetBundle.GetAllScenePaths()[0];
    SceneManager.LoadScene(scenePath);

    When I follow above steps with AssetBundles and use them at the NetworkManager, since I do not load my scene using ServerChangeScene method, I can not follow next steps of Networking and can not load the CompleteTank.

    Any ideas to help?
     
    Last edited: Oct 20, 2017
  18. JohnyDaison

    JohnyDaison

    Joined:
    Jul 27, 2017
    Posts:
    1
    Hi,
    I imported this project into Unity 2017.2.0f3 and everything works, but the tanks have shorter firing range. I checked the Physics settings and everything seems to be set up according to the PDF. Everything else seems ok, comparing with the youtube video, but the projectiles just don't fly as far as they should. I didn't make any changes except multiplayer setup before building the game. Anyone has any idea how is this possible?
     
    csivek likes this.
  19. GoRiLLa

    GoRiLLa

    Joined:
    Oct 8, 2013
    Posts:
    14
    I have the same issue, making it impossible to complete first Training mission.

    Even worse, I am not able to create any multiplayer games as it immediately fails upon creating game.
     
  20. FrancoFresco

    FrancoFresco

    Joined:
    Aug 1, 2012
    Posts:
    2
    Thanks for this reference project! it's actually a lot of fun! Shooting works fine for me (playing in the editor, 2017.2)

    Like GoRiLLa, I too am experiencing failing at creating a game.

    In editor
    - open splashScreen scene
    - click through then click Create Game
    - Give a server name and hit start
    - See prompt, "Failed to create game"

    Checked log and I'm not seeing any error messages.

    I did have to update the APIs to complete the import from the Asset store.
    I'm thinking has to do with this. I'm very new to UNet, so not exactly sure where to look to fix it.

    I'd love to learn from this.

    Thank you!
     
  21. FrancoFresco

    FrancoFresco

    Joined:
    Aug 1, 2012
    Posts:
    2
    In CreateGame.cs

    private void StartMatchmakingGame()
    {
    m_NetManager.StartMatchmakingGame(GetGameName(), (success, matchInfo) =>
    { ... });
    }

    It's definitely failing here.

    Where is "matchInfo" declared? I'm not even sure how this compiles..

    Thanks!
     
  22. IsaiahKelly

    IsaiahKelly

    Joined:
    Nov 11, 2012
    Posts:
    221
    @JohnyDaison @GoRiLLa @FrancoFresco

    Failed to Create Game
    If you're getting "Failed To Create Game" whenever you try to start a multiplayer match it's most likely because you haven't setup the Unity multiplayer service correctly or at all. Please read the "TanksReference" PDF file included in the root of the project for information on how to do this.

    Projectile Firing Issue
    Fired shells are supposed to land wherever you click/tap on the screen, but this is no longer the case in Unity 2017.2. After checking out what's new I noticed that they added a new physics related feature:
    I immediately suspected that this was the cause of the issue, however, messing with these new settings seemed to have no effect, so I scoured the source code and finally found the culprit in Shell.cs, line 135:

    Code (CSharp):
    1. // Face towards our movement direction
    2. private void Update()
    3. {
    4.     m_Transform.forward = m_CachedRigidBody.velocity;
    5.  
    6.    // Spin the projectile
    7.    m_CurrentSpinRot += m_Spin * Time.deltaTime * m_CachedRigidBody.velocity.magnitude;
    8.     m_Transform.Rotate(Vector3.forward, m_CurrentSpinRot, Space.Self);
    9.  
    10.    // Enforce minimum y, in case we go out of bounds
    11.    if (m_Transform.position.y <= m_MinY)
    12.    {
    13.        Destroy(gameObject);
    14.    }
    15.    else
    16.    {
    17.        // Reset this. We can set it to true during bounces to stop multiple colliders hitting it per frame
    18.        m_Exploded = false;
    19.    }
    20. }
    You simply need to move this snippet of code from Update() to FixedUpdate() and projectiles will land in the intended location once again. Hooray!

    Apparently this new physics feature has an adverse effect on any modifications made to the transform outside of FixedUpdate.

    Happy coding!

    @richard-lee @AlecLarsen1989 this projectile bug should really get an official patch ASAP because as GoRiLLa has pointed out already, it makes completing the first training mission nearly impossible and I'm sure this will cause a lot of support requests and confusion if not addressed soon.
     
    Last edited: Dec 12, 2017
    ibyte and Le_Tai like this.
  23. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    837
  24. cj31387

    cj31387

    Joined:
    May 23, 2012
    Posts:
    128
    Is this project fully authoritative ?
     
  25. Ghost004

    Ghost004

    Joined:
    Jan 27, 2016
    Posts:
    3
    Hello, I'm trying to add a tank (followed the post above and added tank to library)is there something else I need to do?

    Unity version 2017.3.1f1
    fresh project and tanks import

    getting index out of range error when I try and purchase.
    upload_2018-3-21_20-18-37.png
     
    Last edited: Mar 28, 2018