Search Unity

Tanks Multiplayer - complete networking project (Netcode, Photon)

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

    136 vote(s)
    51.5%
  2. Photon Networking

    98 vote(s)
    37.1%
  3. Other

    30 vote(s)
    11.4%
  1. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Hi @davinder_unity, thanks for posting here.

    Could you please let me know how to reproduce the issue by stating your Unity version, Tanks Multiplayer version and what network provider you are using (MLAPI/Photon/Mirror)? Is this is a newly created project with Tanks Multiplayer imported, or did you do any modifications to it? Do you know what the tank prefab (one of the three player prefabs or a bot prefab) the issue is coming from?
     
  2. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    The WebGL player is running on the Photon Cloud. Currently the master client does validations for the shooting, respawning and showing ads (if enabled). Real dedicated server builds are planned for the first half of next year, with stable Photon Fusion and Netcode (MLAPI) versions supporting it. See this post for more information.
     
  3. numberonegames

    numberonegames

    Joined:
    Apr 16, 2020
    Posts:
    4
    Hi, I bought the asset a few days ago and I'm having trouble starting a connection with Mirror. When I click play button, I get connection failed error. Could you help me?
     
  4. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Hi @numberonegames, could you please post your Unity version, Mirror version and the exact error message? Just to make sure, you ran through the network setup of documentation chapter 1?
     
  5. numberonegames

    numberonegames

    Joined:
    Apr 16, 2020
    Posts:
    4
    Unity version 2020.3.4f1
    MIrror version: 53.0.0
    Yes, I ran through the network setup
     

    Attached Files:

  6. numberonegames

    numberonegames

    Joined:
    Apr 16, 2020
    Posts:
    4
  7. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    It is common to wait a day for a response, before posting again ;)

    Thanks for the information and screenshot. I tested Mirror 42.x and it is working fine there, but I can see the same behavior with Mirror 53.0.0. Please add the following fix starting in line 75 of the NetworkManagerCustom.cs script:

    Code (CSharp):
    1. if (!conn.isAuthenticated)
    2. {
    3.    Debug.Log("Timeout: Mirror did not find any matches on the Master Client we are connecting to. Eventually creating our own room...");
    4.    singleton.StopClient(); // <--- necessary with Mirror 53.0.0
    5. }
    I'll keep that in for the next update.
     
  8. numberonegames

    numberonegames

    Joined:
    Apr 16, 2020
    Posts:
    4
    I made this change and it's working. Thanks!
     
  9. giftgamebr

    giftgamebr

    Joined:
    Dec 8, 2021
    Posts:
    11
    When I import these assets this error appears, is this normal?
    upload_2021-12-10_13-50-28.png

    I'm creating an empty 3d project in unity and importing the assets, did I do something wrong?
     

    Attached Files:

  10. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Hi @giftgamebr, these are warnings (yellow), not errors (red). You can clear them and they will not show up anymore. These are just some optimization hints for the tank models and can be ignored. Also, please revise your review on the Asset Store page, as the review section is not for support requests (also shown in a message box before you posted there). Thank you!
     
  11. giftgamebr

    giftgamebr

    Joined:
    Dec 8, 2021
    Posts:
    11


    I'm having trouble changing the tank, do you know what might be going on?
     
  12. giftgamebr

    giftgamebr

    Joined:
    Dec 8, 2021
    Posts:
    11
    [QUOTE = "Baroni, postagem: 7725567, membro: 23495"] Olá, [USER = 8697664] @giftgamebr [/ USER], são avisos (amarelo), não erros (vermelho). Você pode eliminá-los e eles não aparecerão mais. Estas são apenas algumas dicas de otimização para os modelos de tanques e podem ser ignoradas. Além disso, revise sua análise na página Asset Store, pois a seção de análise não é para solicitações de suporte (também mostrado em uma caixa de mensagem antes de você postar lá). Obrigado! [/ QUOTE]
    Done
     
  13. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    It looks like the initial rotation of your tank model and turret is not zero, or rotated in the expected direction. You can compare your turret with the turret rotation on the sample tanks, if you drag both of them next to each other. On the player script, the highest parent turret transform should be assigned.
     
  14. giftgamebr

    giftgamebr

    Joined:
    Dec 8, 2021
    Posts:
    11
    How can I change the game map? I tried but I was unsuccessful...
     
  15. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    What exactly do you mean: changing the selected scene for a game mode, or changing an existing scene and objects in there? The first is described in the documentation PDF included in the asset. The latter does not require any specific knowledge about the asset, just general Unity experience (colliders, prefabs, navmesh). What have you tried?
     
  16. giftgamebr

    giftgamebr

    Joined:
    Dec 8, 2021
    Posts:
    11
    upload_2021-12-13_20-25-48.png

    I'm having this error. How do I solve it? I am also not managing to remove the blue obstacles from the map.
    I would also like to know how I can change the camera...
     
  17. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Unfortunately there is not enough information to help you on this. This does not happen in the default project, so you might have modified or changed something, but did not mention what. Also, opening the log displays the exact error line number which would be helpful.

    They are just game objects? If you mean you cannot navigate to where they have been before, check their colliders and rebake the navmesh.

    The camera has a separate script attached for a 3rd person view. You can change some values in the inspector to make the perspective go higher or more flat. Note that the shooting mechanic is calculated in a 2D view on the screen, so changing it to e.g. a first person perspective is not that trivial.
     
  18. LegoStarYT

    LegoStarYT

    Joined:
    Jan 13, 2022
    Posts:
    11
    when i try building/exporting it says System.unauthorizedAccessException: Access to the path 'The Folder' is denied
     
  19. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    @LegoStarYT that's not an issue with the asset but your operating system. I would recommend asking Google for a solution. I know that external harddrives could cause problems, but you'll have to look up the exact root cause.
     
    toddkc likes this.
  20. AntonAndev

    AntonAndev

    Joined:
    Aug 13, 2014
    Posts:
    44
    Hello, when do you plan to upgrade this project from MLAPI to Netcode for GameObjects?
     
  21. LegoStarYT

    LegoStarYT

    Joined:
    Jan 13, 2022
    Posts:
    11
    i fixed it, it was my anti virus software
     
    Baroni likes this.
  22. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Hi there, thanks for asking.

    I have planned to work on this during January with a release early February. Except another new Netcode version comes out, which would delay it for an additional week.
     
  23. LegoStarYT

    LegoStarYT

    Joined:
    Jan 13, 2022
    Posts:
    11
    I see the mobile controllers for mobile but when i did a test on mobile everything worked except moving, it didnt let me move.
     
  24. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Unfortunately your issue description is too vague and does not contain enough details for me to help out. What network provider are you using, what mobile device, is this in the default scenes without modifications, any errors on the device log when trying to drag the joystick?
     
  25. LegoStarYT

    LegoStarYT

    Joined:
    Jan 13, 2022
    Posts:
    11
    one more question, am i allowed to publish the game to a game service like steam, itch.io, etc? (i did change stuff and add my own stuff)
     
  26. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
  27. LegoStarYT

    LegoStarYT

    Joined:
    Jan 13, 2022
    Posts:
    11
    thank you so much!
     
  28. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    @LegoStarYT sure! Don't forget to leave a review with a link to your game :)
     
  29. LegoStarYT

    LegoStarYT

    Joined:
    Jan 13, 2022
    Posts:
    11
    ok i will!
     
  30. LegoStarYT

    LegoStarYT

    Joined:
    Jan 13, 2022
    Posts:
    11
    i know its embarrassing but i dont usually use reviews so i dont know how to, can you tell me how to?
     
  31. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Of course! If you go to the asset's Asset Store page with your account signed in, scroll down or click on the Reviews section. Below the star rating, there is a button named "Write a Review". ;)
     
  32. LegoStarYT

    LegoStarYT

    Joined:
    Jan 13, 2022
    Posts:
    11
    ok thanks i wrote the review with the link to my game :)
     
    Last edited: Jan 15, 2022
    Baroni likes this.
  33. LegoStarYT

    LegoStarYT

    Joined:
    Jan 13, 2022
    Posts:
    11
    also about the mobile thing the shooting worked but when i would touch the move control it would shoot instead of move
     
  34. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    I am not able to reproduce that, the move joystick (left side) is not connected to any shooting methods or the shoot joystick (right side) in any way. Could you provide steps to reproduce this in a new project (standard asset without modifications)?
     
  35. LegoStarYT

    LegoStarYT

    Joined:
    Jan 13, 2022
    Posts:
    11
  36. giftgamebr

    giftgamebr

    Joined:
    Dec 8, 2021
    Posts:
    11
    How to increase shooting distance?

    How to increase the number of shots of special bullets?
     
  37. giftgamebr

    giftgamebr

    Joined:
    Dec 8, 2021
    Posts:
    11
    I would like to add a sound to the tank, which method do you advise me to use?
     
  38. giftgamebr

    giftgamebr

    Joined:
    Dec 8, 2021
    Posts:
    11
    How do I put the tank's whells to spin?
     
  39. fobeaumer

    fobeaumer

    Joined:
    Mar 7, 2021
    Posts:
    4
    Hello :)

    I'm currently adding the Universal Render Pipeline Asset. I changed all materials to don't have them pink.
    So it works great on the Unity Editor view, nothing is impacted !
    But, when I play a windows build of the game, I'm blocked after the menu with only the UI displayed:

    upload_2022-1-16_20-21-43.png

    I can tell the game works well in the background because I can shoot & move the player. Also, with a client from Unity Editor, I can see the windows player moving and shooting.
    But I can't see what happens from the Windows Client... The player doesn't have the world displayed, only the UI.

    EDIT: Also, if I check the scene of the map directly (without menu), I can see it from unity editor, but not from windows client built.

    Do you know how to fix URP renderer compatibility please ?
    Thank you in advance.
     
  40. giftgamebr

    giftgamebr

    Joined:
    Dec 8, 2021
    Posts:
    11
    Tanks pass through other tanks. how do i fix this?

    when I force the passage through a stop, sometimes I cross it, how do I fix that?
     
  41. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Thanks for your patience over the weekend. I'm going over the questions one by one:

    @giftgamebr
    If you mean the duration before the bullet gets despawned, have a look at the "despawnDelay" variable on the prefab's Bullet component.

    Increase the "amount" variable on the prefab's PowerupBullet component.

    I would just slap an AudioSource component on the tank, as an engine sound is not something that would need be synchronized over the network. If you would like to go more fancy, you could also use a Mecanim Controller with an idle + driving state, that reads input from the arrow keys/joystick and transitions between both states.

    Again, that would be reading the input from the arrow keys/joystick and if one of the direction values is greater than 0, the tank is moving. You could then write a short script that rotates the wheels around their local axis.

    Please see the FAQ, point "Players can't collide with each other. How do I enable it?".

    I'm not sure what exactly you mean, could you explain? If you mean your tank or bullets go through walls, please see this thread which mentions increasing the "Default Max Depenetration Velocity" in the Project Settings > Physics section.

    @fobeaumer
    Hi there and thanks for the description. As this issue is not specific to the asset, I found some other threads mentioning the same problem - only UI visible, not game objects. There could be useful information in the thread here or here, specifically updating the URP package, converting materials, switching to DX11, or adding an AR Background Renderer.
     
    fobeaumer likes this.
  42. giftgamebr

    giftgamebr

    Joined:
    Dec 8, 2021
    Posts:
    11
    Hello, I'm changing the menu interface for a new one.

    I would like your help to understand how I can do this.

    first, I would like to put a button for TDM and another button for CTF:







    ----------------



    I would like your help with the game's audio. as I left the camera a little further than it came in the game's default, the sound was too far away, I would like to know how I can increase this audio so that I can hear correctly:
    camera distance:
    upload_2022-1-22_16-34-49.png

    -----------------

    I put some objects on the map that are not fixed, but I noticed that this obj is invisible to the other player so that each player rederizes his own obj in the scene. I would like to know how to fix this.

    Payer 1:

    upload_2022-1-22_16-37-40.png

    Player 2:

    upload_2022-1-22_16-37-50.png
     

    Attached Files:

  43. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Hi @giftgamebr,

    In the default project, the game mode dropdown calls the OnGameModeChanged method on the UIMain script. Please have a look in there - on your button, you would want to set the PrefsKeys.gameMode PlayerPrefs value as done in that callback, before starting the game as done with the Play button. 0 for TDM or 1 for CTF.

    Please have a look at the official documentation on the AudioListener and AudioSource components. 3D sounds have a max distance which can be seen in the screenshot on the AudioSource page. You may want to increase it or play around with the distance fallback for your different sounds. This is general Unity stuff, not specific to this asset, so you could also look up more information or tutorials from other sources.

    Well you are playing a multiplayer game, but did not network the object. Objects are not synchronized over the network by default. You have to assign a NetworkIdentity + NetworkTransform component on the object for it to send updates across players. You can have a look at the powerups or bullets for reference.
     
  44. Hedeag

    Hedeag

    Joined:
    Feb 10, 2015
    Posts:
    29
    Hello, how to make bots shoot in online mode?
     
  45. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Hi @Hedeag, your question could be rephrased to "how do I make a class synchronized across the network", which is not that easy to answer. Bots in this asset were designed to be offline only, so they make use of e.g. Unity navigation and local bullet pooling. You would basically need to break the PlayerBot class into several areas and rewrite it to make it "networkable". The main components and design areas of the PlayerBot class could be:
    • navigation (do you want to let the server calculate the pathfinding, then attach a NetworkTransform component on it?)
    • health, shield, weapon index variables (verify that they are making use of NetworkVariables)
    • shooting and bullet instantiation (make use of RPCs)
    • power ups (again NetworkVariables or RPCs)
    So to summarize, it's not an easy task to do, but you could take the main Player class for reference and then port it over one by one.
     
  46. Hedeag

    Hedeag

    Joined:
    Feb 10, 2015
    Posts:
    29
    No, I meant a little different, I set it up so that the bots would appear online, but they drive and don’t shoot, but as I understand it, there is an option somewhere so that they shoot offline? Or am I wrong and they don't shoot because of non-network scripts? Just as I understand it, the Shoot command in the bot player script itself does not start even if I set the online mode. That is, it seems that for some reason the bot stops looking for a target.
     
  47. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    By default bots are disabled in the "Online" and "LAN" modes since they do not fully work across the network, due to the mentioned lack of synchronization. They are only supported in the "Offline" mode.
    Not quite sure what you mean, as the PlayerBot class calls the Shoot method of the Player class directly. In the Offline mode, it would then get executed on the host (your PC). If you find that this is not working as intended in the Offline mode, please let me know the networking provider you are using, so I can investigate.
     
  48. Hedeag

    Hedeag

    Joined:
    Feb 10, 2015
    Posts:
    29

    Attached Files:

    • hhh.jpg
      hhh.jpg
      File size:
      138.2 KB
      Views:
      284
  49. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    @Hedeag Please do not post screenshots or other forms of source code in a public forum like this. I can only repeat, the current version of bots are not supported and have not been tested with the Online mode.
     
    toddkc likes this.
  50. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    v1.6.1
    - Unity Netcode (formerly MLAPI) compatibility updated to 1.0.0pre5
    - Mirror compatibility updated to 57.0.0

    Available on my website now (direct purchasers) and on the Asset Store in ~1 week.
     
    toddkc likes this.